b311480e |
1 | -- Created on: 1993-02-10 |
2 | -- Created by: Mireille MERCIEN |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | class HAsciiString from PCollection |
24 | |
25 | inherits Persistent |
26 | |
27 | ---Purpose: Describes a persistent ASCII character string of variable length. |
28 | |
29 | uses VArrayOfCharacter from DBC, |
30 | HExtendedString from PCollection, |
31 | AsciiString from TCollection |
32 | |
33 | raises OutOfRange from Standard, |
34 | NegativeValue from Standard, |
35 | NumericError from Standard |
36 | is |
37 | |
38 | |
39 | Create(S : CString) |
40 | returns mutable HAsciiString from PCollection; |
41 | ---Purpose: Creation and initialization with the string S. |
42 | |
43 | Create(S : AsciiString from TCollection) |
44 | returns mutable HAsciiString from PCollection; |
45 | ---Purpose: Creation and initialization with the string S from TCollection. |
46 | |
47 | Create(C : Character from Standard) |
48 | returns mutable HAsciiString from PCollection; |
49 | ---Purpose: Creation and initialization with the character C. |
50 | |
51 | Create(S : HAsciiString from PCollection; |
52 | FromIndex, ToIndex : Integer from Standard) |
53 | returns mutable HAsciiString from PCollection |
54 | raises NegativeValue from Standard; |
55 | ---Purpose: Creation of a sub-string of the string S. |
56 | -- The sub-string starts at the index FromIndex and ends |
57 | -- at the index ToIndex |
58 | ---Trigger: Raises an exception if ToIndex is less than FromIndex . |
59 | ---Example: before |
60 | -- S = "abcdefg", FromIndex=3, ToIndex=6 |
61 | -- after |
62 | -- S = "abcdefg" |
63 | -- returns |
64 | -- "cdef" |
65 | |
66 | Create(S : HExtendedString from PCollection) |
67 | returns mutable HAsciiString from PCollection |
68 | raises OutOfRange from Standard; |
69 | ---Purpose: Creation by converting an extended string to a normal |
70 | -- string. Raises OutOfRange if the String is not in the "Ascii range". |
71 | |
72 | Create(R : Real from Standard ; F : CString = "%f") |
73 | returns mutable HAsciiString from PCollection; |
74 | ---Purpose: Creation and initialization by converting the real |
75 | -- value into a string. |
76 | -- F describes a format using "C" conventions. |
77 | |
78 | Create(I : Integer from Standard ; F : CString = "%d") |
79 | returns mutable HAsciiString from PCollection; |
80 | ---Purpose: Creation and initialization by converting the Integer |
81 | -- value into a string. |
82 | -- F describes a format using "C" conventions. |
83 | |
84 | Append(me : mutable; S : HAsciiString from PCollection); |
85 | ---Level: Public |
86 | ---Purpose: Pushing a string at the end of the string me |
87 | ---Example: |
88 | -- before |
89 | -- me = "abcd" , S = "ef" |
90 | -- after |
91 | -- me = "abcdef" , S = "ef" |
92 | |
93 | Capitalize(me : mutable); |
94 | ---Level: Public |
95 | ---Purpose: Converts the first character into its corresponding |
96 | -- upper-case character and the other characters into lowercase |
97 | ---Example: before |
98 | -- me = "hellO " |
99 | -- after |
100 | -- me = "Hello " |
101 | |
102 | Center(me : mutable; |
103 | Width : Integer from Standard; |
104 | Filler : Character from Standard) |
105 | raises NegativeValue from Standard; |
106 | ---Level: Public |
107 | ---Purpose: center |
108 | -- Length becomes equal to Width and the new characters are |
109 | -- equal to Filler |
110 | -- Raises an exception if Width is less than zero |
111 | -- if Width < Length nothing happens |
112 | ---Example: before |
113 | -- me = "abcdef" , Width = 9 , Filler = ' ' |
114 | -- after |
115 | -- me = " abcdef " |
116 | |
117 | ChangeAll(me : mutable; |
118 | C, NewC : Character from Standard; |
119 | CaseSensitive : Boolean from Standard); |
120 | ---Level: Public |
121 | ---Purpose: Substitutes all the characters equal to C by NewC in the |
122 | -- string <me>.The substition can be case sensitive. |
123 | ---Example: before |
124 | -- me = "HetTo" , C = 't' , NewC = 'l' , |
125 | -- CaseSensitive = True |
126 | -- after |
127 | -- me = "HelTo" |
128 | |
129 | Clear(me : mutable); |
130 | ---Level: Public |
131 | ---Purpose: Remove all characters in the string <me>. |
132 | -- Length is equal to zero now. |
133 | |
134 | Convert(me) returns AsciiString from TCollection; |
135 | ---Level: Public |
136 | ---Purpose: Converts a persistent HAsciiString to a non |
137 | -- persistent AsciiString. |
138 | |
139 | FirstLocationInSet(me; Set : HAsciiString from PCollection; |
140 | FromIndex : Integer from Standard; |
141 | ToIndex : Integer from Standard) |
142 | returns Integer |
143 | raises OutOfRange from Standard; |
144 | ---Level: Public |
145 | ---Purpose: Returns the index of the first character of <Set> founded in <me>. |
146 | -- The search begins to the index FromIndex and ends to the |
147 | -- the index ToIndex. |
148 | -- Returns zero if failure. |
149 | -- Raises an exception if FromIndex or ToIndex is out of range. |
150 | ---Example: before |
151 | -- me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7 |
152 | -- after |
153 | -- me = "aabAcAa" |
154 | -- returns |
155 | -- 4 |
156 | |
157 | FirstLocationNotInSet(me; Set : HAsciiString from PCollection; |
158 | FromIndex : Integer; |
159 | ToIndex : Integer) returns Integer |
160 | raises OutOfRange from Standard; |
161 | ---Level: Public |
162 | ---Purpose: Returns the index of the first character of <me> |
163 | -- that is not present in the set <Set>. |
164 | -- The search begins to the index FromIndex and ends to the |
165 | -- the index ToIndex in <me>. |
166 | -- Returns zero if failure. |
167 | -- Raises an exception if FromIndex or ToIndex is out of range. |
168 | ---Example: before |
169 | -- me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7 |
170 | -- after |
171 | -- me = "aabAcAa" |
172 | -- returns |
173 | -- 3 |
174 | |
175 | InsertAfter(me : mutable; Index : Integer; |
176 | S : HAsciiString from PCollection) |
177 | raises OutOfRange from Standard; |
178 | ---Level: Public |
179 | ---Purpose: Pushing a string after a specific index in the string <me>. |
180 | -- Raises an exception if Index is out of bounds. |
181 | ---Example: before |
182 | -- me = "cde" , Index = 0 , S = "ab" |
183 | -- after |
184 | -- me = "abcde" , S = "ab" |
185 | |
186 | InsertBefore(me : mutable; Index : Integer; |
187 | S : HAsciiString from PCollection) |
188 | raises OutOfRange from Standard; |
189 | ---Level: Public |
190 | ---Purpose: Pushing a string before a specific index in the string <me> |
191 | -- Raises an exception if Index is out of bounds |
192 | ---Example: before |
193 | -- me = "cde" , Index = 1 , S = "ab" |
194 | -- after |
195 | -- me = "abcde" , S = "ab" |
196 | |
197 | IntegerValue(me) returns Integer |
198 | raises NumericError from Standard; |
199 | ---Level: Public |
200 | ---Purpose: Returns the integer value corresponding to the string <me> |
201 | -- Raises an exception if the string does not correspond to |
202 | -- an integer value. |
203 | ---Example: me = " 10 " -> 10 |
204 | |
205 | IsDifferent (me ; other : HAsciiString) returns Boolean; |
206 | ---Level: Public |
207 | ---Purpose: Test if characters are different |
208 | -- between <me> and <other>. |
209 | |
210 | IsEmpty(me) returns Boolean from Standard; |
211 | ---Level: Public |
212 | ---Purpose: Returns True if the string <me> contains zero character |
213 | |
214 | IsGreater (me ; other : HAsciiString) returns Boolean; |
215 | ---Level: Public |
216 | ---Purpose: Returns TRUE if <me> is 'ASCII' greater than <other>. |
217 | |
218 | IsIntegerValue(me) returns Boolean from Standard; |
219 | ---Level: Public |
220 | ---Purpose: Returns True if the string contains an integer value. |
221 | ---Example: me = "3.14 " -> False |
222 | -- me = "123" -> True |
223 | |
224 | IsLess (me ; other : HAsciiString) returns Boolean; |
225 | ---Level: Public |
226 | ---Purpose: Returns TRUE if <me> is 'ASCII' less than <other>. |
227 | |
228 | IsRealValue(me) returns Boolean from Standard; |
229 | ---Level: Public |
230 | ---Purpose: Returns True if the string contains an Real value. |
231 | ---Example: me = "3.14 " -> True |
232 | -- me = "123" -> True |
233 | -- me = "3.14a" -> False |
234 | |
235 | IsSameString(me ; S : HAsciiString from PCollection) |
236 | ---Level: Public |
237 | ---Purpose: Returns True if two strings are equal. |
238 | -- The comparison is case sensitive. |
239 | returns Boolean from Standard; |
240 | |
241 | IsSameString(me; S : HAsciiString from PCollection; |
242 | CaseSensitive : Boolean from Standard) |
243 | returns Boolean from Standard; |
244 | ---Level: Public |
245 | ---Purpose: Returns True if two strings are equal. |
246 | -- The comparison is case sensitive if the flag is set. |
247 | |
248 | LeftAdjust(me : mutable); |
249 | ---Level: Public |
250 | ---Purpose: Removes all space characters in the begining of the |
251 | -- string. |
252 | |
253 | LeftJustify(me : mutable; Width : Integer; |
254 | Filler : Character from Standard) |
255 | raises NegativeValue from Standard; |
256 | ---Level: Public |
257 | ---Purpose: Left justify. |
258 | -- Length becomes equal to Width and the new characters are |
259 | -- equal to Filler. |
260 | -- If Width < Length nothing happens. |
261 | -- Raises an exception if Width is less than zero. |
262 | ---Example: before |
263 | -- me = "abcdef" , Width = 9 , Filler = ' ' |
264 | -- after |
265 | -- me = "abcdef " |
266 | |
267 | Length(me) returns Integer; |
268 | ---Level: Public |
269 | ---Purpose: Number of characters of the String. |
270 | |
271 | Location(me; N : Integer; C : Character from Standard; |
272 | FromIndex : Integer; |
273 | ToIndex : Integer) |
274 | returns Integer |
275 | raises OutOfRange from Standard; |
276 | ---Level: Public |
277 | ---Purpose: Returns the index of the nth occurence of the character C |
278 | -- in the string <me> from the starting index FromIndex to the |
279 | -- ending index ToIndex. |
280 | -- Returns zero if failure. |
281 | -- Raises an exception if FromIndex or ToIndex is out of range. |
282 | ---Example: before |
283 | -- me = "aabAa", N = 3, C = 'a', FromIndex = 1, ToIndex = 5 |
284 | -- after |
285 | -- me = "aabAa" |
286 | -- returns |
287 | -- 5 |
288 | |
289 | Location(me; S : HAsciiString from PCollection; |
290 | FromIndex : Integer; |
291 | ToIndex : Integer) |
292 | returns Integer |
293 | raises OutOfRange from Standard; |
294 | ---Level: Public |
295 | ---Purpose: Returns an index in the string <me> of the first occurence |
296 | -- of the string S in the string <me> from the starting index |
297 | -- FromIndex to the ending index ToIndex |
298 | -- returns zero if failure |
299 | -- Raises an exception if FromIndex or ToIndex is out of range. |
300 | ---Example: before |
301 | -- me = "aabAaAa", S = "Aa", FromIndex = 1, ToIndex = 7 |
302 | -- after |
303 | -- me = "aabAaAa" |
304 | -- returns |
305 | -- 4 |
306 | |
307 | Lowercase(me : mutable); |
308 | ---Level: Public |
309 | ---Purpose: Converts any upper-case character to its corresponding |
310 | -- lower-case character in the string <me>. If there is no |
311 | -- corresponding lower-case character, the character is |
312 | -- unchanged |
313 | -- before |
314 | -- me = "aBAcd123" |
315 | -- after |
316 | -- me = "abacd123" |
317 | |
318 | Prepend(me : mutable; S : HAsciiString from PCollection); |
319 | ---Level: Public |
320 | ---Purpose: Pushing a string at the begining of the string <me> |
321 | -- before |
322 | -- me = "cde" , S = "ab" |
323 | -- after |
324 | -- me = "abcde" , S = "ab" |
325 | |
326 | Print(me ; S : in out OStream); |
327 | ---Level: Public |
328 | ---Purpose: Prints the content of <me> on the stream S. |
329 | |
330 | RealValue(me) returns Real from Standard |
331 | raises NumericError from Standard; |
332 | ---Level: Public |
333 | ---Purpose: Returns the real value corresponding to the string <me>. |
334 | -- Raises an exception if the string does not correspond to a real value. |
335 | ---Example: me = " 10 " returns 10.0 |
336 | |
337 | Remove(me : mutable; Index : Integer) |
338 | ---Level: Public |
339 | ---Purpose: Removes the character located at the index Index in the string. |
340 | -- Raises an exception if Index is out of bounds. |
341 | raises OutOfRange from Standard; |
342 | |
343 | Remove(me : mutable; FromIndex, ToIndex : Integer) |
344 | ---Level: Public |
345 | ---Purpose: Removes all the characters from the index FromIndex to the |
346 | -- index ToIndex. |
347 | -- Raises an exception if FromIndex or ToIndex is out of bounds. |
348 | raises OutOfRange from Standard; |
349 | |
350 | RemoveAll(me : mutable; C : Character from Standard; |
351 | CaseSensitive : Boolean from Standard); |
352 | ---Level: Public |
353 | ---Purpose: Removes all the occurences of the character C in the string |
354 | ---Example: before |
355 | -- me = "HellLLo", C = 'L' , CaseSensitive = True |
356 | -- after |
357 | -- me = "Hello" |
358 | |
359 | RightAdjust(me : mutable); |
360 | ---Level: Public |
361 | ---Purpose: Removes all space characters at the end of the string. |
362 | |
363 | RightJustify(me : mutable; |
364 | Width : Integer; |
365 | Filler : Character from Standard) |
366 | raises NegativeValue from Standard; |
367 | ---Level: Public |
368 | ---Purpose: Right justify. |
369 | -- Length becomes equal to Width and the new characters are |
370 | -- equal to Filler. |
371 | -- If Width < Length nothing happens. |
372 | -- Raises an exception if Width is less than zero. |
373 | ---Example: before |
374 | -- me = "abcdef" , Width = 9 , Filler = ' ' |
375 | -- after |
376 | -- me = " abcdef" |
377 | |
378 | SetValue(me : mutable; Index : Integer; C : Character from Standard) |
379 | raises OutOfRange from Standard; |
380 | ---Level: Public |
381 | ---Purpose: Substitutes the character located to the position Index |
382 | -- by the character C. |
383 | -- Raises an exception if the Index is out of bounds. |
384 | ---Example: before |
385 | -- me = "Helll" , Index = 5 , C = 'o' |
386 | -- after |
387 | -- me = "Hello" |
388 | |
389 | SetValue(me : mutable; Index : Integer; |
390 | S : HAsciiString from PCollection) |
391 | raises OutOfRange from Standard; |
392 | ---Level: Public |
393 | ---Purpose: Substitutes from the index Index to the end by the string S. |
394 | -- Raises an exception if Index is out of bounds. |
395 | ---Example: before |
396 | -- me = "abcde" , Index = 3 , S = "wxyz" |
397 | -- after |
398 | -- me = "abwxyz" , S = "wxyz" |
399 | |
400 | Split(me : mutable; Index : Integer) |
401 | ---Level: Public |
402 | ---Purpose: Splits a string of characters into two sub-strings. |
403 | returns mutable HAsciiString from PCollection |
404 | raises OutOfRange from Standard; |
405 | |
406 | SubString(me; FromIndex, ToIndex : Integer) |
407 | ---Level: Public |
408 | ---Purpose: Creation of a sub-string of the string <me>. |
409 | -- The sub-string starts to the index Fromindex and ends |
410 | -- to the index ToIndex. |
411 | -- Raises an exception if ToIndex or FromIndex is out of bounds. |
412 | ---Example: before |
413 | -- me = "abcdefg", ToIndex=3, FromIndex=6 |
414 | -- after |
415 | -- me = "abcdefg" |
416 | -- returns |
417 | -- "cdef" |
418 | returns mutable HAsciiString from PCollection |
419 | raises OutOfRange from Standard; |
420 | |
421 | Token (me ; separators : CString=" \t" ; whichone : Integer=1) |
422 | returns mutable HAsciiString from PCollection; |
423 | ---Level: Public |
424 | ---Purpose: Extracts <aString> token from <me>. |
425 | -- The token extracted is the indice number <num>. |
426 | |
427 | Uppercase(me : mutable); |
428 | ---Level: Public |
429 | ---Purpose: Transforms all the characters into upper-case. |
430 | -- If there is no corresponding upper-case character, the |
431 | -- character is unchanged. |
432 | ---Example: before |
433 | -- me = "aBAcd" |
434 | -- after |
435 | -- me = "ABACD" |
436 | |
437 | UsefullLength(me) returns Integer; |
438 | ---Level: Public |
439 | ---Purpose: Length of the string ignoring all spaces (' ') and the |
440 | -- control character at the end. |
441 | |
442 | Value(me ; Index : Integer) returns Character from Standard |
443 | raises OutOfRange from Standard; |
444 | ---Level: Public |
445 | ---Purpose: Returns the character of index Index of the string |
446 | ---Example: me = "abcd", Index = 2, Value returns 'b'. |
447 | |
448 | ShallowDump (me; s: in out OStream) |
449 | is redefined; |
450 | ---Level: Advanced |
451 | ---C++: function call |
452 | |
453 | Assign(me : mutable ;TheData : VArrayOfCharacter) is private; |
454 | ---Level: Internal |
455 | ---Purpose : Assigns the field of the current structure with |
456 | -- the given value.Private method. |
457 | |
458 | |
459 | fields |
460 | Data : VArrayOfCharacter from DBC; |
461 | end HAsciiString; |
462 | |
463 | |
464 | |
465 | |
466 | |
467 | |
468 | |
469 | |
470 | |
471 | |
472 | |
473 | |
474 | |
475 | |
476 | |
477 | |
478 | |
479 | |
480 | |
481 | |
482 | |
483 | |