Unicode16String.st
author Claus Gittinger <cg@exept.de>
Thu, 05 Aug 2004 14:31:05 +0200
changeset 8464 e9f4d3766157
parent 8407 f3a5a24b8fec
child 8942 41d4d78ceb65
permissions -rw-r--r--
*** empty log message ***
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
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
7982
0412a26c4621 encoding now unicode
Claus Gittinger <cg@exept.de>
parents: 7949
diff changeset
    15
"{ Package: 'stx:libbasic2' }"
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
TwoByteString variableWordSubclass:#Unicode16String
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	instanceVariableNames:''
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	classVariableNames:''
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	category:'Collections-Text'
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!Unicode16String class methodsFor:'documentation'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
copyright
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 COPYRIGHT (c) 1997 by eXept Software AG 
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
	      All Rights Reserved
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 This software is furnished under a license and may be used
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 hereby transferred.
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
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
documentation
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    Not yet finished - unicode support is currently being implemented.
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
!Unicode16String class methodsFor:'initialization'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
initialize
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    "initialize the class - private"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
7949
421a3e216337 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7946
diff changeset
    53
    self flags:(Behavior flagWords).
421a3e216337 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7946
diff changeset
    54
421a3e216337 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7946
diff changeset
    55
    Smalltalk at:#UnicodeString put:Unicode16String.
7946
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
     Unicode16String initialize
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    "Created: 30.6.1997 / 15:35:52 / cg"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    "Modified: 30.6.1997 / 15:39:21 / cg"
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
8407
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    65
!Unicode16String methodsFor:'binary storage'!
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    66
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    67
storeBinaryElementsOn: stream
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    68
    self do:[:each|
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    69
        stream nextPutShort:each asInteger MSB:true.
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    70
    ].
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    71
! !
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
    72
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
!Unicode16String methodsFor:'conversion'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
asSymbolIfInterned
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    |s|
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    Error catch:[
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
        s := self asSingleByteString.
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    ].
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    s isNil ifTrue:[^ s].
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    ^ s asSymbolIfInterned
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
8294
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
    85
asUnicode16String
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
    86
    ^ self
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
    87
!
ba5f4421848f Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 8049
diff changeset
    88
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
asUnicodeString
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ^ self
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
printOn:aStream
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    self utf8EncodedOn:aStream
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
8049
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
    97
!Unicode16String methodsFor:'printing & storing'!
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
    98
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
    99
storeString
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   100
    "return a String for storing myself"
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   101
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   102
    ^ self basicStoreString.
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   103
! !
ccd0e8f26439 printing - migrating towards unicodeSupport in ST-code
Claus Gittinger <cg@exept.de>
parents: 7982
diff changeset
   104
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
!Unicode16String class methodsFor:'documentation'!
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
version
8407
f3a5a24b8fec juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 8294
diff changeset
   108
    ^ '$Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.6 2004-06-16 12:18:56 cg Exp $'
7946
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
! !
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
469d2d1c61f1 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
Unicode16String initialize!