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