--- a/MCDefinition.st Thu Apr 23 15:08:45 2015 +0100
+++ b/MCDefinition.st Thu Apr 23 15:12:09 2015 +0100
@@ -1,5 +1,7 @@
"{ Package: 'stx:goodies/monticello' }"
+"{ NameSpace: Smalltalk }"
+
Object subclass:#MCDefinition
instanceVariableNames:''
classVariableNames:'Instances'
@@ -150,6 +152,44 @@
self subclassResponsibility
! !
+!MCDefinition methodsFor:'serializing'!
+
+storeDataOn: aDataStream
+ "Store myself on a DataStream.
+ Answer self.
+ This is a low-level DataStream/ReferenceStream method.
+ See also objectToStoreOnDataStream.
+ NOTE: This method must send 'aDataStream beginInstance:size:' and then (nextPut:/nextPutWeak:) its subobjects.
+ readDataFrom:size: reads back what we write here."
+
+ | cntInstVars cntIndexedVars |
+
+ cntInstVars := self class instSize.
+ cntIndexedVars := self basicSize.
+ aDataStream
+ beginInstance: self class
+ size: cntInstVars + cntIndexedVars.
+ 1 to: cntInstVars do:[:i |
+ | value |
+
+ value := (self instVarAt: i).
+ "/ Special hack for ImmutableString / ImmutableArray which is not known by Squeak / Pharo,
+ "/ and therefore will fail to load properly there.
+ "/ In one of those is encountered, convert them to their mutable version.
+ (value class == ImmutableString or:[value class == ImmutableArray or:[value class == ImmutableByteArray]]) ifTrue:[
+ value := value asMutableCollection.
+ ].
+ aDataStream nextPut: value
+ ].
+
+ "Write fields of a variable length object. When writing to a dummy
+ stream, don't bother to write the bytes"
+ "1 to: cntInstVars do:
+ [:i | aDataStream nextPut: (self instVarAt: i)]."
+
+ "Created: / 23-04-2015 / 15:10:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!MCDefinition methodsFor:'testing'!
isClassDefinition
@@ -185,6 +225,12 @@
^ '$Header: /cvs/stx/stx/goodies/monticello/MCDefinition.st,v 1.5 2012-09-11 21:21:09 cg Exp $'
!
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+!
+
version_SVN
^ '§Id: MCDefinition.st 24 2010-11-09 14:00:17Z vranyj1 §'
! !
+