CypressClass.st
changeset 11 333528cd629a
child 12 ec118792047a
equal deleted inserted replaced
10:8750ae5ef93f 11:333528cd629a
       
     1 "{ Package: 'stx:goodies/cypress' }"
       
     2 
       
     3 CypressModel subclass:#CypressClass
       
     4 	instanceVariableNames:'comment methods'
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'Cypress-New-Model'
       
     8 !
       
     9 
       
    10 
       
    11 !CypressClass class methodsFor:'instance creation'!
       
    12 
       
    13 fromClass: aClass
       
    14     "Returns a CypressPackage for given (real) class"
       
    15 
       
    16     ^self class initializeFromClass: aClass.
       
    17 
       
    18     "Created: / 10-09-2012 / 23:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    19 ! !
       
    20 
       
    21 !CypressClass methodsFor:'accessing'!
       
    22 
       
    23 methods
       
    24 
       
    25     methods isNil ifTrue:[
       
    26         methods := OrderedCollection new.
       
    27         (Smalltalk at: name asSymbol) instAndClassMethodsDo:[:mthd|
       
    28             methods add: (CypressMethod fromMethod: mthd)
       
    29         ]
       
    30     ].
       
    31     ^methods
       
    32 
       
    33     "Created: / 11-09-2012 / 00:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    34 !
       
    35 
       
    36 package
       
    37     "Returns a CypressPackage which the receiver belongs to"
       
    38 
       
    39     ^ self shouldImplement
       
    40 ! !
       
    41 
       
    42 !CypressClass methodsFor:'initialization'!
       
    43 
       
    44 initializeFromClass: aClass
       
    45     name := aClass name.
       
    46     properties := Dictionary new.
       
    47 
       
    48     properties 
       
    49         at:'name'           put: aClass nameWithoutPrefix;
       
    50         at:'super'          put: aClass superclass nameWithoutPrefix;
       
    51         at:'namespace'      put: aClass nameSpace nameWithoutPrefix;
       
    52         at:'superNamespace' put: aClass nameSpace nameSpace;
       
    53 
       
    54         at:'instvars'       put: aClass instVarNames;
       
    55         at:'classinstvars'  put: aClass class instVarNames;
       
    56         at:'classvars'      put: aClass classVarNames;
       
    57         at:'pools'          put: aClass sharedPoolNames;
       
    58 
       
    59         at:'category'       put: aClass category.
       
    60 
       
    61 
       
    62     aClass definitionSelector ~~ Object definitionSelector ifTrue:[
       
    63         properties
       
    64         at:'_stx_type'      put: aClass definitionSelector
       
    65     ].
       
    66 
       
    67     "Created: / 10-09-2012 / 23:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    68 ! !
       
    69 
       
    70 !CypressClass methodsFor:'reading & writing'!
       
    71 
       
    72 readFrom:filename
       
    73     "Initializes the receiver from directory/file named 'filename'"
       
    74 
       
    75     ^ self shouldImplement
       
    76 !
       
    77 
       
    78 writeTo:filename notice:copyrightNotice
       
    79     "Writes the receiver into directory/file named 'filename'
       
    80      with given copyrightNotice"
       
    81 
       
    82     ^ self shouldImplement
       
    83 ! !
       
    84 
       
    85 !CypressClass class methodsFor:'documentation'!
       
    86 
       
    87 version_SVN
       
    88     ^ '$Id::                                                                                                                        $'
       
    89 ! !