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