0
|
1 |
"{ Package: 'stx:goodies/ston' }"!
|
|
2 |
|
|
3 |
!Association methodsFor:'*ston-core'!
|
|
4 |
|
|
5 |
stonOn: stonWriter
|
|
6 |
self class == STON associationClass
|
|
7 |
ifTrue: [ stonWriter writeAssociation: self ]
|
|
8 |
ifFalse: [ super stonOn: stonWriter ]
|
|
9 |
|
|
10 |
! !
|
|
11 |
|
|
12 |
!Bag methodsFor:'*STON-Core'!
|
|
13 |
|
|
14 |
stonOn: stonWriter
|
|
15 |
"Use a map with element-occurences pairs as representation"
|
|
16 |
|
|
17 |
stonWriter
|
|
18 |
writeObject: self
|
|
19 |
do: [ stonWriter encodeMap: contents ]
|
|
20 |
! !
|
|
21 |
|
|
22 |
!Bag class methodsFor:'*STON-Core'!
|
|
23 |
|
|
24 |
fromSton: stonReader
|
|
25 |
"Read a map representation containing element/occurences pairs"
|
|
26 |
|
|
27 |
| bag |
|
|
28 |
bag := self new.
|
|
29 |
stonReader parseMapDo: [ :key :value |
|
|
30 |
bag add: key withOccurrences: value ].
|
|
31 |
^ bag
|
|
32 |
! !
|
|
33 |
|
|
34 |
!Boolean methodsFor:'*ston-core'!
|
|
35 |
|
|
36 |
stonContainSubObjects
|
|
37 |
^ false
|
|
38 |
! !
|
|
39 |
|
|
40 |
!Boolean methodsFor:'*ston-core'!
|
|
41 |
|
|
42 |
stonOn: stonWriter
|
|
43 |
stonWriter writeBoolean: self
|
|
44 |
! !
|
|
45 |
|
|
46 |
!ByteArray methodsFor:'*ston-core'!
|
|
47 |
|
|
48 |
stonContainSubObjects
|
|
49 |
^ false
|
|
50 |
! !
|
|
51 |
|
|
52 |
!ByteArray methodsFor:'*ston-core'!
|
|
53 |
|
|
54 |
stonOn: stonWriter
|
|
55 |
"Use a hex representation"
|
|
56 |
|
|
57 |
stonWriter writeObject: self listSingleton: self hexPrintString
|
|
58 |
|
|
59 |
"Modified: / 04-06-2019 / 11:06:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
60 |
! !
|
|
61 |
|
|
62 |
!ByteArray class methodsFor:'*ston-core'!
|
|
63 |
|
|
64 |
fromSton: stonReader
|
|
65 |
"Use a hex representation"
|
|
66 |
|
|
67 |
^ self fromHexString: stonReader parseListSingleton
|
|
68 |
|
|
69 |
"Modified: / 04-06-2019 / 11:07:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
70 |
! !
|
|
71 |
|
|
72 |
!Character methodsFor:'*ston-core'!
|
|
73 |
|
|
74 |
stonOn: stonWriter
|
|
75 |
stonWriter writeObject: self listSingleton: self asString
|
|
76 |
! !
|
|
77 |
|
|
78 |
!Character class methodsFor:'*ston-core'!
|
|
79 |
|
|
80 |
fromSton: stonReader
|
|
81 |
^ stonReader parseListSingleton first
|
|
82 |
! !
|
|
83 |
|
|
84 |
!CharacterArray class methodsFor:'Compatibility-Pharo'!
|
|
85 |
|
|
86 |
findFirstInString: aString inSet: inclusionMap startingAt: start
|
|
87 |
| i stringSize |
|
|
88 |
|
|
89 |
inclusionMap size ~= 256 ifTrue: [ ^0 ].
|
|
90 |
|
|
91 |
i := start.
|
|
92 |
stringSize := aString size.
|
|
93 |
[ i <= stringSize and: [ (inclusionMap at: (aString basicAt: i) codePoint + 1) = 0 ] ] whileTrue: [
|
|
94 |
i := i + 1 ].
|
|
95 |
|
|
96 |
i > stringSize ifTrue: [ ^0 ].
|
|
97 |
^i
|
|
98 |
|
|
99 |
"Created: / 20-05-2020 / 13:24:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
100 |
! !
|
|
101 |
|
|
102 |
!Class methodsFor:'*ston-core'!
|
|
103 |
|
|
104 |
stonOn: stonWriter
|
|
105 |
stonWriter
|
|
106 |
writeObject: self
|
|
107 |
listSingleton: self name asSymbol
|
|
108 |
! !
|
|
109 |
|
|
110 |
!Class class methodsFor:'*ston-core'!
|
|
111 |
|
|
112 |
fromSton: stonReader
|
|
113 |
| theClassName theClass |
|
|
114 |
theClassName := stonReader parseListSingleton.
|
|
115 |
theClass := self environment at: theClassName.
|
|
116 |
^ theClass
|
|
117 |
! !
|
|
118 |
|
|
119 |
!ClassDescription methodsFor:'*ston-core'!
|
|
120 |
|
|
121 |
stonContainSubObjects
|
|
122 |
^ false
|
|
123 |
! !
|
|
124 |
|
|
125 |
!Collection methodsFor:'*ston-core'!
|
|
126 |
|
|
127 |
stonOn: stonWriter
|
|
128 |
"For collections we chose to write a list of elements as delivered by #do:
|
|
129 |
This is not the best or most correct solution for all subclasses though,
|
|
130 |
so some will revert to standard object behavior or chose another solution"
|
|
131 |
|
|
132 |
stonWriter writeObject: self do: [
|
|
133 |
stonWriter encodeList: self ]
|
|
134 |
! !
|
|
135 |
|
|
136 |
!Collection class methodsFor:'*ston-core'!
|
|
137 |
|
|
138 |
fromSton: stonReader
|
|
139 |
"For collections we chose to instanciate based a list of elements using #add:
|
|
140 |
This is not the best or most correct solution for all subclasses though,
|
|
141 |
so some will revert to standard object behavior or chose another solution."
|
|
142 |
|
|
143 |
| collection |
|
|
144 |
collection := self new.
|
|
145 |
stonReader parseListDo: [ :each |
|
|
146 |
collection add: each ].
|
|
147 |
^ collection
|
|
148 |
! !
|
|
149 |
|
|
150 |
!Color methodsFor:'*ston-core'!
|
|
151 |
|
|
152 |
stonContainSubObjects
|
|
153 |
^ false
|
|
154 |
! !
|
|
155 |
|
|
156 |
!Color methodsFor:'*ston-core'!
|
|
157 |
|
|
158 |
stonOn: stonWriter
|
|
159 |
| name |
|
|
160 |
(self isTranslucent or: [ (name := self name) = nil ])
|
|
161 |
ifTrue: [
|
|
162 |
stonWriter writeObject: self streamMap: [ :map |
|
|
163 |
#(red green blue alpha) do: [ :each |
|
|
164 |
map at: each put: ((self perform: each) roundTo: 0.001) ] ] ]
|
|
165 |
ifFalse: [
|
|
166 |
stonWriter writeObject: self listSingleton: name ]
|
|
167 |
|
|
168 |
"Modified: / 20-05-2020 / 13:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
169 |
! !
|
|
170 |
|
|
171 |
!Color class methodsFor:'*ston-core'!
|
|
172 |
|
|
173 |
fromSton: stonReader
|
|
174 |
| representation |
|
|
175 |
representation := stonReader parseSimpleValue.
|
|
176 |
^ representation isArray
|
|
177 |
ifTrue: [
|
|
178 |
self name: representation first ]
|
|
179 |
ifFalse: [
|
|
180 |
self
|
|
181 |
r: (representation at: #red)
|
|
182 |
g: (representation at: #green)
|
|
183 |
b: (representation at: #blue)
|
|
184 |
alpha: (representation at: #alpha) ]
|
|
185 |
|
|
186 |
"Modified: / 20-05-2020 / 12:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
187 |
! !
|
|
188 |
|
|
189 |
!Date methodsFor:'*ston-core'!
|
|
190 |
|
|
191 |
stonContainSubObjects
|
|
192 |
^ false
|
|
193 |
! !
|
|
194 |
|
|
195 |
!Date methodsFor:'*ston-core'!
|
|
196 |
|
|
197 |
stonOn: stonWriter
|
|
198 |
"Use an ISO style YYYY-MM-DD representation.
|
|
199 |
Since my current implementation is time zone offset sensitive, the offset has to be included."
|
|
200 |
|
|
201 |
| representation |
|
|
202 |
representation := self offset isZero
|
|
203 |
ifTrue: [
|
|
204 |
String new: 11 streamContents: [ :out |
|
|
205 |
self printOn: out format: #(3 2 1 $- 1 1 2).
|
|
206 |
out nextPut: $Z ] ]
|
|
207 |
ifFalse: [
|
|
208 |
String new: 32 streamContents: [ :out |
|
|
209 |
self printOn: out format: #(3 2 1 $- 1 1 2).
|
|
210 |
out nextPut: (self offset positive ifTrue: [ $+ ] ifFalse: [ $- ]).
|
|
211 |
self offset hours abs printOn: out base: 10 length: 2 padded: true.
|
|
212 |
out nextPut: $:.
|
|
213 |
self offset minutes abs printOn: out base: 10 length: 2 padded: true.
|
|
214 |
self offset seconds = 0
|
|
215 |
ifFalse:[
|
|
216 |
out nextPut: $:; print: self offset seconds abs truncated ] ] ].
|
|
217 |
stonWriter writeObject: self listSingleton: representation
|
|
218 |
! !
|
|
219 |
|
|
220 |
!Date class methodsFor:'*ston-core'!
|
|
221 |
|
|
222 |
fromSton: stonReader
|
|
223 |
"Read a ISO YYYY-MM-DD format.
|
|
224 |
Since my current implementation is time zone offset sensitive, the offset has to be taken into account.
|
|
225 |
A missing offset results in the local timezone offset to be used"
|
|
226 |
|
|
227 |
| readStream date |
|
|
228 |
readStream := stonReader parseListSingleton readStream.
|
|
229 |
date := self readFrom: readStream.
|
|
230 |
readStream atEnd
|
|
231 |
ifFalse: [ | offset |
|
|
232 |
offset := DateAndTime readTimezoneOffsetFrom: readStream.
|
|
233 |
offset = date offset
|
|
234 |
ifFalse: [ date start: (date start translateTo: offset) ] ].
|
|
235 |
^ date
|
|
236 |
! !
|
|
237 |
|
|
238 |
!Dictionary methodsFor:'*ston-core'!
|
|
239 |
|
|
240 |
stonOn: stonWriter
|
|
241 |
"Instances of STON mapClass will be encoded directly, without a class tag.
|
|
242 |
Other (sub)classes will be encoded with a class tag and will use a map representation. "
|
|
243 |
|
|
244 |
self class == STON mapClass
|
|
245 |
ifTrue: [
|
|
246 |
stonWriter writeMap: self ]
|
|
247 |
ifFalse: [
|
|
248 |
stonWriter
|
|
249 |
writeObject: self
|
|
250 |
do: [ stonWriter encodeMap: self ] ]
|
|
251 |
! !
|
|
252 |
|
|
253 |
!Dictionary methodsFor:'*ston-core'!
|
|
254 |
|
|
255 |
stonPostReferenceResolution
|
|
256 |
"When references were resolved in me, the hash of my keys might have changed.
|
|
257 |
Check if I am still healthy and rehash me if not."
|
|
258 |
|
|
259 |
self rehash
|
|
260 |
|
|
261 |
"Modified: / 04-06-2019 / 11:08:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
262 |
! !
|
|
263 |
|
|
264 |
!Dictionary class methodsFor:'*ston-core'!
|
|
265 |
|
|
266 |
fromSton: stonReader
|
|
267 |
"Instances of STON mapClass will be read directly and won't arrive here.
|
|
268 |
Other (sub)classes will use this method."
|
|
269 |
|
|
270 |
| dictionary |
|
|
271 |
dictionary := self new.
|
|
272 |
stonReader parseMapDo: [ :key :value |
|
|
273 |
dictionary at: key put: value ].
|
|
274 |
^ dictionary
|
|
275 |
! !
|
|
276 |
|
|
277 |
!Filename methodsFor:'*ston-core'!
|
|
278 |
|
|
279 |
stonContainSubObjects
|
|
280 |
^ false
|
|
281 |
! !
|
|
282 |
|
|
283 |
!Filename methodsFor:'*ston-core'!
|
|
284 |
|
|
285 |
stonOn: stonWriter
|
|
286 |
true
|
|
287 |
ifTrue: [ | diskFilePath |
|
|
288 |
diskFilePath := self pathName.
|
|
289 |
stonWriter
|
|
290 |
writeObject: self
|
|
291 |
named: STONFileReference stonName
|
|
292 |
listSingleton: diskFilePath ]
|
|
293 |
ifFalse: [
|
|
294 |
super stonOn: stonWriter ]
|
|
295 |
|
|
296 |
"Modified: / 04-06-2019 / 12:31:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
297 |
! !
|
|
298 |
|
|
299 |
!Fraction methodsFor:'*ston-core'!
|
|
300 |
|
|
301 |
stonOn: stonWriter
|
|
302 |
stonWriter writeFraction: self
|
|
303 |
! !
|
|
304 |
|
|
305 |
!Integer methodsFor:'*ston-core'!
|
|
306 |
|
|
307 |
stonOn: stonWriter
|
|
308 |
stonWriter writeInteger: self
|
|
309 |
! !
|
|
310 |
|
|
311 |
!Interval methodsFor:'*ston-core'!
|
|
312 |
|
|
313 |
fromSton: stonReader
|
|
314 |
"Overwritten to get back the standard object behavior"
|
|
315 |
|
|
316 |
stonReader parseNamedInstVarsFor: self
|
|
317 |
! !
|
|
318 |
|
|
319 |
!Interval methodsFor:'*ston-core'!
|
|
320 |
|
|
321 |
stonOn: stonWriter
|
|
322 |
"Overwritten to get back the standard object behavior"
|
|
323 |
|
|
324 |
stonWriter writeObject: self
|
|
325 |
! !
|
|
326 |
|
|
327 |
!Interval class methodsFor:'*ston-core'!
|
|
328 |
|
|
329 |
fromSton: stonReader
|
|
330 |
"Overwritten to get back the standard object behavior"
|
|
331 |
|
|
332 |
^ self new
|
|
333 |
fromSton: stonReader;
|
|
334 |
yourself
|
|
335 |
! !
|
|
336 |
|
|
337 |
!Metaclass methodsFor:'*ston-core'!
|
|
338 |
|
|
339 |
stonName
|
|
340 |
^ #Class
|
|
341 |
! !
|
|
342 |
|
|
343 |
!Metaclass methodsFor:'*ston-core'!
|
|
344 |
|
|
345 |
stonOn: stonWriter
|
|
346 |
stonWriter
|
|
347 |
writeObject: self
|
|
348 |
listSingleton: self theNonMetaclass name asSymbol
|
|
349 |
|
|
350 |
"Modified: / 04-06-2019 / 11:20:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
351 |
! !
|
|
352 |
|
|
353 |
!Metaclass class methodsFor:'*ston-core'!
|
|
354 |
|
|
355 |
fromSton: stonReader
|
|
356 |
| theClassName theClass theMetaclass |
|
|
357 |
theClassName := stonReader parseListSingleton.
|
|
358 |
theClass := self environment at: theClassName.
|
|
359 |
theMetaclass := theClass class.
|
|
360 |
^ theMetaclass
|
|
361 |
! !
|
|
362 |
|
|
363 |
!Number methodsFor:'*ston-core'!
|
|
364 |
|
|
365 |
stonContainSubObjects
|
|
366 |
^ false
|
|
367 |
! !
|
|
368 |
|
|
369 |
!Number methodsFor:'*ston-core'!
|
|
370 |
|
|
371 |
stonOn: stonWriter
|
|
372 |
stonWriter writeFloat: self asFloat
|
|
373 |
! !
|
|
374 |
|
|
375 |
!Object methodsFor:'*ston-core'!
|
|
376 |
|
|
377 |
fromSton: stonReader
|
|
378 |
"Decode non-variable classes from a map of their instance variables and values.
|
|
379 |
Override to customize and add a matching #toSton: (see implementors)."
|
|
380 |
|
|
381 |
self class isVariable
|
|
382 |
ifTrue: [
|
|
383 |
stonReader error: 'custom #fromSton: implementation needed for variable/indexable class' ]
|
|
384 |
ifFalse: [
|
|
385 |
stonReader parseNamedInstVarsFor: self ]
|
|
386 |
! !
|
|
387 |
|
|
388 |
!Object methodsFor:'*ston-core'!
|
|
389 |
|
|
390 |
isStonReference
|
|
391 |
^ false
|
|
392 |
! !
|
|
393 |
|
|
394 |
!Object methodsFor:'*ston-core'!
|
|
395 |
|
|
396 |
stonContainSubObjects
|
|
397 |
"Return true if I contain subObjects that should be processed, false otherwise.
|
|
398 |
Overwrite when necessary. See also #stonProcessSubObjects:"
|
|
399 |
|
|
400 |
^ true
|
|
401 |
! !
|
|
402 |
|
|
403 |
!Object methodsFor:'*ston-core'!
|
|
404 |
|
|
405 |
stonOn: stonWriter
|
|
406 |
"Encode non-variable classes with a map of their instance variable and values.
|
|
407 |
Override to customize and add a matching #fromSton: (see implementors)."
|
|
408 |
|
|
409 |
self class isVariable
|
|
410 |
ifTrue: [
|
|
411 |
stonWriter error: 'custom #stonOn: implementation needed for variable/indexable class' ]
|
|
412 |
ifFalse: [
|
|
413 |
stonWriter writeObject: self ]
|
|
414 |
! !
|
|
415 |
|
|
416 |
!Object methodsFor:'*ston-core'!
|
|
417 |
|
|
418 |
stonPostReferenceResolution
|
|
419 |
"Hook that is called when references were resolved processing this object or one of its sub objects. This will most probably influence hash values. Override to take appropriate action."
|
|
420 |
! !
|
|
421 |
|
|
422 |
!Object methodsFor:'*ston-core'!
|
|
423 |
|
|
424 |
stonProcessSubObjects: block
|
|
425 |
"Execute block to (potentially) change each of my subObjects.
|
|
426 |
In general, all instance and indexable variables are processed.
|
|
427 |
Overwrite when necessary. Not used when #stonContainSubObjects returns false."
|
|
428 |
|
|
429 |
1 to: self class instSize do: [ :each |
|
|
430 |
self instVarAt: each put: (block value: (self instVarAt: each)) ].
|
|
431 |
(self class isVariable and: [ self class isBytes not ])
|
|
432 |
ifTrue: [
|
|
433 |
1 to: self basicSize do: [ :each |
|
|
434 |
self basicAt: each put: (block value: (self basicAt: each)) ] ]
|
|
435 |
! !
|
|
436 |
|
|
437 |
!Object methodsFor:'*ston-core'!
|
|
438 |
|
|
439 |
stonShouldWriteNilInstVars
|
|
440 |
"Return true if my instance variables that are nil should be written out,
|
|
441 |
false otherwise. Overwrite when necessary. By default, return false."
|
|
442 |
|
|
443 |
^ false
|
|
444 |
! !
|
|
445 |
|
|
446 |
!Object class methodsFor:'*ston-core'!
|
|
447 |
|
|
448 |
fromSton: stonReader
|
|
449 |
"Create a new instance and delegate decoding to instance side.
|
|
450 |
Override only when new instance should be created directly (see implementors). "
|
|
451 |
|
|
452 |
^ self new
|
|
453 |
fromSton: stonReader;
|
|
454 |
yourself
|
|
455 |
! !
|
|
456 |
|
|
457 |
!Object class methodsFor:'*ston-core'!
|
|
458 |
|
|
459 |
stonAllInstVarNames
|
|
460 |
"Override to encode my instances using a custom set of instance variables or to define their order."
|
|
461 |
|
|
462 |
^ self allInstVarNames
|
|
463 |
! !
|
|
464 |
|
|
465 |
!Object class methodsFor:'*ston-core'!
|
|
466 |
|
|
467 |
stonName
|
|
468 |
"Override to encode my instances using a different class name.
|
|
469 |
Use symbols as class name/tag."
|
|
470 |
|
|
471 |
^ self name
|
|
472 |
! !
|
|
473 |
|
|
474 |
!OrderedDictionary methodsFor:'*ston-core'!
|
|
475 |
|
|
476 |
stonOn: stonWriter
|
|
477 |
"I store my instances as maps. When in JSON mode,
|
|
478 |
encode me directly, without a class tag, keeping the order."
|
|
479 |
|
|
480 |
stonWriter jsonMode
|
|
481 |
ifTrue: [
|
|
482 |
stonWriter encodeMap: self ]
|
|
483 |
ifFalse: [
|
|
484 |
stonWriter
|
|
485 |
writeObject: self
|
|
486 |
do: [ stonWriter encodeMap: self ] ]
|
|
487 |
! !
|
|
488 |
|
|
489 |
!OrderedDictionary class methodsFor:'*ston-core'!
|
|
490 |
|
|
491 |
fromSton: stonReader
|
|
492 |
"My instances are stored as maps."
|
|
493 |
|
|
494 |
| dictionary |
|
|
495 |
dictionary := self new.
|
|
496 |
stonReader parseMapDo: [ :key :value |
|
|
497 |
dictionary at: key put: value ].
|
|
498 |
^ dictionary
|
|
499 |
! !
|
|
500 |
|
|
501 |
!Point methodsFor:'*ston-core'!
|
|
502 |
|
|
503 |
fromSton: stonReader
|
|
504 |
stonReader parseListDo: [ :each :index |
|
|
505 |
index = 1 ifTrue: [ x := each ].
|
|
506 |
index = 2 ifTrue: [ y := each ] ]
|
|
507 |
! !
|
|
508 |
|
|
509 |
!Point methodsFor:'*ston-core'!
|
|
510 |
|
|
511 |
stonOn: stonWriter
|
|
512 |
stonWriter writeObject: self streamShortList: [ :array |
|
|
513 |
array add: x; add: y ]
|
|
514 |
! !
|
|
515 |
|
|
516 |
!RunArray class methodsFor:'*ston-core'!
|
|
517 |
|
|
518 |
fromSton: stonReader
|
|
519 |
"Overwritten to get back the standard object behavior"
|
|
520 |
|
|
521 |
^ self new
|
|
522 |
fromSton: stonReader;
|
|
523 |
yourself
|
|
524 |
! !
|
|
525 |
|
|
526 |
!SequenceableCollection methodsFor:'*ston-core'!
|
|
527 |
|
|
528 |
stonOn: stonWriter
|
|
529 |
"Instances of STON listClass will be encoded directly, without a class tag.
|
|
530 |
Other (sub)classes will be encoded with a class tag and will use a list representation. "
|
|
531 |
|
|
532 |
((self class == STON listClass) or:[ self class == ImmutableArray ])
|
|
533 |
ifTrue: [ stonWriter writeList: self ]
|
|
534 |
ifFalse: [ super stonOn: stonWriter ]
|
|
535 |
|
|
536 |
"Modified: / 20-05-2020 / 11:19:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
537 |
! !
|
|
538 |
|
|
539 |
!SequenceableCollection class methodsFor:'*ston-core'!
|
|
540 |
|
|
541 |
fromSton: stonReader
|
|
542 |
"Overwritten to use #streamContents: and #nextPut:"
|
|
543 |
|
|
544 |
^ self streamContents: [ :stream |
|
|
545 |
stonReader parseListDo: [ :each |
|
|
546 |
stream nextPut: each ] ]
|
|
547 |
! !
|
|
548 |
|
|
549 |
!Set methodsFor:'*ston-core'!
|
|
550 |
|
|
551 |
stonPostReferenceResolution
|
|
552 |
"When references were resolved in me, the hash of my elements might have changed.
|
|
553 |
Check if I am still healthy and rehash me if not."
|
|
554 |
|
|
555 |
self rehash
|
|
556 |
|
|
557 |
"Modified: / 04-06-2019 / 11:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
558 |
! !
|
|
559 |
|
|
560 |
!String methodsFor:'*ston-core'!
|
|
561 |
|
|
562 |
stonContainSubObjects
|
|
563 |
^ false
|
|
564 |
! !
|
|
565 |
|
|
566 |
!String methodsFor:'*ston-core'!
|
|
567 |
|
|
568 |
stonOn: stonWriter
|
|
569 |
stonWriter writeString: self
|
|
570 |
! !
|
|
571 |
|
|
572 |
!Symbol methodsFor:'*ston-core'!
|
|
573 |
|
|
574 |
stonOn: stonWriter
|
|
575 |
stonWriter writeSymbol: self
|
|
576 |
! !
|
|
577 |
|
|
578 |
!Time methodsFor:'*ston-core'!
|
|
579 |
|
|
580 |
stonContainSubObjects
|
|
581 |
^ false
|
|
582 |
! !
|
|
583 |
|
|
584 |
!Time methodsFor:'*ston-core'!
|
|
585 |
|
|
586 |
stonOn: stonWriter
|
|
587 |
"Use an ISO style HH:MM:SS.N representation (with optional nanoseconds)"
|
|
588 |
|
|
589 |
stonWriter writeObject: self listSingleton:
|
|
590 |
(String streamContents: [ :stream |
|
|
591 |
self print24: true showSeconds: true on: stream ])
|
|
592 |
! !
|
|
593 |
|
|
594 |
!Time class methodsFor:'*ston-core'!
|
|
595 |
|
|
596 |
fromSton: stonReader
|
|
597 |
^ self readFrom: stonReader parseListSingleton readStream
|
|
598 |
! !
|
|
599 |
|
|
600 |
!Timestamp methodsFor:'*ston-core'!
|
|
601 |
|
|
602 |
stonContainSubObjects
|
|
603 |
^ false
|
|
604 |
! !
|
|
605 |
|
|
606 |
!Timestamp methodsFor:'*ston-core'!
|
|
607 |
|
|
608 |
stonOn: stonWriter
|
|
609 |
"Use an ISO representation with all details YYYY-MM-DDTHH:MM:SS.N+TZ (with optional nanoseconds and timezone offset)"
|
|
610 |
|
|
611 |
stonWriter writeObject: self listSingleton:
|
|
612 |
(String streamContents: [ :stream |
|
|
613 |
self printOn: stream withLeadingSpace: false ])
|
|
614 |
! !
|
|
615 |
|
|
616 |
!Timestamp class methodsFor:'*ston-core'!
|
|
617 |
|
|
618 |
fromSton: stonReader
|
|
619 |
^ self readFrom: stonReader parseListSingleton readStream
|
|
620 |
! !
|
|
621 |
|
|
622 |
!URL class methodsFor:'*ston-core'!
|
|
623 |
|
|
624 |
fromSton: stonReader
|
|
625 |
| representation |
|
|
626 |
|
|
627 |
representation := stonReader parseSimpleValue.
|
|
628 |
representation isArray ifTrue:[
|
|
629 |
^ representation first asURL
|
|
630 |
] ifFalse:[
|
|
631 |
self error: 'Not yet supported'
|
|
632 |
].
|
|
633 |
|
|
634 |
"Created: / 20-05-2020 / 11:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
635 |
! !
|
|
636 |
|
|
637 |
!UndefinedObject methodsFor:'*ston-core'!
|
|
638 |
|
|
639 |
stonContainSubObjects
|
|
640 |
^ false
|
|
641 |
! !
|
|
642 |
|
|
643 |
!UndefinedObject methodsFor:'*ston-core'!
|
|
644 |
|
|
645 |
stonOn: stonWriter
|
|
646 |
stonWriter writeNull
|
|
647 |
! !
|
|
648 |
|
|
649 |
!stx_goodies_ston class methodsFor:'documentation'!
|
|
650 |
|
|
651 |
extensionsVersion_HG
|
|
652 |
|
|
653 |
^ '$Changeset: <not expanded> $'
|
|
654 |
! !
|