Class.st
changeset 1919 cb189a5dcac8
parent 1915 c3ca595d0846
child 1923 97b099fef985
--- a/Class.st	Thu Nov 07 13:49:51 1996 +0100
+++ b/Class.st	Thu Nov 07 13:51:20 1996 +0100
@@ -677,6 +677,62 @@
     "
 !
 
+nameSpace
+    "return the nameSpace I am contained in.
+     For now, try all nameSpaces known in Smalltalk ..."
+
+    |idx nsName|
+
+    "/ due to the implementation, extract this from my name
+
+    idx := name lastIndexOf:$:.
+    idx == 0 ifTrue:[
+        ^ nil
+    ].
+
+    (Smalltalk at:name) ~~ self ifTrue:[
+        "/ mhmh - someone played around with my name ?
+        ^ nil
+    ].
+
+    (name at:idx-1) ~~ $: ifTrue:[
+        ^ nil
+    ].
+    nsName := name copyTo:(idx - 2).
+    ^ Smalltalk at:nsName asSymbol
+
+    "Created: 7.11.1996 / 13:24:14 / cg"
+!
+
+namespace
+    "return the namespace I am contained in, nil for private,
+     Smalltalk for public classes.
+     For now, try all nameSpaces known in Smalltalk ..."
+
+    |idx nsName|
+
+    (Smalltalk at:name) ~~ self ifTrue:[
+        "/ mhmh - someone played around with my name ?
+
+        ^ nil
+    ].
+
+    "/ due to the implementation, extract this from my name
+
+    idx := name lastIndexOf:$:.
+    idx == 0 ifTrue:[
+        ^ Smalltalk
+    ].
+
+    (name at:idx-1) ~~ $: ifTrue:[
+        ^ Smalltalk
+    ].
+    nsName := name copyTo:(idx - 2).
+    ^ Smalltalk at:nsName asSymbol
+
+    "Modified: 7.11.1996 / 13:26:49 / cg"
+!
+
 package
     "return the package of the class"
 
@@ -4308,6 +4364,6 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.206 1996-11-07 11:57:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.207 1996-11-07 12:51:20 cg Exp $'
 ! !
 Class initialize!