From VisualWorks®, Release 7 of June 14, 2002 on December 27, 2002 at 9:06:30 am
CormasNS.Kernel.SpaceModel import - export
exportAttribute: attributeName fromClass: className
| stream filename |
filename := (Cormas mapsPath: self cormasModel class name)
construct: className asString, attributeName asString , '.txt'.
stream := filename asFilename writeStream.
(self spatialEntities notNil and:
[self spatialEntities isEmpty not and:
[(self spatialEntities includesKey: className)
and: [(self spatialEntities at: className) isEmpty not]]])
ifTrue:
[(self spatialEntities at: className) do: [:a | stream store: (a perform: attributeName); cr]].
stream close
CormasNS.Kernel.SpaceModel import - export
importAttribute: attributeName fromClass: className
| stream filename fileData |
filename := (Cormas mapsPath: self cormasModel class name)
construct: className asString, attributeName asString , '.txt'.
stream := filename asFilename readStream.
fileData := OrderedCollection new.
[[stream atEnd] whileFalse: [fileData add: (stream upTo: Character cr)]]
valueNowOrOnUnwindDo: [stream close].
(self spatialEntities notNil and:
[self spatialEntities isEmpty not and:
[(self spatialEntities includesKey: className)
and: [(self spatialEntities at: className) isEmpty not]]])
ifTrue:
[(self spatialEntities at: className) with: fileData
do: [:a :x |
(a perform: (attributeName asString , ':') asSymbol with: (Compiler evaluate: x))]]