From 028897f10bb9dc5c6d8829ecbe4363bddef5b967 Mon Sep 17 00:00:00 2001 From: ikimath Date: Tue, 21 May 2024 16:17:05 +0200 Subject: [PATCH] added method to print loc of metadata in differents formats --- .../FMDataStructurePrinter.class.st | 15 +++++++++++++ .../FMImporterFilter.class.st | 4 +++- src/Fame-ImportExport/FMJSONPrinter.class.st | 21 +++++++++++++++++++ src/Fame-ImportExport/FMMSEPrinter.class.st | 21 +++++++++++++++++++ src/Fame-ImportExport/FMXMLPrinter.class.st | 20 ++++++++++++++++++ 5 files changed, 80 insertions(+), 1 deletion(-) diff --git a/src/Fame-ImportExport/FMDataStructurePrinter.class.st b/src/Fame-ImportExport/FMDataStructurePrinter.class.st index de92c610..b8b69298 100644 --- a/src/Fame-ImportExport/FMDataStructurePrinter.class.st +++ b/src/Fame-ImportExport/FMDataStructurePrinter.class.st @@ -52,6 +52,21 @@ FMDataStructurePrinter >> crTabs [ tab: indent ] +{ #category : #printing } +FMDataStructurePrinter >> printEntityCloser [ +^ self subclassResponsibility +] + +{ #category : #printing } +FMDataStructurePrinter >> printEntityLineBreak [ +^ self subclassResponsibility +] + +{ #category : #printing } +FMDataStructurePrinter >> printEntityOpener [ +^ self subclassResponsibility +] + { #category : #accessing } FMDataStructurePrinter >> stream [ ^ stream diff --git a/src/Fame-ImportExport/FMImporterFilter.class.st b/src/Fame-ImportExport/FMImporterFilter.class.st index d903bb6a..68ddcdb9 100644 --- a/src/Fame-ImportExport/FMImporterFilter.class.st +++ b/src/Fame-ImportExport/FMImporterFilter.class.st @@ -41,8 +41,10 @@ FMImporterFilter >> beginDocument [ { #category : #parsing } FMImporterFilter >> beginEntity: name [ + (filter includes: name) - ifTrue: [ shouldSkip := false. + ifTrue: [ + shouldSkip := false. importer beginEntity: name ] ifFalse: [ shouldSkip := true ] ] diff --git a/src/Fame-ImportExport/FMJSONPrinter.class.st b/src/Fame-ImportExport/FMJSONPrinter.class.st index ccc74adc..dbc52560 100644 --- a/src/Fame-ImportExport/FMJSONPrinter.class.st +++ b/src/Fame-ImportExport/FMJSONPrinter.class.st @@ -79,6 +79,27 @@ FMJSONPrinter >> primitive: value [ ifFalse: [ value msePrintOn: stream ] ] +{ #category : #parsing } +FMJSONPrinter >> printEntityCloser [ +indent := indent - 1. + self crTabs. + stream nextPut: $}. + +] + +{ #category : #printing } +FMJSONPrinter >> printEntityLineBreak [ +^ self crTabs +] + +{ #category : #parsing } +FMJSONPrinter >> printEntityOpener [ + + indent := indent + 1. + stream nextPutAll: '{'. + self crTabs +] + { #category : #parsing } FMJSONPrinter >> printEntitySeparator [ stream nextPut: $, diff --git a/src/Fame-ImportExport/FMMSEPrinter.class.st b/src/Fame-ImportExport/FMMSEPrinter.class.st index 9153d526..13bc921a 100644 --- a/src/Fame-ImportExport/FMMSEPrinter.class.st +++ b/src/Fame-ImportExport/FMMSEPrinter.class.st @@ -68,6 +68,27 @@ FMMSEPrinter >> primitive: value [ value msePrintOn: stream ] +{ #category : #printing } +FMMSEPrinter >> printEntityCloser [ + + indent := indent - 1. + self crTabs. + stream nextPut: $) +] + +{ #category : #printing } +FMMSEPrinter >> printEntityLineBreak [ +^self crTabs +] + +{ #category : #printing } +FMMSEPrinter >> printEntityOpener [ + + indent := indent + 1. +stream nextPut: $(. + self crTabs. +] + { #category : #parsing } FMMSEPrinter >> referenceName: name [ stream diff --git a/src/Fame-ImportExport/FMXMLPrinter.class.st b/src/Fame-ImportExport/FMXMLPrinter.class.st index cdb10a72..06d7170b 100644 --- a/src/Fame-ImportExport/FMXMLPrinter.class.st +++ b/src/Fame-ImportExport/FMXMLPrinter.class.st @@ -115,6 +115,26 @@ FMXMLPrinter >> primitive: value [ indent := indent - 1 ] +{ #category : #parsing } +FMXMLPrinter >> printEntityCloser [ + + stream nextPut: $>. + self crTabs +] + +{ #category : #printing } +FMXMLPrinter >> printEntityLineBreak [ +^ self crTabs +] + +{ #category : #parsing } +FMXMLPrinter >> printEntityOpener [ + + stream nextPut: $>. + indent := indent + 1. + self crTabs +] + { #category : #parsing } FMXMLPrinter >> referenceName: name [