Unicode16String.st
branchjv
changeset 17940 985e22966acb
parent 17938 e2aad1d7c317
child 18011 deb0c3355881
--- a/Unicode16String.st	Fri Apr 13 15:03:30 2012 +0100
+++ b/Unicode16String.st	Sat May 05 22:58:24 2012 +0100
@@ -118,6 +118,20 @@
 
 !Unicode16String methodsFor:'printing & storing'!
 
+displayOn:aGCOrStream
+    "display myself as on aStream.
+     You must use an ISO10646 unicode font to display this string"
+
+    (aGCOrStream isStream or:[aGCOrStream == Transcript]) ifTrue:[
+        aGCOrStream
+            nextPut:$';
+            nextPutAllUnicode:self;
+            nextPut:$'.
+        ^ self
+    ].
+    ^ super displayOn:aGCOrStream
+!
+
 printOn:aStream
     "print the receiver on aStream. 
      Let aStream decide how to represent this, whether utf8, ucs16, ..."
@@ -155,20 +169,54 @@
     ^ (self utf8Encoded storeString),' utf8Decoded'.
 
     "Modified: / 25-01-2012 / 11:59:34 / cg"
+!
+
+unicodeStoreOn:aStream
+    "put the storeString of myself on aStream"
+
+    aStream nextPut:$'.
+    (self includes:$') ifTrue:[
+        self do:[:thisChar |
+            (thisChar == $') ifTrue:[aStream nextPut:thisChar].
+            aStream nextPutUnicode:thisChar
+        ]
+    ] ifFalse:[
+        aStream nextPutAllUnicode:self
+    ].
+    aStream nextPut:$'
+!
+
+unicodeStoreString
+    "return a UnicodeString for storing myself.
+     This method is a kind of kludge.
+     Use it when you want to write a storeString to an encoded Stream"
+
+    ^ self basicStoreString.
 ! !
 
+!Unicode16String methodsFor:'testing'!
+
+isUnicode16String
+    ^ true
+!
+
+isUnicodeString
+    ^ true
+! !
+
+
 !Unicode16String class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.17 2012/04/02 16:57:21 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.19 2012/04/24 14:56:53 stefan Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.17 2012/04/02 16:57:21 stefan Exp §'
+    ^ '§Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.19 2012/04/24 14:56:53 stefan Exp §'
 !
 
 version_SVN
-    ^ '$Id: Unicode16String.st 10804 2012-04-13 13:18:13Z vranyj1 $'
+    ^ '$Id: Unicode16String.st 10807 2012-05-05 21:58:24Z vranyj1 $'
 
 ! !