5274
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
5380
|
15 |
"{ Package: 'stx:libbasic' }"
|
|
16 |
|
1731
|
17 |
Metaclass subclass:#PrivateMetaclass
|
|
18 |
instanceVariableNames:'owningClass'
|
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
|
21 |
category:'Kernel-Classes'
|
|
22 |
!
|
|
23 |
|
1737
|
24 |
!PrivateMetaclass class methodsFor:'documentation'!
|
1731
|
25 |
|
5274
|
26 |
copyright
|
|
27 |
"
|
|
28 |
COPYRIGHT (c) 1996 by eXept Software AG
|
|
29 |
All Rights Reserved
|
|
30 |
|
|
31 |
This software is furnished under a license and may be used
|
|
32 |
only in accordance with the terms of that license and with the
|
|
33 |
inclusion of the above copyright notice. This software may not
|
|
34 |
be provided or otherwise made available to, or used by, any
|
|
35 |
other person. No title to or ownership of the software is
|
|
36 |
hereby transferred.
|
|
37 |
"
|
|
38 |
|
|
39 |
|
|
40 |
!
|
|
41 |
|
1731
|
42 |
documentation
|
|
43 |
"
|
|
44 |
A PrivateMetaclass is much like a regular Metaclass, but it is only visible (known)
|
|
45 |
to some owningClass (which is also true for the PrivateMetaclasses sole instance).
|
|
46 |
|
1755
|
47 |
Its sourceCode, package and revision is forced to be the same as the owning classes'.
|
|
48 |
Therefore, privateClasses delegate some queries to their owning class.
|
1731
|
49 |
|
1807
|
50 |
Caution: support for private classes is an ST/X special feature.
|
|
51 |
This mechanism may not be provided by other smalltalk systems,
|
|
52 |
making your code unportable.
|
|
53 |
(However, private classes can be simulated pretty easily, using classVariables
|
|
54 |
or classInstance variables ...)
|
|
55 |
|
1731
|
56 |
[author:]
|
|
57 |
Claus Gittinger
|
|
58 |
|
|
59 |
[see also:]
|
|
60 |
Behavior ClassDescription Class Metaclass
|
|
61 |
"
|
|
62 |
! !
|
|
63 |
|
|
64 |
!PrivateMetaclass methodsFor:'accessing'!
|
|
65 |
|
1920
|
66 |
nameSpace
|
|
67 |
"return the nameSpace I am contained in.
|
|
68 |
For private classes, this is always nil"
|
|
69 |
|
5380
|
70 |
owningClass isNil ifTrue:[
|
|
71 |
^ super nameSpace
|
|
72 |
].
|
1920
|
73 |
^ nil
|
|
74 |
|
|
75 |
"Created: 7.11.1996 / 13:19:18 / cg"
|
|
76 |
!
|
|
77 |
|
1731
|
78 |
owningClass
|
|
79 |
"return my owningClass"
|
|
80 |
|
|
81 |
^ owningClass
|
|
82 |
|
|
83 |
"Created: 11.10.1996 / 16:55:43 / cg"
|
|
84 |
"Modified: 11.10.1996 / 17:35:13 / cg"
|
|
85 |
!
|
|
86 |
|
|
87 |
setOwningClass:something
|
|
88 |
"set my owningClass - this is not a public entry"
|
|
89 |
|
|
90 |
owningClass := something.
|
|
91 |
|
|
92 |
"Created: 11.10.1996 / 17:11:05 / cg"
|
|
93 |
"Modified: 11.10.1996 / 17:35:24 / cg"
|
2048
|
94 |
!
|
|
95 |
|
|
96 |
topOwningClass
|
|
97 |
"return my outermost owningClass; that is the first non-private
|
|
98 |
class along the owner-chain."
|
|
99 |
|
|
100 |
|outerOwner|
|
|
101 |
|
5380
|
102 |
owningClass isNil ifTrue:[^ nil].
|
|
103 |
|
2048
|
104 |
(outerOwner := owningClass owningClass) notNil ifTrue:[
|
|
105 |
^ owningClass topOwningClass
|
|
106 |
].
|
|
107 |
^ owningClass
|
|
108 |
|
|
109 |
"Created: 3.1.1997 / 19:19:58 / cg"
|
|
110 |
"Modified: 3.1.1997 / 19:50:05 / cg"
|
1731
|
111 |
! !
|
|
112 |
|
|
113 |
!PrivateMetaclass methodsFor:'queries'!
|
|
114 |
|
|
115 |
isBuiltInClass
|
1755
|
116 |
^ self == PrivateMetaclass
|
1757
|
117 |
!
|
|
118 |
|
|
119 |
package
|
|
120 |
"return my package-id"
|
|
121 |
|
5380
|
122 |
owningClass notNil ifTrue:[
|
|
123 |
^ owningClass package
|
|
124 |
].
|
|
125 |
^ super package
|
1757
|
126 |
|
|
127 |
"Created: 15.10.1996 / 19:45:04 / cg"
|
1731
|
128 |
! !
|
|
129 |
|
1738
|
130 |
!PrivateMetaclass class methodsFor:'documentation'!
|
1731
|
131 |
|
|
132 |
version
|
5380
|
133 |
^ '$Header: /cvs/stx/stx/libbasic/PrivateMetaclass.st,v 1.12 2000-04-25 09:20:13 cg Exp $'
|
1731
|
134 |
! !
|