Unicode32String.st
author Stefan Vogel <sv@exept.de>
Wed, 21 Nov 2007 18:24:07 +0100
changeset 1917 61c602336f3d
parent 1669 4d79cb67a21b
child 2048 c57b6e0b9ef4
permissions -rw-r--r--
Clean up code and document differences between #add: and #addLast:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2004 by eXept Software AG 
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
1411
1cb88c3dbd22 encoding now unicode
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
    15
"{ Package: 'stx:libbasic2' }"
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
FourByteString variableLongSubclass:#Unicode32String
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	instanceVariableNames:''
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	classVariableNames:''
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	category:'Collections-Text'
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!Unicode32String class methodsFor:'documentation'!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
copyright
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 COPYRIGHT (c) 2004 by eXept Software AG 
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
              All Rights Reserved
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 This software is furnished under a license and may be used
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 hereby transferred.
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
documentation
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
1573
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    44
    Not yet fully finished - unicode support is still being implemented.
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
! !
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
!Unicode32String class methodsFor:'initialization'!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
initialize
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    "initialize the class - private"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    self flags:(Behavior flagLongs)
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    "
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
     Unicode32String initialize
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    "
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "Created: 30.6.1997 / 15:35:52 / cg"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    "Modified: 30.6.1997 / 15:39:21 / cg"
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
! !
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
1460
6af968260a60 juergen gmeiners bug fix for bug #69
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
    63
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
!Unicode32String methodsFor:'conversion'!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
asSymbolIfInterned
1605
893af2a9f99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
    67
    "If a symbol with the receivers characters is already known, return it. Otherwise, return nil. 
893af2a9f99e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
    68
     Because ST/X does not support non-8-bit symbols, this method
1573
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    69
     has been redefined to only return a symbol, if the receiver does NOT contain
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    70
     any non-8 bit characters."
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    71
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    |s|
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    Error catch:[
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
        s := self asSingleByteString.
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    ].
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    s isNil ifTrue:[^ s].
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    ^ s asSymbolIfInterned
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
1443
e971d86d6259 Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 1411
diff changeset
    81
asUnicode32String
1573
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    82
    "as the receiver already is a unicode-32 string, return it"
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    83
1443
e971d86d6259 Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 1411
diff changeset
    84
    ^ self
e971d86d6259 Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 1411
diff changeset
    85
!
e971d86d6259 Define #asUnicode16String and #asUnicode32String
Stefan Vogel <sv@exept.de>
parents: 1411
diff changeset
    86
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
asUnicodeString
1573
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    88
    "as the receiver already is a unicode string, return it"
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    89
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ^ self
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
printOn:aStream
1573
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    94
    "print the receiver utf-8 encoded on aStream"
dec4f78e857b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1460
diff changeset
    95
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    self utf8EncodedOn:aStream
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
! !
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!Unicode32String class methodsFor:'documentation'!
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
version
1669
4d79cb67a21b boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 1605
diff changeset
   102
    ^ '$Header: /cvs/stx/stx/libbasic2/Unicode32String.st,v 1.7 2006-08-23 14:07:15 cg Exp $'
1404
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
! !
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
776eb9467dc3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
Unicode32String initialize!