author | Claus Gittinger <cg@exept.de> |
Mon, 18 Mar 2019 16:24:14 +0100 | |
changeset 4885 | f23f8cf58b0c |
parent 4512 | 0d6157b7ce6e |
child 4920 | 8c94a1a0ed25 |
permissions | -rw-r--r-- |
1404 | 1 |
" |
2 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1415
3ef6a2c42611
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1404
diff
changeset
|
12 |
"{ Package: 'stx:libbasic2' }" |
1404 | 13 |
|
3533 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
1404 | 16 |
CharacterArray variableLongSubclass:#FourByteString |
17 |
instanceVariableNames:'' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Collections-Text' |
|
21 |
! |
|
22 |
||
23 |
!FourByteString class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
FourByteStrings are like strings, but storing 32bits per character. |
|
42 |
The integration of them into the system is not completed .... |
|
43 |
||
44 |
[author:] |
|
45 |
Claus Gittinger |
|
46 |
||
47 |
[see also:] |
|
48 |
Text TwoByteString UnicodeEncodedString |
|
49 |
StringCollection |
|
50 |
" |
|
51 |
! ! |
|
52 |
||
53 |
!FourByteString class methodsFor:'initialization'! |
|
54 |
||
55 |
initialize |
|
56 |
"initialize the class - private" |
|
57 |
||
58 |
self flags:(Behavior flagLongs) |
|
59 |
||
60 |
" |
|
61 |
FourByteString initialize |
|
62 |
" |
|
63 |
||
64 |
"Modified: 22.4.1996 / 16:14:14 / cg" |
|
65 |
! ! |
|
66 |
||
67 |
!FourByteString class methodsFor:'instance creation'! |
|
68 |
||
69 |
basicNew:anInteger |
|
70 |
"return a new empty string with anInteger characters" |
|
71 |
||
72 |
^ (super basicNew:anInteger) atAllPut:(Character space) |
|
73 |
||
74 |
"Modified: 26.2.1996 / 14:38:47 / cg" |
|
3533 | 75 |
! |
76 |
||
77 |
uninitializedNew:anInteger |
|
78 |
"return a new empty string with anInteger characters" |
|
79 |
||
80 |
^ super basicNew:anInteger |
|
81 |
||
82 |
" |
|
83 |
self uninitializedNew:10 |
|
84 |
" |
|
1404 | 85 |
! ! |
86 |
||
87 |
!FourByteString methodsFor:'accessing'! |
|
88 |
||
89 |
basicAt:index |
|
90 |
"return the character at position index, an Integer |
|
91 |
- reimplemented here since we return 32-bit characters" |
|
92 |
||
93 |
|val| |
|
94 |
||
95 |
val := super basicAt:index. |
|
96 |
^ Character value:val |
|
97 |
! |
|
98 |
||
99 |
basicAt:index put:aCharacter |
|
100 |
"store the argument, aCharacter at position index, an Integer. |
|
101 |
Returns aCharacter (sigh). |
|
102 |
- reimplemented here since we store 32-bit characters" |
|
103 |
||
104 |
|val| |
|
105 |
||
1415
3ef6a2c42611
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1404
diff
changeset
|
106 |
val := aCharacter codePoint. |
1404 | 107 |
super basicAt:index put:val. |
108 |
^ aCharacter |
|
109 |
! ! |
|
110 |
||
111 |
!FourByteString methodsFor:'queries'! |
|
112 |
||
113 |
bitsPerCharacter |
|
114 |
"return the number of bits each character has. |
|
115 |
Here, 32 is returned (storing quad byte characters)." |
|
116 |
||
117 |
^ 32 |
|
2865 | 118 |
! |
119 |
||
3826 | 120 |
bytesPerCharacter |
121 |
"return the number of bytes each character has. |
|
122 |
Here, 4 is returned (storing quad byte characters)." |
|
123 |
||
124 |
^ 4 |
|
125 |
! |
|
126 |
||
2865 | 127 |
isWideString |
3805 | 128 |
"true if I require more than one byte per character" |
129 |
||
2865 | 130 |
^ true |
1404 | 131 |
! ! |
132 |
||
4511 | 133 |
!FourByteString methodsFor:'testing'! |
134 |
||
4512 | 135 |
isSingleByteCollection |
136 |
"return true, if the receiver has access methods for bytes; |
|
137 |
i.e. #at: and #at:put: accesses a byte and are equivalent to #byteAt: and byteAt:put: |
|
138 |
and #replaceFrom:to: is equivalent to #replaceBytesFrom:to:. |
|
139 |
false is returned here since at: returns 4-byte characters and not bytes |
|
140 |
- the method is redefined from UninterpretedBytes." |
|
141 |
||
4511 | 142 |
^ false |
143 |
||
144 |
"Created: / 30-08-2017 / 23:31:02 / cg" |
|
145 |
! ! |
|
146 |
||
1404 | 147 |
!FourByteString class methodsFor:'documentation'! |
148 |
||
149 |
version |
|
3586 | 150 |
^ '$Header$' |
1404 | 151 |
! ! |
152 |
||
3533 | 153 |
|
1404 | 154 |
FourByteString initialize! |