- ClassDefinitionChange
added:
#definitionStringInNamespace:
#definitionStringWithoutNamespace
changed: #version_SVN
--- a/ClassDefinitionChange.st Mon Jul 23 18:33:44 2012 +0100
+++ b/ClassDefinitionChange.st Tue Jul 24 16:47:21 2012 +0100
@@ -403,6 +403,168 @@
"Modified: / 13-06-2012 / 13:01:58 / cg"
!
+definitionStringInNamespace: ns
+ | classNameUsed superClassNameUsed |
+
+ objectType == #variable ifTrue:[
+ ^ String streamContents:[:stream |
+ ns notNil ifTrue:[
+ stream
+ nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
+ ] ifFalse:[
+ self halt:'can this happen ?'.
+ stream
+ nextPutAll:'Smalltalk'
+ ].
+
+ stream
+ nextPutAll:' addClassVarName:';
+ nextPutAll:className asString storeString
+ ].
+ ].
+
+ superClassNameUsed := self superClassName.
+ classNameUsed := self classNameWithoutNamespace.
+
+ ^ String streamContents:[:stream |
+ self isPrivateClassDefinitionChange ifFalse:[
+ stream
+ nextPutAll:superClassNameUsed;
+ nextPutAll:' subclass:';
+ nextPutAll: classNameUsed asSymbol storeString
+ ;
+ cr;
+ tab;
+ nextPutAll:'instanceVariableNames:';
+ nextPutAll:(instanceVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'classVariableNames:';
+ nextPutAll:(classVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'poolDictionaries:';
+ nextPutAll:(poolDictionaries ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'category:';
+ nextPutAll:(category ? '') storeString;
+ cr
+ ] ifTrue:[
+ stream
+ nextPutAll:superClassNameUsed;
+ nextPutAll:' subclass:';
+ nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
+ ;
+ cr;
+ tab;
+ nextPutAll:'instanceVariableNames:';
+ nextPutAll:(instanceVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'classVariableNames:';
+ nextPutAll:(classVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'poolDictionaries:';
+ nextPutAll:(poolDictionaries ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'privateIn:';
+ nextPutAll:
+ (ns isNil
+ ifTrue:[owningClassName]
+ ifFalse:[owningClassName copyFrom: ns size + 3]);
+ cr
+ ]
+ ]
+
+ "Modified: / 06-10-2011 / 17:02:05 / cg"
+ "Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+definitionStringWithoutNamespace
+ |ns classNameUsed superClassNameUsed|
+
+ ns := self nameSpaceOverride.
+
+ objectType == #variable ifTrue:[
+ ^ String streamContents:[:stream |
+ ns notNil ifTrue:[
+ stream
+ nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
+ ] ifFalse:[
+ self halt:'can this happen ?'.
+ stream
+ nextPutAll:'Smalltalk'
+ ].
+
+ stream
+ nextPutAll:' addClassVarName:';
+ nextPutAll:className asString storeString
+ ].
+ ].
+
+ superClassNameUsed := self superClassName.
+ classNameUsed := self classNameWithoutNamespace.
+
+ ^ String streamContents:[:stream |
+ self isPrivateClassDefinitionChange ifFalse:[
+ stream
+ nextPutAll:superClassNameUsed;
+ nextPutAll:' subclass:';
+ nextPutAll: classNameUsed asSymbol storeString
+ ;
+ cr;
+ tab;
+ nextPutAll:'instanceVariableNames:';
+ nextPutAll:(instanceVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'classVariableNames:';
+ nextPutAll:(classVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'poolDictionaries:';
+ nextPutAll:(poolDictionaries ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'category:';
+ nextPutAll:(category ? '') storeString;
+ cr
+ ] ifTrue:[
+ stream
+ nextPutAll:superClassNameUsed;
+ nextPutAll:' subclass:';
+ nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
+ ;
+ cr;
+ tab;
+ nextPutAll:'instanceVariableNames:';
+ nextPutAll:(instanceVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'classVariableNames:';
+ nextPutAll:(classVariableNames ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'poolDictionaries:';
+ nextPutAll:(poolDictionaries ? '') storeString;
+ cr;
+ tab;
+ nextPutAll:'privateIn:';
+ nextPutAll:
+ ((ns := self nameSpaceName) isNil
+ ifTrue:[owningClassName]
+ ifFalse:[owningClassName copyFrom: ns size + 3]);
+ cr
+ ]
+ ]
+
+ "Modified: / 06-10-2011 / 17:02:05 / cg"
+ "Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
printOn:aStream
aStream
nextPutAll:className; nextPutAll:' {definition}'
@@ -592,13 +754,13 @@
!ClassDefinitionChange class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012/06/13 11:03:04 cg Exp $'
+ ^ '$Id: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1 $'
!
version_CVS
- ^ 'Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012/06/13 11:03:04 cg Exp '
+ ^ '§Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012/06/13 11:03:04 cg Exp §'
!
version_SVN
- ^ '$ Id: ClassDefinitionChange.st 1867 2011-06-08 21:57:08Z vranyj1 $'
-! !
\ No newline at end of file
+ ^ '$Id:: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1 $'
+! !