CypressClass.st
changeset 11 333528cd629a
child 12 ec118792047a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CypressClass.st	Mon Sep 10 23:52:10 2012 +0000
@@ -0,0 +1,89 @@
+"{ Package: 'stx:goodies/cypress' }"
+
+CypressModel subclass:#CypressClass
+	instanceVariableNames:'comment methods'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Cypress-New-Model'
+!
+
+
+!CypressClass class methodsFor:'instance creation'!
+
+fromClass: aClass
+    "Returns a CypressPackage for given (real) class"
+
+    ^self class initializeFromClass: aClass.
+
+    "Created: / 10-09-2012 / 23:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressClass methodsFor:'accessing'!
+
+methods
+
+    methods isNil ifTrue:[
+        methods := OrderedCollection new.
+        (Smalltalk at: name asSymbol) instAndClassMethodsDo:[:mthd|
+            methods add: (CypressMethod fromMethod: mthd)
+        ]
+    ].
+    ^methods
+
+    "Created: / 11-09-2012 / 00:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+package
+    "Returns a CypressPackage which the receiver belongs to"
+
+    ^ self shouldImplement
+! !
+
+!CypressClass methodsFor:'initialization'!
+
+initializeFromClass: aClass
+    name := aClass name.
+    properties := Dictionary new.
+
+    properties 
+        at:'name'           put: aClass nameWithoutPrefix;
+        at:'super'          put: aClass superclass nameWithoutPrefix;
+        at:'namespace'      put: aClass nameSpace nameWithoutPrefix;
+        at:'superNamespace' put: aClass nameSpace nameSpace;
+
+        at:'instvars'       put: aClass instVarNames;
+        at:'classinstvars'  put: aClass class instVarNames;
+        at:'classvars'      put: aClass classVarNames;
+        at:'pools'          put: aClass sharedPoolNames;
+
+        at:'category'       put: aClass category.
+
+
+    aClass definitionSelector ~~ Object definitionSelector ifTrue:[
+        properties
+        at:'_stx_type'      put: aClass definitionSelector
+    ].
+
+    "Created: / 10-09-2012 / 23:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressClass methodsFor:'reading & writing'!
+
+readFrom:filename
+    "Initializes the receiver from directory/file named 'filename'"
+
+    ^ self shouldImplement
+!
+
+writeTo:filename notice:copyrightNotice
+    "Writes the receiver into directory/file named 'filename'
+     with given copyrightNotice"
+
+    ^ self shouldImplement
+! !
+
+!CypressClass class methodsFor:'documentation'!
+
+version_SVN
+    ^ '$Id::                                                                                                                        $'
+! !