b311480e |
1 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
7fd59977 |
15 | //Modified: C. LEYNADIER Nov,21 1997 (Token et ChangeString) |
16 | |
7fd59977 |
17 | #include <Standard_ExtCharacter.hxx> |
18 | #include <Standard_ExtString.hxx> |
42cf5bc1 |
19 | #include <Standard_NegativeValue.hxx> |
20 | #include <Standard_NullObject.hxx> |
21 | #include <Standard_NumericError.hxx> |
22 | #include <Standard_OutOfRange.hxx> |
23 | #include <Standard_Type.hxx> |
24 | #include <TCollection_AsciiString.hxx> |
25 | #include <TCollection_ExtendedString.hxx> |
26 | #include <TCollection_HAsciiString.hxx> |
27 | #include <TCollection_HExtendedString.hxx> |
7fd59977 |
28 | |
25e59720 |
29 | IMPLEMENT_STANDARD_RTTIEXT(TCollection_HExtendedString,Standard_Transient) |
92efcf78 |
30 | |
7fd59977 |
31 | // ---------------------------------------------------------------------------- |
32 | // Create |
33 | // ---------------------------------------------------------------------------- |
34 | TCollection_HExtendedString::TCollection_HExtendedString(){} |
35 | |
36 | |
37 | // ---------------------------------------------------------------------------- |
38 | // Create |
39 | // ---------------------------------------------------------------------------- |
40 | TCollection_HExtendedString::TCollection_HExtendedString |
41 | (const Standard_CString message):myString(message) |
42 | {} |
43 | |
44 | // ---------------------------------------------------------------------------- |
45 | // Create |
46 | // ---------------------------------------------------------------------------- |
47 | TCollection_HExtendedString::TCollection_HExtendedString |
48 | (const Standard_ExtString message):myString(message) |
49 | {} |
50 | |
51 | // ---------------------------------------------------------------------------- |
52 | // Create |
53 | // ---------------------------------------------------------------------------- |
54 | TCollection_HExtendedString::TCollection_HExtendedString |
55 | (const Standard_ExtCharacter aChar):myString(aChar) |
56 | {} |
57 | |
58 | // ---------------------------------------------------------------------------- |
59 | // Create |
60 | // ---------------------------------------------------------------------------- |
61 | TCollection_HExtendedString::TCollection_HExtendedString |
62 | (const Standard_Integer length,const Standard_ExtCharacter filler ) |
63 | :myString(length,filler) |
64 | {} |
65 | |
66 | // ---------------------------------------------------------------------------- |
67 | // Create |
68 | // ---------------------------------------------------------------------------- |
69 | TCollection_HExtendedString::TCollection_HExtendedString |
70 | (const TCollection_ExtendedString& astring):myString(astring) |
71 | {} |
72 | |
73 | // ---------------------------------------------------------------------------- |
74 | // Create |
75 | // ---------------------------------------------------------------------------- |
76 | TCollection_HExtendedString::TCollection_HExtendedString |
77 | (const Handle(TCollection_HAsciiString)& astring) |
78 | :myString(astring->String()) |
79 | { |
80 | } |
81 | |
82 | // ---------------------------------------------------------------------------- |
83 | // Create |
84 | // ---------------------------------------------------------------------------- |
85 | TCollection_HExtendedString::TCollection_HExtendedString |
86 | (const Handle(TCollection_HExtendedString)& astring) |
87 | :myString(astring->ChangeString()) |
88 | { |
89 | } |
90 | |
91 | // --------------------------------------------------------------------------- |
92 | // AssignCat |
93 | // ---------------------------------------------------------------------------- |
94 | void TCollection_HExtendedString::AssignCat |
95 | (const Handle(TCollection_HExtendedString)& other) |
96 | { |
97 | myString.AssignCat(other->ChangeString()); |
98 | } |
99 | |
100 | // --------------------------------------------------------------------------- |
101 | // Cat |
102 | // ---------------------------------------------------------------------------- |
103 | Handle(TCollection_HExtendedString) TCollection_HExtendedString::Cat |
104 | (const Handle(TCollection_HExtendedString)& other) const |
105 | { |
106 | return new TCollection_HExtendedString(myString.Cat(other->ChangeString() ) ); |
107 | } |
108 | |
109 | // ---------------------------------------------------------------------------- |
110 | // ChangeAll |
111 | // ---------------------------------------------------------------------------- |
112 | void TCollection_HExtendedString::ChangeAll |
113 | (const Standard_ExtCharacter aChar, |
114 | const Standard_ExtCharacter NewChar) |
115 | { |
116 | myString.ChangeAll(aChar,NewChar); |
117 | } |
118 | |
119 | // ---------------------------------------------------------------------------- |
120 | // IsEmpty |
121 | // ---------------------------------------------------------------------------- |
122 | Standard_Boolean TCollection_HExtendedString::IsEmpty() const |
123 | { |
124 | return (myString.Length() == 0); |
125 | } |
126 | |
127 | // ---------------------------------------------------------------------------- |
128 | // Clear |
129 | // ---------------------------------------------------------------------------- |
130 | void TCollection_HExtendedString::Clear() |
131 | { |
132 | myString.Clear(); |
133 | } |
134 | |
135 | // ---------------------------------------------------------------------------- |
136 | // Insert a Standard_ExtCharacter before 'where'th Standard_ExtCharacter |
137 | // ---------------------------------------------------------------------------- |
138 | void TCollection_HExtendedString::Insert(const Standard_Integer where, |
139 | const Standard_ExtCharacter what) |
140 | { |
141 | myString.Insert(where,what); |
142 | } |
143 | |
144 | // ---------------------------------------------------------------------------- |
145 | // Insert |
146 | // ---------------------------------------------------------------------------- |
147 | void TCollection_HExtendedString::Insert(const Standard_Integer where, |
148 | const Handle(TCollection_HExtendedString)& what) |
149 | { |
150 | myString.Insert(where,what->ChangeString()); |
151 | } |
152 | |
153 | // ---------------------------------------------------------------------------- |
154 | // IsLess |
155 | // ---------------------------------------------------------------------------- |
156 | Standard_Boolean TCollection_HExtendedString::IsLess( |
157 | const Handle(TCollection_HExtendedString)& other) const |
158 | { |
159 | return myString.IsLess(other->ChangeString()); |
160 | } |
161 | |
162 | // ---------------------------------------------------------------------------- |
163 | // IsGreater |
164 | // ---------------------------------------------------------------------------- |
165 | Standard_Boolean TCollection_HExtendedString::IsGreater |
166 | (const Handle(TCollection_HExtendedString)& other) const |
167 | { |
168 | return myString.IsGreater(other->ChangeString()); |
169 | } |
170 | |
171 | // ---------------------------------------------------------------------------- |
172 | // IsAscii |
173 | // ---------------------------------------------------------------------------- |
174 | Standard_Boolean TCollection_HExtendedString::IsAscii() const |
175 | { |
176 | return myString.IsAscii(); |
177 | } |
178 | |
179 | // ---------------------------------------------------------------------------- |
180 | // Length |
181 | // ---------------------------------------------------------------------------- |
182 | Standard_Integer TCollection_HExtendedString::Length() const |
183 | { |
184 | return myString.Length(); |
185 | } |
186 | |
187 | // ---------------------------------------------------------------------------- |
188 | // Remove |
189 | // ---------------------------------------------------------------------------- |
190 | void TCollection_HExtendedString::Remove (const Standard_Integer where, |
191 | const Standard_Integer ahowmany) |
192 | { |
193 | myString.Remove(where,ahowmany); |
194 | } |
195 | |
196 | // ---------------------------------------------------------------------------- |
197 | // RemoveAll |
198 | // ---------------------------------------------------------------------------- |
199 | void TCollection_HExtendedString::RemoveAll(const Standard_ExtCharacter what) |
200 | { |
201 | myString.RemoveAll(what); |
202 | } |
203 | |
204 | // ---------------------------------------------------------------------------- |
205 | // SetValue |
206 | // ---------------------------------------------------------------------------- |
207 | void TCollection_HExtendedString::SetValue( |
208 | const Standard_Integer where,const Standard_ExtCharacter what) |
209 | { |
210 | myString.SetValue(where,what); |
211 | } |
212 | |
213 | // ---------------------------------------------------------------------------- |
214 | // SetValue |
215 | // --------------------------------------------------------------------------- |
216 | void TCollection_HExtendedString::SetValue(const Standard_Integer where, |
217 | const Handle(TCollection_HExtendedString)& what) |
218 | { |
219 | myString.SetValue(where, what->ChangeString()); |
220 | } |
221 | |
222 | // ---------------------------------------------------------------------------- |
223 | // Split |
224 | // ---------------------------------------------------------------------------- |
225 | Handle(TCollection_HExtendedString) TCollection_HExtendedString::Split |
226 | (const Standard_Integer where) |
227 | { |
228 | return new TCollection_HExtendedString(myString.Split(where)); |
229 | } |
230 | |
231 | // ---------------------------------------------------------------------------- |
232 | // Search |
233 | // ---------------------------------------------------------------------------- |
234 | Standard_Integer TCollection_HExtendedString::Search |
235 | (const Handle(TCollection_HExtendedString)& what) const |
236 | { |
237 | return myString.Search(what->ChangeString()); |
238 | } |
239 | |
240 | // ---------------------------------------------------------------------------- |
241 | // SearchFromEnd |
242 | // ---------------------------------------------------------------------------- |
243 | Standard_Integer TCollection_HExtendedString::SearchFromEnd |
244 | (const Handle(TCollection_HExtendedString)& what) const |
245 | { |
246 | return myString.SearchFromEnd(what->ChangeString()); |
247 | } |
248 | |
249 | // ---------------------------------------------------------------------------- |
250 | // Token |
251 | // ---------------------------------------------------------------------------- |
252 | Handle(TCollection_HExtendedString) TCollection_HExtendedString::Token |
253 | (const Standard_ExtString separators,const Standard_Integer whichone) const |
254 | { |
255 | return new TCollection_HExtendedString(myString.Token(separators,whichone)); |
256 | } |
257 | |
7fd59977 |
258 | // ---------------------------------------------------------------------------- |
259 | // Trunc |
260 | // ---------------------------------------------------------------------------- |
261 | void TCollection_HExtendedString::Trunc(const Standard_Integer ahowmany) |
262 | { |
263 | myString.Trunc(ahowmany); |
264 | } |
265 | |
266 | // ---------------------------------------------------------------------------- |
267 | // Value |
268 | // ---------------------------------------------------------------------------- |
269 | Standard_ExtCharacter TCollection_HExtendedString::Value |
270 | (const Standard_Integer where) const |
271 | { |
272 | return myString.Value(where); |
273 | } |
274 | |
275 | // ---------------------------------------------------------------------------- |
276 | // String |
277 | // ---------------------------------------------------------------------------- |
5ae15e0e |
278 | const TCollection_ExtendedString& TCollection_HExtendedString::String() const |
7fd59977 |
279 | { |
5ae15e0e |
280 | return myString; |
7fd59977 |
281 | } |
282 | |
283 | |
284 | //--------------------------------------------------------------------- |
285 | // Print |
286 | //--------------------------------------------------------------------- |
287 | void TCollection_HExtendedString::Print(Standard_OStream& S) const |
288 | { |
04232180 |
289 | S << "begin class HExtendedString "<<std::endl; |
7fd59977 |
290 | myString.Print(S); |
291 | } |
292 | |
7fd59977 |
293 | // ---------------------------------------------------------------------------- |
294 | // Issamestate |
295 | // ---------------------------------------------------------------------------- |
296 | Standard_Boolean TCollection_HExtendedString::IsSameState |
297 | (const Handle(TCollection_HExtendedString)& other) const |
298 | { |
a9dde4a3 |
299 | return myString == other->String(); |
7fd59977 |
300 | } |
301 | |
302 | |
303 | TCollection_ExtendedString& TCollection_HExtendedString::ChangeString() const |
304 | { |
305 | return (TCollection_ExtendedString&)myString; |
306 | } |