TwoByteString.st
author Claus Gittinger <cg@exept.de>
Sat, 27 Apr 1996 13:17:26 +0200
changeset 1309 24c98ca4a56d
parent 1290 15ba3221b89b
child 1382 93c125a594c3
permissions -rw-r--r--
commentary

"
 COPYRIGHT (c) 1993 by Claus Gittinger
	      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.
"

CharacterArray subclass:#TwoByteString
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Collections-Text'
!

!TwoByteString class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1993 by Claus Gittinger
	      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
"
    TwoByteStrings are like strings, but storing 16bits per character.
    The integration of them into the system is not completed ....

    [author:]
        Claus Gittinger

    [see also:]
        JISEncodedString
        StringCollection
"
! !

!TwoByteString class methodsFor:'initialization'!

initialize
    "initialize the class - private"

    self flags:(Behavior flagWords)

    "
     TwoByteString initialize
    "

    "Modified: 22.4.1996 / 16:14:14 / cg"
! !

!TwoByteString class methodsFor:'instance creation'!

basicNew:anInteger
    "return a new empty string with anInteger characters"

    ^ (super basicNew:anInteger) atAllPut:(Character space)

    "Modified: 26.2.1996 / 14:38:47 / cg"
! !

!TwoByteString methodsFor:'accessing'!

basicAt:index
    "return the character at position index, an Integer
     - reimplemented here since we return 16-bit characters"

    |val|

    val := super basicAt:index.
    ^ Character value:val

    "Modified: 26.2.1996 / 17:02:16 / cg"
!

basicAt:index put:aCharacter
    "store the argument, aCharacter at position index, an Integer.
     Returns aCharacter (sigh).
     - reimplemented here since we store 16-bit characters"

    |val|

    val := aCharacter asciiValue.
    super basicAt:index put:val.
    ^ aCharacter

    "Modified: 19.4.1996 / 11:16:22 / cg"
! !

!TwoByteString methodsFor:'queries'!

bitsPerCharacter
    "return the number of bits each character has.
     Here, 16 is returned (storing double byte characters)."

    ^ 16

    "Modified: 20.4.1996 / 23:08:38 / cg"
! !

!TwoByteString class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/TwoByteString.st,v 1.26 1996-04-27 11:17:26 cg Exp $'
! !
TwoByteString initialize!