eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TwoByteString':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: TwoByteString


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--UninterpretedBytes
               |
               +--CharacterArray
                  |
                  +--TwoByteString
                     |
                     +--BIG5EncodedString
                     |
                     +--GBEncodedString
                     |
                     +--JISEncodedString
                     |
                     +--KSCEncodedString
                     |
                     +--TwoByteSymbol
                     |
                     +--Unicode16String

Package:
stx:libbasic
Category:
Collections-Text
Version:
rev: 1.46 date: 2017/11/22 20:39:07
user: cg
file: TwoByteString.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


TwoByteStrings are like strings, but storing 16bits per character.
The integration of them into the system is not completed ....


Related information:

    Text
    JISEncodedString
    StringCollection

Class protocol:

initialization
o  initialize
initialize the class - private
usage example(s):
     TwoByteString initialize

instance creation
o  basicNew: anInteger
return a new empty string with anInteger number of characters

o  uninitializedNew: anInteger
return a new empty string with anInteger characters
usage example(s):
        self uninitializedNew:10


Instance protocol:

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

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

o  unsignedShortAt: index
return the short at position index, an Integer

filling and replacing
o  replaceFrom: start to: stop with: aString startingAt: repStart
replace the characters starting at index start, anInteger and ending
at stop, anInteger with characters from aString starting at repStart.
Return the receiver.

- reimplemented here for speed
usage example(s):
     'hello world' asUnicode16String replaceFrom:1 to:5 with:'123456' startingAt:2
     'hello world' asUnicode16String replaceFrom:1 to:5 with:'123456' asUnicode16String startingAt:2
     'hello world' asUnicode16String replaceFrom:1 to:0 with:'123456' startingAt:2
     'hello' asUnicode16String replaceFrom:1 to:6 with:'123456' startingAt:2
     'hello world' asUnicode16String replaceFrom:1 to:1 with:'123456' startingAt:2

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

o  bytesPerCharacter
return the number of bytes each character has.
Here, 2 is returned (storing double byte characters).

o  characterSize
answer the size in bits of my largest character (actually only 7, 8 or 16)
usage example(s):
     'hello world' asUnicode16String characterSize
     'hello worldŁšŲ' asUnicode16String characterSize
     'a' asUnicode16String characterSize
     'Ł' asUnicode16String characterSize
     'aa' asUnicode16String characterSize
     'aŁ' asUnicode16String characterSize
     'aaa' asUnicode16String characterSize
     'aaŁ' asUnicode16String characterSize
     'aaaŁ' asUnicode16String characterSize
     'aaaa' asUnicode16String characterSize
     'aaaaŁ' asUnicode16String characterSize

o  containsNon7BitAscii
return true, if the underlying string contains 8BitCharacters (or widers)
(i.e. if it is non-ascii)
usage example(s):
     'hello world' asUnicode16String containsNon7BitAscii
     'hello worldŁšŲ' asUnicode16String containsNon7BitAscii
     'Ł' asUnicode16String containsNon7BitAscii
     'aŁ' asUnicode16String containsNon7BitAscii
     'aaŁ' asUnicode16String containsNon7BitAscii
     'aaaŁ' asUnicode16String containsNon7BitAscii
     'aaaaŁ' asUnicode16String containsNon7BitAscii
     'aaaaa' asUnicode16String containsNon7BitAscii

o  isWideString
true if I require more than one byte per character

testing
o  isSingleByteCollection
return true, if the receiver has access methods for bytes;
i.e. #at: and #at:put: accesses a byte and are equivalent to #byteAt: and byteAt:put:
and #replaceFrom:to: is equivalent to #replaceBytesFrom:to:.
false is returned here since at: returns 2-byte characters and not bytes
- the method is redefined from UninterpretedBytes.



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 20 May 2019 22:41:36 GMT