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