Unicode16String.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 05 May 2012 22:58:24 +0100
branchjv
changeset 17940 985e22966acb
parent 17938 e2aad1d7c317
child 18011 deb0c3355881
permissions -rw-r--r--
Merged with /trunk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG 
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
10223
761e2a050b69 twoByteString moved (req'd in VM)
Claus Gittinger <cg@exept.de>
parents: 9648
diff changeset
    12
"{ Package: 'stx:libbasic' }"
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
17938
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
    14
TwoByteString subclass:#Unicode16String
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Collections-Text'
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!Unicode16String class methodsFor:'documentation'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 1997 by eXept Software AG 
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
	      All Rights Reserved
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
10223
761e2a050b69 twoByteString moved (req'd in VM)
Claus Gittinger <cg@exept.de>
parents: 9648
diff changeset
    41
    Represents 16-bit (2-byte) Unicode strings.
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
!Unicode16String class methodsFor:'initialization'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
initialize
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    "initialize the class - private"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
7949
421a3e216337 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7946
diff changeset
    50
    self flags:(Behavior flagWords).
421a3e216337 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7946
diff changeset
    51
421a3e216337 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7946
diff changeset
    52
    Smalltalk at:#UnicodeString put:Unicode16String.
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    "
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
     Unicode16String initialize
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    "
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    "Created: 30.6.1997 / 15:35:52 / cg"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "Modified: 30.6.1997 / 15:39:21 / cg"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
11323
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    62
!Unicode16String class methodsFor:'reading'!
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    63
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    64
readFrom:aStreamOrString onError:exceptionBlock
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    65
    "read & return the next String from the (character-)stream aStream;
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    66
     skipping all whitespace first; return the value of exceptionBlock,
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    67
     if no string can be read. The sequence of characters as read from the
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    68
     stream must be one as stored via storeOn: or storeString."
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    69
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    70
    "
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    71
     this method is not to be inherited
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    72
     (i.e. not ok for subclasses; Symbol, for example)
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    73
    "
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    74
    self ~~ Unicode16String ifTrue:[
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    75
        ^ super readFrom:aStreamOrString onError:exceptionBlock
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    76
    ].
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    77
    ^ self readSmalltalkStringFrom:aStreamOrString onError:exceptionBlock
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    78
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    79
    "
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
    80
        self readFrom:'abc' storeString
11323
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    81
    "
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    82
! !
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
    83
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
!Unicode16String methodsFor:'conversion'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
asSymbolIfInterned
9232
baa662ecbc01 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8942
diff changeset
    87
    "If a symbol with the receivers characters is already known, return it. Otherwise, return nil. 
baa662ecbc01 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8942
diff changeset
    88
     Because ST/X does not support non-8-bit symbols, this method
8942
41d4d78ceb65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8407
diff changeset
    89
     has been redefined to only return a symbol, if the receiver does NOT contain
41d4d78ceb65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8407
diff changeset
    90
     any non-8 bit characters."
41d4d78ceb65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8407
diff changeset
    91
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    |s|
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
17938
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
    94
    [
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
        s := self asSingleByteString.
17938
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
    96
    ] on:Error do:[:ex|
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
    97
        ^ nil.
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    ].
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    ^ s asSymbolIfInterned
17938
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
   100
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
   101
    "
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
   102
     (Unicode16String with:(Character value:16rFFFF)) asSymbolIfInterned
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
   103
     'new' asUnicodeString asSymbolIfInterned
e2aad1d7c317 Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17927
diff changeset
   104
    "
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
8294
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
   107
asUnicode16String
8942
41d4d78ceb65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8407
diff changeset
   108
    "as the receiver already is a unicode-16 string, return it"
41d4d78ceb65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8407
diff changeset
   109
8294
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
   110
    ^ self
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
   111
!
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
   112
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
asUnicodeString
8942
41d4d78ceb65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8407
diff changeset
   114
    "as the receiver already is a unicode string, return it"
41d4d78ceb65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8407
diff changeset
   115
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    ^ self
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
8049
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   119
!Unicode16String methodsFor:'printing & storing'!
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   120
17940
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   121
displayOn:aGCOrStream
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   122
    "display myself as on aStream.
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   123
     You must use an ISO10646 unicode font to display this string"
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   124
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   125
    (aGCOrStream isStream or:[aGCOrStream == Transcript]) ifTrue:[
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   126
        aGCOrStream
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   127
            nextPut:$';
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   128
            nextPutAllUnicode:self;
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   129
            nextPut:$'.
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   130
        ^ self
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   131
    ].
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   132
    ^ super displayOn:aGCOrStream
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   133
!
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   134
11323
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   135
printOn:aStream
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   136
    "print the receiver on aStream. 
17921
4069fe8e9039 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911
diff changeset
   137
     Let aStream decide how to represent this, whether utf8, ucs16, ..."
11323
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   138
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   139
    aStream nextPutAllUnicode:self
17921
4069fe8e9039 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911
diff changeset
   140
4069fe8e9039 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911
diff changeset
   141
    "Modified (comment): / 25-01-2012 / 10:28:34 / cg"
11323
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   142
!
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   143
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   144
storeOn:aStream
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   145
    "put the storeString of myself on aStream"
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   146
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   147
    (self utf8Encoded storeOn:aStream).
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   148
    aStream nextPutAll:' utf8Decoded'.
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   149
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   150
"/    aStream nextPut:$'.
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   151
"/    (self includes:$') ifTrue:[
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   152
"/        self do:[:thisChar |
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   153
"/            (thisChar == $') ifTrue:[aStream nextPut:thisChar].
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   154
"/            aStream nextPutUnicode:thisChar
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   155
"/        ]
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   156
"/    ] ifFalse:[
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   157
"/        aStream nextPutAllUnicode:self
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   158
"/    ].
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   159
"/    aStream nextPut:$'
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   160
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   161
    "Modified: / 28-09-2011 / 16:17:38 / cg"
11323
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   162
!
c9ebe199a8fc Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 11293
diff changeset
   163
8049
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   164
storeString
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   165
    "return a String for storing myself"
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   166
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   167
"/    ^ self basicStoreString.
17921
4069fe8e9039 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911
diff changeset
   168
"/    ^ (self withCEscapes storeString),' withoutCEscapes'.
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   169
    ^ (self utf8Encoded storeString),' utf8Decoded'.
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   170
17921
4069fe8e9039 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911
diff changeset
   171
    "Modified: / 25-01-2012 / 11:59:34 / cg"
17940
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   172
!
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   173
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   174
unicodeStoreOn:aStream
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   175
    "put the storeString of myself on aStream"
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   176
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   177
    aStream nextPut:$'.
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   178
    (self includes:$') ifTrue:[
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   179
        self do:[:thisChar |
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   180
            (thisChar == $') ifTrue:[aStream nextPut:thisChar].
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   181
            aStream nextPutUnicode:thisChar
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   182
        ]
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   183
    ] ifFalse:[
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   184
        aStream nextPutAllUnicode:self
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   185
    ].
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   186
    aStream nextPut:$'
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   187
!
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   188
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   189
unicodeStoreString
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   190
    "return a UnicodeString for storing myself.
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   191
     This method is a kind of kludge.
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   192
     Use it when you want to write a storeString to an encoded Stream"
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   193
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   194
    ^ self basicStoreString.
8049
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   195
! !
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   196
17940
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   197
!Unicode16String methodsFor:'testing'!
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   198
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   199
isUnicode16String
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   200
    ^ true
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   201
!
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   202
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   203
isUnicodeString
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   204
    ^ true
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   205
! !
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   206
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   207
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
!Unicode16String class methodsFor:'documentation'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
version
17940
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   211
    ^ '$Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.19 2012/04/24 14:56:53 stefan Exp $'
17761
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   212
!
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   213
17921
4069fe8e9039 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17911
diff changeset
   214
version_CVS
17940
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   215
    ^ '§Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.19 2012/04/24 14:56:53 stefan Exp §'
17927
ae1c64e8ade2 Added version_SVN
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17921
diff changeset
   216
!
ae1c64e8ade2 Added version_SVN
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17921
diff changeset
   217
ae1c64e8ade2 Added version_SVN
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17921
diff changeset
   218
version_SVN
17940
985e22966acb Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17938
diff changeset
   219
    ^ '$Id: Unicode16String.st 10807 2012-05-05 21:58:24Z vranyj1 $'
17927
ae1c64e8ade2 Added version_SVN
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17921
diff changeset
   220
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
17846
24edc476ac18 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17845
diff changeset
   223
Unicode16String initialize!