Unicode16String.st
author Claus Gittinger <cg@exept.de>
Wed, 21 Sep 2005 20:42:55 +0200
changeset 8942 41d4d78ceb65
parent 8407 f3a5a24b8fec
child 9232 baa662ecbc01
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1997 by eXept Software AG 
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.


"

"{ Package: 'stx:libbasic2' }"

TwoByteString variableWordSubclass:#Unicode16String
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Collections-Text'
!

!Unicode16String class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by eXept Software AG 
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.


"
!

documentation
"
    Not yet fully finished - unicode support is still being implemented.
"
! !

!Unicode16String class methodsFor:'initialization'!

initialize
    "initialize the class - private"

    self flags:(Behavior flagWords).

    Smalltalk at:#UnicodeString put:Unicode16String.

    "
     Unicode16String initialize
    "

    "Created: 30.6.1997 / 15:35:52 / cg"
    "Modified: 30.6.1997 / 15:39:21 / cg"
! !

!Unicode16String methodsFor:'binary storage'!

storeBinaryElementsOn: stream
    self do:[:each|
        stream nextPutShort:each asInteger MSB:true.
    ].
! !

!Unicode16String methodsFor:'conversion'!

asSymbolIfInterned
    "Because ST/X does not support non-8-bit symbols, this method
     has been redefined to only return a symbol, if the receiver does NOT contain
     any non-8 bit characters."

    |s|

    Error catch:[
        s := self asSingleByteString.
    ].
    s isNil ifTrue:[^ s].
    ^ s asSymbolIfInterned
!

asUnicode16String
    "as the receiver already is a unicode-16 string, return it"

    ^ self
!

asUnicodeString
    "as the receiver already is a unicode string, return it"

    ^ self
!

printOn:aStream
    "print the receiver utf-8 encoded on aStream"

    self utf8EncodedOn:aStream
! !

!Unicode16String methodsFor:'printing & storing'!

storeString
    "return a String for storing myself"

    ^ self basicStoreString.
! !

!Unicode16String class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/Unicode16String.st,v 1.7 2005-09-21 18:42:55 cg Exp $'
! !

Unicode16String initialize!