1 martin 1.102 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.103 //
|
3 martin 1.102 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.103 //
|
10 martin 1.102 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.103 //
|
17 martin 1.102 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.103 //
|
20 martin 1.102 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.103 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.102 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.103 //
|
28 martin 1.102 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.38 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_String_h
33 #define Pegasus_String_h
34
|
35 kumpf 1.71 #ifdef PEGASUS_OS_HPUX
|
36 kumpf 1.72 # ifdef HPUX_IA64_NATIVE_COMPILER
37 # include <iostream>
38 # else
39 # include <iostream.h>
40 # endif
|
41 kumpf 1.71 #else
42 # include <iostream>
43 #endif
|
44 mike 1.38 #include <Pegasus/Common/Config.h>
45 #include <Pegasus/Common/Char16.h>
|
46 kumpf 1.54 #include <Pegasus/Common/Linkage.h>
|
47 mike 1.38
48 PEGASUS_NAMESPACE_BEGIN
49
|
50 kumpf 1.59 class String;
|
51 mike 1.90 struct StringRep;
|
52 kumpf 1.51
|
53 kumpf 1.101 /**
54 The CString class provides access to an 8-bit String representation.
|
55 kumpf 1.59 */
|
56 kumpf 1.60 class PEGASUS_COMMON_LINKAGE CString
|
57 kumpf 1.59 {
58 public:
59
|
60 kumpf 1.101 /**
61 Constructs a CString object with a null string value.
|
62 karl 1.79 */
|
63 kumpf 1.59 CString();
64
|
65 kumpf 1.101 /**
66 Constructs an independent copy of a CString object.
67 @param cstr The CString instance to copy.
|
68 karl 1.79 */
|
69 kumpf 1.59 CString(const CString& cstr);
70
|
71 kumpf 1.101 /**
72 Destructs a CString object.
|
73 karl 1.79 */
|
74 kumpf 1.59 ~CString();
75
|
76 kumpf 1.101 /**
77 Copies the value of another CString object.
78 @param cstr The CString object from which to copy the value.
79 @return A reference to the target CString object with its newly
80 assigned value.
|
81 karl 1.79 */
|
82 kumpf 1.62 CString& operator=(const CString& cstr);
83
|
84 kumpf 1.101 /**
85 Gets the CString's data as a C string pointer. IMPORTANT: The
86 returned pointer refers to memory owned by the CString object. The
87 caller must not free this memory. The returned pointer is valid only
88 until the CString object is destructed or reassigned. Use of this
89 operator on a temporary CString object may result in a memory error.
90 For example, this usage is invalid:
91
92 const char* cstr = String("Hello").getCString();
93 printf(cstr);
94
95 @return Returns a const char pointer to the CString's data.
|
96 karl 1.79 */
|
97 kumpf 1.59 operator const char*() const;
98
99 private:
100
101 CString(char* cstr);
102
103 friend class String;
104
|
105 mike 1.90 char* _rep;
|
106 kumpf 1.59 };
107
|
108 mike 1.38 /**
|
109 kumpf 1.101 This class implements the CIM string type. The intrinsic string format
110 is UTF-16, which is a superset of the UCS-2 characters allowed in CIM
111 strings. Facilities are provided for converting to and from UTF-8
112 character strings.
113
114 Many of the method interfaces refer to a number of characters. In all
115 cases, these characters are counted as 8- or 16-bit memory chunks rather
116 than logical UTF-8 or UTF-16 character chains.
|
117 mike 1.38 */
118 class PEGASUS_COMMON_LINKAGE String
119 {
120 public:
121
|
122 kumpf 1.101 /**
123 Represents an empty string. This value may be used as a convenience
124 to avoid construction of an empty String object.
|
125 kumpf 1.48 */
126 static const String EMPTY;
127
|
128 kumpf 1.101 /**
129 Constructs an empty String.
|
130 mike 1.38 */
131 String();
132
|
133 kumpf 1.101 /**
134 Constructs a String with the value of another String.
135 @param str The String from which to copy the value.
|
136 karl 1.79 */
|
137 kumpf 1.48 String(const String& str);
|
138 mike 1.38
|
139 kumpf 1.101 /**
140 Constructs a String with a specified number of characters of the
141 value of another String.
142 @param str The String from which to copy the value.
143 @param n A Uint32 specifying the number of characters to copy.
144 @exception IndexOutOfBoundsException If the specified String does not
145 contain the specified number of characters.
146 @exception bad_alloc If the construction fails because of a memory
147 allocation failure.
|
148 karl 1.79 */
|
149 kumpf 1.48 String(const String& str, Uint32 n);
|
150 mike 1.38
|
151 kumpf 1.101 /**
152 Constructs a String with the value from a Char16 buffer.
153 @param str The Char16 buffer from which to copy the value.
154 @exception NullPointer If the buffer pointer is NULL.
155 @exception bad_alloc If the construction fails because of a memory
156 allocation failure.
|
157 karl 1.79 */
|
158 kumpf 1.48 String(const Char16* str);
|
159 mike 1.38
|
160 kumpf 1.101 /**
161 Constructs a String with a specified number of characters of the
162 value from a Char16 buffer.
163 @param str The Char16 buffer from which to copy the value.
164 @param n A Uint32 specifying the number of characters to copy.
165 @exception NullPointer If the buffer pointer is NULL.
166 @exception bad_alloc If the construction fails because of a memory
167 allocation failure.
|
168 karl 1.79 */
|
169 kumpf 1.48 String(const Char16* str, Uint32 n);
|
170 mike 1.38
|
171 kumpf 1.101 /**
172 Constructs a String with the value from a C string in UTF-8 format.
173 @param str The C string from which to copy the value.
174 @exception NullPointer If the C string pointer is NULL.
175 @exception bad_alloc If the construction fails because of a memory
176 allocation failure.
177 @exception Exception If the C string contains invalid UTF-8.
|
178 karl 1.79 */
|
179 kumpf 1.48 String(const char* str);
|
180 chuck 1.77
|
181 kumpf 1.101 /**
182 Constructs a String with a specified number of characters of the
183 value from a C string in UTF-8 format.
184 @param str The C string from which to copy the value.
185 @param n A Uint32 specifying the number of characters to copy.
186 @exception NullPointer If the C string pointer is NULL.
187 @exception bad_alloc If the construction fails because of a memory
188 allocation failure.
189 @exception Exception If the C string contains invalid UTF-8.
|
190 karl 1.79 */
|
191 kumpf 1.48 String(const char* str, Uint32 n);
|
192 mike 1.38
|
193 kumpf 1.101 /**
194 Destructs a String object.
|
195 karl 1.79 */
|
196 mike 1.38 ~String();
197
|
198 kumpf 1.101 /**
199 Assigns the value of a String to the value of another String.
200 @param str The String from which to copy the value.
201 @return A reference to the target String object with its newly
202 assigned value.
203 @exception bad_alloc If the assignment fails because of a memory
204 allocation failure.
|
205 mike 1.38 */
|
206 kumpf 1.48 String& operator=(const String& str);
|
207 mike 1.38
|
208 kumpf 1.101 /**
209 Assigns the value of a String to the value of another String.
210 @param str The String from which to copy the value.
211 @return A reference to the target String object with its newly
212 assigned value.
213 @exception bad_alloc If the assignment fails because of a memory
214 allocation failure.
|
215 mike 1.38 */
|
216 kumpf 1.48 String& assign(const String& str);
|
217 mike 1.38
|
218 kumpf 1.101 /**
219 Assigns the value of a String to the value in a Char16 buffer.
220 @param str The Char16 buffer from which to copy the value.
221 @return A reference to the target String object with its newly
222 assigned value.
223 @exception NullPointer If the buffer pointer is NULL.
224 @exception bad_alloc If the assignment fails because of a memory
225 allocation failure.
|
226 karl 1.79 */
|
227 kumpf 1.48 String& assign(const Char16* str);
|
228 mike 1.38
|
229 kumpf 1.101 /**
230 Assigns the value of a String with a specified number of characters
231 of the value from a Char16 buffer.
232 @param str The Char16 buffer from which to copy the value.
233 @param n A Uint32 specifying the number of characters to copy.
234 @return A reference to the target String object with its newly
235 assigned value.
236 @exception NullPointer If the buffer pointer is NULL.
237 @exception bad_alloc If the assignment fails because of a memory
238 allocation failure.
|
239 karl 1.79 */
|
240 kumpf 1.48 String& assign(const Char16* str, Uint32 n);
|
241 mike 1.38
|
242 kumpf 1.101 /**
243 Assigns the value of a String to the value from a C string in UTF-8
244 format.
245 @param str The C string from which to copy the value.
246 @return A reference to the target String object with its newly
247 assigned value.
248 @exception NullPointer If the C string pointer is NULL.
249 @exception bad_alloc If the assignment fails because of a memory
250 allocation failure.
251 @exception Exception If the C string contains invalid UTF-8.
|
252 karl 1.79 */
|
253 kumpf 1.48 String& assign(const char* str);
|
254 mike 1.38
|
255 kumpf 1.101 /**
256 Assigns the value of a String with a specified number of characters
257 of the value from a C string in UTF-8 format.
258 @param str The C string from which to copy the value.
259 @param n A Uint32 specifying the number of characters to copy.
260 @return A reference to the target String object with its newly
261 assigned value.
262 @exception NullPointer If the C string pointer is NULL.
263 @exception bad_alloc If the assignment fails because of a memory
264 allocation failure.
265 @exception Exception If the C string contains invalid UTF-8.
|
266 karl 1.79 */
|
267 kumpf 1.48 String& assign(const char* str, Uint32 n);
|
268 mike 1.38
|
269 kumpf 1.101 /**
270 Sets a String value to the empty String.
|
271 mike 1.38 */
272 void clear();
273
|
274 kumpf 1.101 /**
275 Reserves memory for a specified number of (16-bit) characters.
276 This method does not change the size() of the string or any other
277 external behavior. If the capacity of the string is already greater
278 than or equal to the specified size, this method has no effect. The
279 capacity of a String is set only for performance reasons.
280 @param capacity A Uint32 specifying the number of characters the
281 String should be prepared to hold.
|
282 mike 1.38 */
|
283 kumpf 1.51 void reserveCapacity(Uint32 capacity);
|
284 mike 1.38
|
285 kumpf 1.101 /**
286 Returns the number of characters in a String value. No termination
287 character is included in the count. For example, String("abcd").size()
288 returns 4.
|
289 mike 1.38 */
|
290 kumpf 1.48 Uint32 size() const;
|
291 mike 1.38
|
292 kumpf 1.101 /**
293 Gets a null-terminated Char16 buffer containing the String value.
294 The buffer is valid until the original String object is modified or
295 destructed.
296 @return A pointer to a null-terminated Char16 buffer containing the
297 String value.
|
298 mike 1.38 */
|
299 kumpf 1.61 const Char16* getChar16Data() const;
|
300 mike 1.38
|
301 kumpf 1.101 /**
302 Gets a CString object containing the String value in UTF-8 format.
303 Important: A character pointer extracted from a CString object is
304 only valid while the CString object exists and is unmodified. (See
305 the CString documentation.) Thus, in the following example, the
306 variable p holds a dangling (invalid) pointer:
307 <pre>
|
308 jim.wunderlich 1.91 const char * p = (const char *)test.getCString();
|
309 kumpf 1.101 </pre>
310 This situation can be corrected by declaring a CString variable in
311 the same scope.
|
312 jim.wunderlich 1.91
|
313 kumpf 1.101 @return A CString object containing the String value in UTF-8 format.
314 @exception bad_alloc If the operation fails because of a memory
315 allocation failure.
|
316 mike 1.38 */
|
317 kumpf 1.59 CString getCString() const;
|
318 mike 1.38
|
319 kumpf 1.101 /**
320 Gets a specified character from the String value.
321 @param index Index of the character to access.
322 @return The Char16 character at the specified index.
323 @exception IndexOutOfBoundsException If the String does not contain a
324 character at the specified index.
|
325 mike 1.38 */
|
326 kumpf 1.58 Char16& operator[](Uint32 index);
|
327 mike 1.38
|
328 kumpf 1.101 /**
329 Gets a specified character from the String value.
330 @param index Index of the character to access.
331 @return The Char16 character at the specified index.
332 @exception IndexOutOfBoundsException If the String does not contain a
333 character at the specified index.
|
334 mike 1.38 */
|
335 kumpf 1.58 const Char16 operator[](Uint32 index) const;
|
336 mike 1.38
|
337 kumpf 1.101 /**
338 Appends a character to the String.
339 @param c The Char16 character to append.
340 @return A reference to the String object containing the newly appended
341 character.
342 @exception bad_alloc If the append fails because of a memory
343 allocation failure.
|
344 mike 1.38 */
345 String& append(const Char16& c);
346
|
347 kumpf 1.101 /**
348 Appends a specified number of characters to the String from a Char16
349 buffer.
350 @param str The Char16 buffer from which to append the characters.
351 @param n A Uint32 specifying the number of characters to append from
352 the buffer.
353 @return A reference to the String object containing the newly appended
354 characters.
355 @exception NullPointer If the buffer pointer is NULL.
356 @exception bad_alloc If the append fails because of a memory
357 allocation failure.
|
358 karl 1.79 */
|
359 mike 1.38 String& append(const Char16* str, Uint32 n);
360
|
361 kumpf 1.101 /**
362 Appends a String value to the String.
363 @param str The String to append.
364 @return A reference to the String object containing the newly appended
365 characters.
366 @exception bad_alloc If the append fails because of a memory
367 allocation failure.
|
368 mike 1.38 */
|
369 kumpf 1.57 String& append(const String& str);
|
370 mike 1.38
|
371 kumpf 1.101 /**
372 Removes a specified number of characters from the String starting at a
373 given index. If the number of characters to remove is specified as
374 PEG_NOT_FOUND, then all characters from the index to the end of the
375 String are removed.
376 @param index Uint32 position in String from which to remove characters.
377 @param size A Uint32 specifying the number of characters to remove.
378 The default value is PEG_NOT_FOUND, which means all characters
379 from the index to the end of the String are to be removed.
380 @exception IndexOutOfBoundsException If the index plus the size (if not
381 PEG_NOT_FOUND) is greater than the number of characters in the
382 String.
|
383 mike 1.38 */
|
384 kumpf 1.58 void remove(Uint32 index, Uint32 size = PEG_NOT_FOUND);
|
385 mike 1.38
|
386 kumpf 1.101 /**
387 Creates a new String containing up to the specified number of
388 characters from the specified index in the String.
389 @param index A Uint32 specifying the index at which to copy characters
390 into the new String.
391 @param n A Uint32 specifying the maximum number of characters to copy
392 into the new String. If the value is PEG_NOT_FOUND or is greater
393 than the number of characters from the index to the end of the
394 String, the new String contains all characters from the index to
395 the end of the String.
396 @return A new String containing up to the specified number of
397 characters from the specified index in the String.
398 @exception bad_alloc If the operation fails because of a memory
399 allocation failure.
400 */
401 String subString(Uint32 index, Uint32 n = PEG_NOT_FOUND) const;
402
403 /**
404 Finds the index of the first occurrence of a specified character in
405 the String. If the character is not found, PEG_NOT_FOUND is returned.
406 @param c The Char16 value to find in the String.
407 kumpf 1.101 @return The Uint32 index of the character in the String if found,
408 PEG_NOT_FOUND otherwise.
|
409 mike 1.38 */
410 Uint32 find(Char16 c) const;
411
|
412 kumpf 1.100 /**
|
413 kumpf 1.101 Finds the index of the first occurrence of a specified character in
414 the String beginning at a specified index. If the character is not
415 found, PEG_NOT_FOUND is returned.
416 @param c The Char16 value to find in the String.
417 @param index The Uint32 index at which to start the search.
418 @return The Uint32 index of the character in the String if found,
419 PEG_NOT_FOUND otherwise.
|
420 kumpf 1.74 */
|
421 kumpf 1.58 Uint32 find(Uint32 index, Char16 c) const;
|
422 mike 1.38
|
423 kumpf 1.101 /**
424 Finds the index of the first occurrence of a specified String value in
425 the String. If the String value is not found, PEG_NOT_FOUND is
426 returned.
427 @param s The String value to find in the String.
428 @return The Uint32 index of the beginning of the String value if found,
429 PEG_NOT_FOUND otherwise.
|
430 mike 1.38 */
431 Uint32 find(const String& s) const;
432
|
433 kumpf 1.101 /**
434 Finds the index of the last occurrence of a specified character in
435 the String. If the character is not found, PEG_NOT_FOUND is returned.
436 @param c The Char16 value to find in the String.
437 @return The Uint32 index of the character in the String if found,
438 PEG_NOT_FOUND otherwise.
|
439 mike 1.38 */
440 Uint32 reverseFind(Char16 c) const;
441
|
442 kumpf 1.101 /**
443 Converts all characters in the String to lower case.
|
444 david 1.81 */
445 void toLower();
446
|
447 denise.eckstein 1.85 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
|
448 kumpf 1.101 /**
449 <I><B>Experimental Interface</B></I><BR>
450 Converts all characters in the String to upper case.
|
451 mike 1.38 */
|
452 chuck 1.88 void toUpper();
|
453 david 1.81 #endif
|
454 kumpf 1.48
|
455 kumpf 1.95 /**
456 Compares the first n characters of two String objects.
457 @param s1 The first String to compare.
458 @param s2 The second String to compare.
459 @param n The maximum number of characters to compare.
|
460 kumpf 1.101 @return A negative integer if the first n characters of s1 are
461 lexographically less than s2, 0 if the first n characters of s1
462 and s2 are equal, and a positive integer otherwise.
|
463 mike 1.38 */
|
464 kumpf 1.51 static int compare(const String& s1, const String& s2, Uint32 n);
|
465 mike 1.38
|
466 kumpf 1.95 /**
|
467 kumpf 1.101 Compares two String objects. (Note: Use the comparison
468 operators < <= > >= to compare String objects.)
|
469 kumpf 1.95 @param s1 The first String to compare.
470 @param s2 The second String to compare.
|
471 kumpf 1.101 @return A negative integer if s1 is lexographically less than s2,
472 0 if s1 and s2 are equal, and a positive integer otherwise.
|
473 mike 1.38 */
|
474 kumpf 1.51 static int compare(const String& s1, const String& s2);
|
475 mike 1.38
|
476 kumpf 1.95 /**
477 Compares two String objects, ignoring case differences.
478 @param s1 The first String to compare.
479 @param s2 The second String to compare.
|
480 kumpf 1.101 @return A negative integer if s1 is lexographically less than s2,
481 0 if s1 and s2 are equal, and a positive integer otherwise.
482 (Case differences are ignored in all cases.)
|
483 kumpf 1.48 */
|
484 kumpf 1.49 static int compareNoCase(const String& s1, const String& s2);
|
485 kumpf 1.48
|
486 kumpf 1.100 /**
|
487 kumpf 1.101 Compares two String objects for equality. For example,
|
488 kumpf 1.100 <pre>
489 String s1 = "Hello World";
490 String s2 = s1;
|
491 kumpf 1.101 assert(String::equal(s1, s2));
|
492 kumpf 1.100 </pre>
|
493 kumpf 1.101 @param s1 The first String to compare.
494 @param s2 The second String to compare.
495 @return True if the two strings are equal, false otherwise.
|
496 mike 1.38 */
|
497 kumpf 1.100 static Boolean equal(const String& s1, const String& s2);
|
498 mike 1.38
|
499 kumpf 1.100 /**
500 Compares two strings and returns true if they are equal independent of
501 the case of the characters.
|
502 kumpf 1.101 @param s1 The first String to compare.
503 @param s2 The second String to compare.
|
504 kumpf 1.100 @return true if the strings are equal independent of case, false
505 otherwise.
|
506 karl 1.47 */
|
507 kumpf 1.100 static Boolean equalNoCase(const String& s1, const String& s2);
|
508 david 1.76
|
509 mike 1.90 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
510
511 String(const String& s1, const String& s2);
512
513 String(const String& s1, const char* s2);
514
515 String(const char* s1, const String& s2);
516
517 String& operator=(const char* str);
518
519 Uint32 find(const char* s) const;
520
521 static Boolean equal(const String& s1, const char* s2);
522
523 static int compare(const String& s1, const char* s2);
524
525 String& append(const char* str);
526
527 String& append(const char* str, Uint32 size);
528
529 static Boolean equalNoCase(const String& s1, const char* s2);
530 mike 1.90
531 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
532
|
533 mike 1.38 private:
534
|
535 kumpf 1.51 StringRep* _rep;
|
536 mike 1.38 };
|
537 mike 1.40
|
538 kumpf 1.101 /**
539 Compares two String objects for equality.
540 @param str1 The first String to compare.
541 @param str2 The second String to compare.
542 @return True if the strings are equal, false otherwise.
|
543 mike 1.38 */
|
544 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator==(
545 const String& str1,
546 const String& str2);
|
547 mike 1.38
|
548 kumpf 1.101 /**
549 Compares a String and a C string for equality.
550 @param str1 The String to compare.
551 @param str2 The C string to compare.
552 @return True if the strings are equal, false otherwise.
|
553 mike 1.38 */
|
554 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator==(const String& str1, const char* str2);
|
555 mike 1.38
|
556 kumpf 1.101 /**
557 Compares a String and a C string for equality.
558 @param str1 The C string to compare.
559 @param str2 The String to compare.
560 @return True if the strings are equal. false otherwise.
|
561 mike 1.38 */
|
562 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator==(const char* str1, const String& str2);
|
563 mike 1.38
|
564 kumpf 1.101 /**
565 Compares two String objects for inequality.
566 @param str1 The first String to compare.
567 @param str2 The second String to compare.
568 @return False if the strings are equal, true otherwise.
|
569 mike 1.38 */
|
570 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator!=(
571 const String& str1,
572 const String& str2);
|
573 mike 1.38
|
574 kumpf 1.101 /**
575 Writes a String value to an output stream. Characters with a zero value or
576 with a non-zero high-order byte are written in a hexadecimal encoding.
577 @param os The output stream to which the String value is written.
578 @param str The String to write to the output stream.
579 @return A reference to the output stream.
|
580 karl 1.79 */
|
581 mike 1.38 PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<(
582 PEGASUS_STD(ostream)& os,
|
583 kumpf 1.48 const String& str);
|
584 mike 1.38
|
585 kumpf 1.101 /**
586 Concatenates String objects. For example,
|
587 mike 1.38 <pre>
|
588 david.dillard 1.89 String t1 = "abc";
589 String t2;
590 t2 = t1 + "def"
|
591 jim.wunderlich 1.94 assert(t2 == "abcdef");
|
592 mike 1.38 </pre>
|
593 kumpf 1.101 @param str1 The first String to concatenate.
594 @param str2 The second String to concatenate.
595 @return The concatenated String.
|
596 mike 1.38 */
|
597 kumpf 1.48 PEGASUS_COMMON_LINKAGE String operator+(const String& str1, const String& str2);
|
598 mike 1.38
|
599 kumpf 1.101 /**
600 Compares two String objects.
601 @param s1 The first String to compare.
602 @param s2 The second String to compare.
603 @return True if s1 is lexographically less than s2, false otherwise.
|
604 mike 1.38 */
|
605 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator<(
606 const String& str1,
607 const String& str2);
|
608 mike 1.38
|
609 kumpf 1.101 /**
610 Compares two String objects.
611 @param s1 The first String to compare.
612 @param s2 The second String to compare.
613 @return True if s1 is lexographically less than or equal to s2,
614 false otherwise.
|
615 mike 1.38 */
|
616 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator<=(
617 const String& str1,
618 const String& str2);
|
619 mike 1.38
|
620 kumpf 1.101 /**
621 Compares two String objects.
622 @param s1 The first String to compare.
623 @param s2 The second String to compare.
624 @return True if s1 is lexographically greater than s2, false otherwise.
|
625 mike 1.38 */
|
626 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator>(
627 const String& str1,
628 const String& str2);
|
629 mike 1.38
|
630 kumpf 1.101 /**
631 Compares two String objects.
632 @param s1 The first String to compare.
633 @param s2 The second String to compare.
634 @return True if s1 is lexographically greater than or equal to s2,
635 false otherwise.
|
636 mike 1.38 */
|
637 kumpf 1.48 PEGASUS_COMMON_LINKAGE Boolean operator>=(
638 const String& str1,
639 const String& str2);
|
640 mike 1.38
|
641 mike 1.90 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
642
643 PEGASUS_COMMON_LINKAGE Boolean operator==(const String& s1, const String& s2);
644
645 PEGASUS_COMMON_LINKAGE Boolean operator==(const String& s1, const char* s2);
646
647 PEGASUS_COMMON_LINKAGE Boolean operator==(const char* s1, const String& s2);
648
649 PEGASUS_COMMON_LINKAGE Boolean operator!=(const String& s1, const String& s2);
650
651 PEGASUS_COMMON_LINKAGE Boolean operator!=(const String& s1, const char* s2);
652
653 PEGASUS_COMMON_LINKAGE Boolean operator!=(const char* s1, const String& s2);
654
655 PEGASUS_COMMON_LINKAGE Boolean operator<(const String& s1, const String& s2);
656
657 PEGASUS_COMMON_LINKAGE Boolean operator<(const String& s1, const char* s2);
658
659 PEGASUS_COMMON_LINKAGE Boolean operator<(const char* s1, const String& s2);
660
661 PEGASUS_COMMON_LINKAGE Boolean operator>(const String& s1, const String& s2);
662 mike 1.90
663 PEGASUS_COMMON_LINKAGE Boolean operator>(const String& s1, const char* s2);
664
665 PEGASUS_COMMON_LINKAGE Boolean operator>(const char* s1, const String& s2);
666
667 PEGASUS_COMMON_LINKAGE Boolean operator<=(const String& s1, const String& s2);
668
669 PEGASUS_COMMON_LINKAGE Boolean operator<=(const String& s1, const char* s2);
670
671 PEGASUS_COMMON_LINKAGE Boolean operator<=(const char* s1, const String& s2);
672
673 PEGASUS_COMMON_LINKAGE Boolean operator>=(const String& s1, const String& s2);
674
675 PEGASUS_COMMON_LINKAGE Boolean operator>=(const String& s1, const char* s2);
676
677 PEGASUS_COMMON_LINKAGE Boolean operator>=(const char* s1, const String& s2);
678
679 PEGASUS_COMMON_LINKAGE String operator+(const String& s1, const String& s2);
680
681 PEGASUS_COMMON_LINKAGE String operator+(const String& s1, const char* s2);
682
683 mike 1.90 PEGASUS_COMMON_LINKAGE String operator+(const char* s1, const String& s2);
684
685 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
686
|
687 mike 1.38 PEGASUS_NAMESPACE_END
688
|
689 dave.sudlik 1.99 #if defined(PEGASUS_INTERNALONLY)
|
690 mike 1.90 # include "StringInline.h"
691 #endif
692
|
693 mike 1.38 #endif /* Pegasus_String_h */
|