Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXString.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * S t r i n g O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXString.h,v 1.120 2006/02/20 03:32:12 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXSTRING_H
25 #define FXSTRING_H
26 
27 namespace FX {
28 
29 
30 /**
31 * FXString provides essential string manipulation capabilities.
32 */
33 class FXAPI FXString {
34 private:
35  FXchar* str;
36 public:
37  static const FXchar null[];
38  static const FXchar hex[17];
39  static const FXchar HEX[17];
40 public:
41  static const signed char utfBytes[256];
42 public:
43 
44  /// Create empty string
45  FXString();
46 
47  /// Copy construct
48  FXString(const FXString& s);
49 
50  /// Construct and init from string
51  FXString(const FXchar* s);
52 
53  /// Construct and init from wide character string
54  FXString(const FXwchar* s);
55 
56  /// Construct and init from narrow character string
57  FXString(const FXnchar* s);
58 
59  /// Construct and init with substring
60  FXString(const FXchar* s,FXint n);
61 
62  /// Construct and init with wide character substring
63  FXString(const FXwchar* s,FXint n);
64 
65  /// Construct and init with narrow character substring
66  FXString(const FXnchar* s,FXint n);
67 
68  /// Construct and fill with constant
69  FXString(FXchar c,FXint n);
70 
71  /// Length of text in bytes
72  FXint length() const { return *(((FXint*)str)-1); }
73 
74  /// Change the length of the string to len
75  void length(FXint len);
76 
77  /// Count number of utf8 characters
78  FXint count() const;
79 
80  /// Count number of utf8 characters in subrange
81  FXint count(FXint pos,FXint len) const;
82 
83  /// Return byte offset of utf8 character at index
84  FXint offset(FXint indx) const;
85 
86  /// Return index of utf8 character at byte offset
87  FXint index(FXint offs) const;
88 
89  /// Validate position to point to begin of utf8 character
90  FXint validate(FXint p) const;
91 
92  /// Return extent of utf8 character at position
93  FXint extent(FXint p) const { return utfBytes[(FXuchar)str[p]]; }
94 
95  /// Return start of next utf8 character
96  FXint inc(FXint p) const;
97 
98  /// Return start of previous utf8 character
99  FXint dec(FXint p) const;
101  /// Get text contents
102  const FXchar* text() const { return (const FXchar*)str; }
104  /// See if string is empty
105  bool empty() const { return (((FXint*)str)[-1]==0); }
107  /// See if string is empty
108  bool operator!() const { return (((FXint*)str)[-1]==0); }
110  /// Return a non-const reference to the ith character
111  FXchar& operator[](FXint i){ return str[i]; }
113  /// Return a const reference to the ith character
114  const FXchar& operator[](FXint i) const { return str[i]; }
116  /// Return a non-const reference to the ith character
117  FXchar& at(FXint i){ return str[i]; }
119  /// Return a const reference to the ith character
120  const FXchar& at(FXint i) const { return str[i]; }
121 
122  /// Return wide character starting at offset i
123  FXwchar wc(FXint i) const;
124 
125  /// Assign a string to this
126  FXString& operator=(const FXchar* s);
127 
128  /// Assign a wide character string to this
129  FXString& operator=(const FXwchar* s);
130 
131  /// Assign a narrow character string to this
132  FXString& operator=(const FXnchar* s);
133 
134  /// Assign another string to this
135  FXString& operator=(const FXString& s);
136 
137  /// Convert to lower case
138  FXString& lower();
139 
140  /// Convert to upper case
141  FXString& upper();
142 
143  /// Return num partition(s) beginning at start from a string separated by delimiters delim.
144  FXString section(FXchar delim,FXint start,FXint num=1) const;
145 
146  /// Return num partition(s) beginning at start from a string separated by set of delimiters from delim of size n
147  FXString section(const FXchar* delim,FXint n,FXint start,FXint num) const;
148 
149  /// Return num partition(s) beginning at start from a string separated by set of delimiters from delim.
150  FXString section(const FXchar* delim,FXint start,FXint num=1) const;
151 
152  /// Return num partition(s) beginning at start from a string separated by set of delimiters from delim.
153  FXString section(const FXString& delim,FXint start,FXint num=1) const;
154 
155  /// Adopt string s, leaving s empty
156  FXString& adopt(FXString& s);
157 
158  /// Assign character c to this string
159  FXString& assign(FXchar c);
160 
161  /// Assign n characters c to this string
162  FXString& assign(FXchar c,FXint n);
163 
164  /// Assign first n characters of string s to this string
165  FXString& assign(const FXchar *s,FXint n);
166 
167  /// Assign first n characters of wide character string s to this string
168  FXString& assign(const FXwchar *s,FXint n);
169 
170  /// Assign first n characters of narrow character string s to this string
171  FXString& assign(const FXnchar *s,FXint n);
172 
173  /// Assign string s to this string
174  FXString& assign(const FXchar* s);
175 
176  /// Assign wide character string s to this string
177  FXString& assign(const FXwchar* s);
178 
179  /// Assign narrow character string s to this string
180  FXString& assign(const FXnchar* s);
181 
182  /// Assign string s to this string
183  FXString& assign(const FXString& s);
184 
185  /// Insert character at specified position
186  FXString& insert(FXint pos,FXchar c);
187 
188  /// Insert n characters c at specified position
189  FXString& insert(FXint pos,FXchar c,FXint n);
190 
191  /// Insert first n characters of string at specified position
192  FXString& insert(FXint pos,const FXchar* s,FXint n);
193 
194  /// Insert first n characters of wide character string at specified position
195  FXString& insert(FXint pos,const FXwchar* s,FXint n);
196 
197  /// Insert first n characters of narrow character string at specified position
198  FXString& insert(FXint pos,const FXnchar* s,FXint n);
199 
200  /// Insert string at specified position
201  FXString& insert(FXint pos,const FXchar* s);
202 
203  /// Insert wide character string at specified position
204  FXString& insert(FXint pos,const FXwchar* s);
205 
206  /// Insert narrow character string at specified position
207  FXString& insert(FXint pos,const FXnchar* s);
208 
209  /// Insert string at specified position
210  FXString& insert(FXint pos,const FXString& s);
211 
212  /// Prepend string with input character
213  FXString& prepend(FXchar c);
214 
215  /// Prepend string with n characters c
216  FXString& prepend(FXchar c,FXint n);
217 
218  /// Prepend first n characters of string s
219  FXString& prepend(const FXchar* s,FXint n);
220 
221  /// Prepend first n characters of wide character string s
222  FXString& prepend(const FXwchar* s,FXint n);
223 
224  /// Prepend first n characters of narrow character string s
225  FXString& prepend(const FXnchar* s,FXint n);
226 
227  /// Prepend string with string s
228  FXString& prepend(const FXchar* s);
229 
230  /// Prepend string with wide character string
231  FXString& prepend(const FXwchar* s);
232 
233  /// Prepend string with narrow character string
234  FXString& prepend(const FXnchar* s);
235 
236  /// Prepend string with string s
237  FXString& prepend(const FXString& s);
238 
239  /// Append character c to this string
240  FXString& append(FXchar c);
241 
242  /// Append n characters c to this string
243  FXString& append(FXchar c,FXint n);
244 
245  /// Append first n characters of string s to this string
246  FXString& append(const FXchar* s,FXint n);
247 
248  /// Append first n characters of wide character string s to this string
249  FXString& append(const FXwchar* s,FXint n);
250 
251  /// Append first n characters of narrow character string s to this string
252  FXString& append(const FXnchar* s,FXint n);
253 
254  /// Append string s to this string
255  FXString& append(const FXchar* s);
256 
257  /// Append wide character string s to this string
258  FXString& append(const FXwchar* s);
259 
260  /// Append narrow character string s to this string
261  FXString& append(const FXnchar* s);
262 
263  /// Append string s to this string
264  FXString& append(const FXString& s);
265 
266  /// Replace a single character
267  FXString& replace(FXint pos,FXchar c);
268 
269  /// Replace the m characters at pos with n characters c
270  FXString& replace(FXint pos,FXint m,FXchar c,FXint n);
271 
272  /// Replaces the m characters at pos with first n characters of string s
273  FXString& replace(FXint pos,FXint m,const FXchar* s,FXint n);
274 
275  /// Replaces the m characters at pos with first n characters of wide character string s
276  FXString& replace(FXint pos,FXint m,const FXwchar* s,FXint n);
277 
278  /// Replaces the m characters at pos with first n characters of narrow character string s
279  FXString& replace(FXint pos,FXint m,const FXnchar* s,FXint n);
280 
281  /// Replace the m characters at pos with string s
282  FXString& replace(FXint pos,FXint m,const FXchar* s);
283 
284  /// Replace the m characters at pos with wide character string s
285  FXString& replace(FXint pos,FXint m,const FXwchar* s);
286 
287  /// Replace the m characters at pos with narrow character string s
288  FXString& replace(FXint pos,FXint m,const FXnchar* s);
289 
290  /// Replace the m characters at pos with string s
291  FXString& replace(FXint pos,FXint m,const FXString& s);
292 
293  /// Move range of m characters from src position to dst position
294  FXString& move(FXint dst,FXint src,FXint n);
295 
296  /// Remove one character
297  FXString& erase(FXint pos);
298 
299  /// Remove substring
300  FXString& erase(FXint pos,FXint n);
301 
302  /// Return number of occurrences of ch in string
303  FXint contains(FXchar ch) const;
304 
305  /// Return number of occurrences of string sub in string
306  FXint contains(const FXchar* sub,FXint n) const;
307 
308  /// Return number of occurrences of string sub in string
309  FXint contains(const FXchar* sub) const;
310 
311  /// Return number of occurrences of string sub in string
312  FXint contains(const FXString& sub) const;
313 
314  /// Substitute one character by another
315  FXString& substitute(FXchar org,FXchar sub,bool all=true);
316 
317  /// Substitute one string by another
318  FXString& substitute(const FXchar* org,FXint olen,const FXchar *rep,FXint rlen,bool all=true);
319 
320  /// Substitute one string by another
321  FXString& substitute(const FXchar* org,const FXchar *rep,bool all=true);
322 
323  /// Substitute one string by another
324  FXString& substitute(const FXString& org,const FXString& rep,bool all=true);
325 
326  /// Simplify whitespace in string
327  FXString& simplify();
328 
329  /// Remove leading and trailing whitespace
330  FXString& trim();
331 
332  /// Remove leading whitespace
333  FXString& trimBegin();
334 
335  /// Remove trailing whitespace
336  FXString& trimEnd();
337 
338  /// Truncate string at pos
339  FXString& trunc(FXint pos);
340 
341  /// Clear
342  FXString& clear();
343 
344  /// Get left most part
345  FXString left(FXint n) const;
346 
347  /// Get right most part
348  FXString right(FXint n) const;
349 
350  /// Get some part in the middle
351  FXString mid(FXint pos,FXint n) const;
352 
353  /**
354  * Return all characters before the n-th occurrence of ch,
355  * searching from the beginning of the string. If the character
356  * is not found, return the entire string. If n<=0, return
357  * the empty string.
358  */
359  FXString before(FXchar ch,FXint n=1) const;
360 
361  /**
362  * Return all characters before the n-th occurrence of ch,
363  * searching from the end of the string. If the character
364  * is not found, return the empty string. If n<=0, return
365  * the entire string.
366  */
367  FXString rbefore(FXchar ch,FXint n=1) const;
368 
369  /**
370  * Return all characters after the nth occurrence of ch,
371  * searching from the beginning of the string. If the character
372  * is not found, return the empty string. If n<=0, return
373  * the entire string.
374  */
375  FXString after(FXchar ch,FXint n=1) const;
376 
377  /**
378  * Return all characters after the nth occurrence of ch,
379  * searching from the end of the string. If the character
380  * is not found, return the entire string. If n<=0, return
381  * the empty string.
382  */
383  FXString rafter(FXchar ch,FXint n=1) const;
384 
385  /// Find a character, searching forward; return position or -1
386  FXint find(FXchar c,FXint pos=0) const;
387 
388  /// Find a character, searching backward; return position or -1
389  FXint rfind(FXchar c,FXint pos=2147483647) const;
390 
391  /// Find n-th occurrence of character, searching forward; return position or -1
392  FXint find(FXchar c,FXint pos,FXint n) const;
393 
394  /// Find n-th occurrence of character, searching backward; return position or -1
395  FXint rfind(FXchar c,FXint pos,FXint n) const;
396 
397  /// Find a substring of length n, searching forward; return position or -1
398  FXint find(const FXchar* substr,FXint n,FXint pos) const;
399 
400  /// Find a substring of length n, searching backward; return position or -1
401  FXint rfind(const FXchar* substr,FXint n,FXint pos) const;
402 
403  /// Find a substring, searching forward; return position or -1
404  FXint find(const FXchar* substr,FXint pos=0) const;
405 
406  /// Find a substring, searching backward; return position or -1
407  FXint rfind(const FXchar* substr,FXint pos=2147483647) const;
408 
409  /// Find a substring, searching forward; return position or -1
410  FXint find(const FXString& substr,FXint pos=0) const;
411 
412  /// Find a substring, searching backward; return position or -1
413  FXint rfind(const FXString& substr,FXint pos=2147483647) const;
414 
415  /// Find first character in the set of size n, starting from pos; return position or -1
416  FXint find_first_of(const FXchar* set,FXint n,FXint pos) const;
417 
418  /// Find first character in the set, starting from pos; return position or -1
419  FXint find_first_of(const FXchar* set,FXint pos=0) const;
420 
421  /// Find first character in the set, starting from pos; return position or -1
422  FXint find_first_of(const FXString& set,FXint pos=0) const;
423 
424  /// Find first character, starting from pos; return position or -1
425  FXint find_first_of(FXchar c,FXint pos=0) const;
426 
427  /// Find last character in the set of size n, starting from pos; return position or -1
428  FXint find_last_of(const FXchar* set,FXint n,FXint pos) const;
429 
430  /// Find last character in the set, starting from pos; return position or -1
431  FXint find_last_of(const FXchar* set,FXint pos=2147483647) const;
432 
433  /// Find last character in the set, starting from pos; return position or -1
434  FXint find_last_of(const FXString& set,FXint pos=2147483647) const;
435 
436  /// Find last character, starting from pos; return position or -1
437  FXint find_last_of(FXchar c,FXint pos=0) const;
438 
439  /// Find first character NOT in the set of size n, starting from pos; return position or -1
440  FXint find_first_not_of(const FXchar* set,FXint n,FXint pos) const;
441 
442  /// Find first character NOT in the set, starting from pos; return position or -1
443  FXint find_first_not_of(const FXchar* set,FXint pos=0) const;
444 
445  /// Find first character NOT in the set, starting from pos; return position or -1
446  FXint find_first_not_of(const FXString& set,FXint pos=0) const;
447 
448  /// Find first character NOT equal to c, starting from pos; return position or -1
449  FXint find_first_not_of(FXchar c,FXint pos=0) const;
450 
451  /// Find last character NOT in the set of size n, starting from pos; return position or -1
452  FXint find_last_not_of(const FXchar* set,FXint n,FXint pos) const;
453 
454  /// Find last character NOT in the set, starting from pos; return position or -1
455  FXint find_last_not_of(const FXchar* set,FXint pos=2147483647) const;
456 
457  /// Find last character NOT in the set, starting from pos; return position or -1
458  FXint find_last_not_of(const FXString& set,FXint pos=2147483647) const;
459 
460  /// Find last character NOT equal to c, starting from pos; return position or -1
461  FXint find_last_not_of(FXchar c,FXint pos=0) const;
462 
463  /// Format a string a-la printf
464  FXString& format(const FXchar* fmt,...) FX_PRINTF(2,3) ;
465  FXString& vformat(const FXchar* fmt,va_list args);
466 
467  /// Scan a string a-la scanf
468  FXint scan(const FXchar* fmt,...) const FX_SCANF(2,3) ;
469  FXint vscan(const FXchar* fmt,va_list args) const;
470 
471  /// Get hash value
472  FXuint hash() const;
473 
474  /// Compare
475  friend FXAPI FXint compare(const FXchar* s1,const FXchar* s2);
476  friend FXAPI FXint compare(const FXchar* s1,const FXString& s2);
477  friend FXAPI FXint compare(const FXString& s1,const FXchar* s2);
478  friend FXAPI FXint compare(const FXString& s1,const FXString& s2);
479 
480  /// Compare up to n
481  friend FXAPI FXint compare(const FXchar* s1,const FXchar* s2,FXint n);
482  friend FXAPI FXint compare(const FXchar* s1,const FXString& s2,FXint n);
483  friend FXAPI FXint compare(const FXString& s1,const FXchar* s2,FXint n);
484  friend FXAPI FXint compare(const FXString& s1,const FXString& s2,FXint n);
485 
486  /// Compare case insensitive
487  friend FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2);
488  friend FXAPI FXint comparecase(const FXchar* s1,const FXString& s2);
489  friend FXAPI FXint comparecase(const FXString& s1,const FXchar* s2);
490  friend FXAPI FXint comparecase(const FXString& s1,const FXString& s2);
491 
492  /// Compare case insensitive up to n
493  friend FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2,FXint n);
494  friend FXAPI FXint comparecase(const FXchar* s1,const FXString& s2,FXint n);
495  friend FXAPI FXint comparecase(const FXString& s1,const FXchar* s2,FXint n);
496  friend FXAPI FXint comparecase(const FXString& s1,const FXString& s2,FXint n);
497 
498  /// Compare with numeric interpretation
499  friend FXAPI FXint compareversion(const FXchar* s1,const FXchar* s2);
500  friend FXAPI FXint compareversion(const FXchar* s1,const FXString& s2);
501  friend FXAPI FXint compareversion(const FXString& s1,const FXchar* s2);
502  friend FXAPI FXint compareversion(const FXString& s1,const FXString& s2);
503 
504  /// Comparison operators
505  friend FXAPI bool operator==(const FXString& s1,const FXString& s2);
506  friend FXAPI bool operator==(const FXString& s1,const FXchar* s2);
507  friend FXAPI bool operator==(const FXchar* s1,const FXString& s2);
508 
509  friend FXAPI bool operator!=(const FXString& s1,const FXString& s2);
510  friend FXAPI bool operator!=(const FXString& s1,const FXchar* s2);
511  friend FXAPI bool operator!=(const FXchar* s1,const FXString& s2);
512 
513  friend FXAPI bool operator<(const FXString& s1,const FXString& s2);
514  friend FXAPI bool operator<(const FXString& s1,const FXchar* s2);
515  friend FXAPI bool operator<(const FXchar* s1,const FXString& s2);
516 
517  friend FXAPI bool operator<=(const FXString& s1,const FXString& s2);
518  friend FXAPI bool operator<=(const FXString& s1,const FXchar* s2);
519  friend FXAPI bool operator<=(const FXchar* s1,const FXString& s2);
520 
521  friend FXAPI bool operator>(const FXString& s1,const FXString& s2);
522  friend FXAPI bool operator>(const FXString& s1,const FXchar* s2);
523  friend FXAPI bool operator>(const FXchar* s1,const FXString& s2);
524 
525  friend FXAPI bool operator>=(const FXString& s1,const FXString& s2);
526  friend FXAPI bool operator>=(const FXString& s1,const FXchar* s2);
527  friend FXAPI bool operator>=(const FXchar* s1,const FXString& s2);
528 
529  /// Append operators
530  FXString& operator+=(const FXString& s);
531  FXString& operator+=(const FXchar* s);
532  FXString& operator+=(const FXwchar* s);
533  FXString& operator+=(const FXnchar* s);
534  FXString& operator+=(FXchar c);
535 
536  /// Concatenate one FXString with another
537  friend FXAPI FXString operator+(const FXString& s1,const FXString& s2);
538 
539  /// Concatenate FXString and a string
540  friend FXAPI FXString operator+(const FXString& s1,const FXchar* s2);
541  friend FXAPI FXString operator+(const FXString& s1,const FXwchar* s2);
542  friend FXAPI FXString operator+(const FXString& s1,const FXnchar* s2);
543 
544  /// Concatenate string and FXString
545  friend FXAPI FXString operator+(const FXchar* s1,const FXString& s2);
546  friend FXAPI FXString operator+(const FXwchar* s1,const FXString& s2);
547  friend FXAPI FXString operator+(const FXnchar* s1,const FXString& s2);
548 
549  /// Concatenate string and single character
550  friend FXAPI FXString operator+(const FXString& s,FXchar c);
551  friend FXAPI FXString operator+(FXchar c,const FXString& s);
552 
553  /// Saving to a stream
554  friend FXAPI FXStream& operator<<(FXStream& store,const FXString& s);
555 
556  /// Load from a stream
557  friend FXAPI FXStream& operator>>(FXStream& store,FXString& s);
558 
559  /// Format a string a-la printf
560  friend FXAPI FXString FXStringFormat(const FXchar* fmt,...) FX_PRINTF(1,2) ;
561  friend FXAPI FXString FXStringVFormat(const FXchar* fmt,va_list args);
562 
563  /**
564  * Convert integer number to a string, using the given number
565  * base, which must be between 2 and 16.
566  */
567  friend FXAPI FXString FXStringVal(FXint num,FXint base);
568  friend FXAPI FXString FXStringVal(FXuint num,FXint base);
569 
570  /**
571  * Convert long integer number to a string, using the given number
572  * base, which must be between 2 and 16.
573  */
574  friend FXAPI FXString FXStringVal(FXlong num,FXint base);
575  friend FXAPI FXString FXStringVal(FXulong num,FXint base);
576 
577  /**
578  * Convert real number to a string, using the given procision and
579  * exponential notation mode, which may be FALSE (never), TRUE (always), or
580  * MAYBE (when needed).
581  */
582  friend FXAPI FXString FXStringVal(FXfloat num,FXint prec,FXint exp);
583  friend FXAPI FXString FXStringVal(FXdouble num,FXint prec,FXint exp);
584 
585  /// Convert string to a integer number, assuming given number base
586  friend FXAPI FXint FXIntVal(const FXString& s,FXint base);
587  friend FXAPI FXuint FXUIntVal(const FXString& s,FXint base);
588 
589  /// Convert string to long integer number, assuming given number base
590  friend FXAPI FXlong FXLongVal(const FXString& s,FXint base);
591  friend FXAPI FXulong FXULongVal(const FXString& s,FXint base);
592 
593  /// Convert string into real number
594  friend FXAPI FXfloat FXFloatVal(const FXString& s);
595  friend FXAPI FXdouble FXDoubleVal(const FXString& s);
596 
597  /// Return utf8 from ascii containing unicode escapes
598  friend FXAPI FXString fromAscii(const FXString& s);
599 
600  /// Return ascii containing unicode escapes from utf8
601  friend FXAPI FXString toAscii(const FXString& s);
602 
603  /// Escape special characters in a string
604  friend FXAPI FXString escape(const FXString& s);
605 
606  /// Unescape special characters in a string
607  friend FXAPI FXString unescape(const FXString& s);
608 
609  /// Return normalized string, i.e. reordering of diacritical marks
610  friend FXAPI FXString normalize(const FXString& s);
611 
612  /// Return normalized decomposition of string
613  friend FXAPI FXString decompose(const FXString& s,FXuint kind);
614 
615  /// Return normalized composition of string; this first performs normalized decomposition
616  friend FXAPI FXString compose(const FXString& s,FXuint kind);
617 
618  /// Swap two strings
619  friend inline void swap(FXString& a,FXString& b);
620 
621  /// Convert to and from dos
622  friend FXAPI FXString& unixToDos(FXString& str);
623  friend FXAPI FXString& dosToUnix(FXString& str);
624 
625  /// Delete
626  ~FXString();
627  };
629 
630 inline void swap(FXString& a,FXString& b){ FXchar *t=a.str; a.str=b.str; b.str=t; }
631 
632 extern FXAPI FXint compare(const FXchar* s1,const FXchar* s2);
633 extern FXAPI FXint compare(const FXchar* s1,const FXString& s2);
634 extern FXAPI FXint compare(const FXString& s1,const FXchar* s2);
635 extern FXAPI FXint compare(const FXString& s1,const FXString& s2);
636 
637 extern FXAPI FXint compare(const FXchar* s1,const FXchar* s2,FXint n);
638 extern FXAPI FXint compare(const FXchar* s1,const FXString& s2,FXint n);
639 extern FXAPI FXint compare(const FXString& s1,const FXchar* s2,FXint n);
640 extern FXAPI FXint compare(const FXString& s1,const FXString& s2,FXint n);
641 
642 extern FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2);
643 extern FXAPI FXint comparecase(const FXchar* s1,const FXString& s2);
644 extern FXAPI FXint comparecase(const FXString& s1,const FXchar* s2);
645 extern FXAPI FXint comparecase(const FXString& s1,const FXString& s2);
646 
647 extern FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2,FXint n);
648 extern FXAPI FXint comparecase(const FXchar* s1,const FXString& s2,FXint n);
649 extern FXAPI FXint comparecase(const FXString& s1,const FXchar* s2,FXint n);
650 extern FXAPI FXint comparecase(const FXString& s1,const FXString& s2,FXint n);
651 
652 extern FXAPI FXint compareversion(const FXchar* s1,const FXchar* s2);
653 extern FXAPI FXint compareversion(const FXchar* s1,const FXString& s2);
654 extern FXAPI FXint compareversion(const FXString& s1,const FXchar* s2);
655 extern FXAPI FXint compareversion(const FXString& s1,const FXString& s2);
656 
657 extern FXAPI bool operator==(const FXString& s1,const FXString& s2);
658 extern FXAPI bool operator==(const FXString& s1,const FXchar* s2);
659 extern FXAPI bool operator==(const FXchar* s1,const FXString& s2);
660 
661 extern FXAPI bool operator!=(const FXString& s1,const FXString& s2);
662 extern FXAPI bool operator!=(const FXString& s1,const FXchar* s2);
663 extern FXAPI bool operator!=(const FXchar* s1,const FXString& s2);
664 
665 extern FXAPI bool operator<(const FXString& s1,const FXString& s2);
666 extern FXAPI bool operator<(const FXString& s1,const FXchar* s2);
667 extern FXAPI bool operator<(const FXchar* s1,const FXString& s2);
668 
669 extern FXAPI bool operator<=(const FXString& s1,const FXString& s2);
670 extern FXAPI bool operator<=(const FXString& s1,const FXchar* s2);
671 extern FXAPI bool operator<=(const FXchar* s1,const FXString& s2);
672 
673 extern FXAPI bool operator>(const FXString& s1,const FXString& s2);
674 extern FXAPI bool operator>(const FXString& s1,const FXchar* s2);
675 extern FXAPI bool operator>(const FXchar* s1,const FXString& s2);
676 
677 extern FXAPI bool operator>=(const FXString& s1,const FXString& s2);
678 extern FXAPI bool operator>=(const FXString& s1,const FXchar* s2);
679 extern FXAPI bool operator>=(const FXchar* s1,const FXString& s2);
680 
681 extern FXAPI FXString operator+(const FXString& s1,const FXString& s2);
682 
683 extern FXAPI FXString operator+(const FXString& s1,const FXchar* s2);
684 extern FXAPI FXString operator+(const FXString& s1,const FXwchar* s2);
685 extern FXAPI FXString operator+(const FXString& s1,const FXnchar* s2);
686 
687 extern FXAPI FXString operator+(const FXchar* s1,const FXString& s2);
688 extern FXAPI FXString operator+(const FXwchar* s1,const FXString& s2);
689 extern FXAPI FXString operator+(const FXnchar* s1,const FXString& s2);
690 
691 extern FXAPI FXString operator+(const FXString& s,FXchar c);
692 extern FXAPI FXString operator+(FXchar c,const FXString& s);
693 
694 extern FXAPI FXStream& operator<<(FXStream& store,const FXString& s);
695 extern FXAPI FXStream& operator>>(FXStream& store,FXString& s);
696 
697 extern FXAPI FXString FXStringFormat(const FXchar* fmt,...) FX_PRINTF(1,2) ;
698 extern FXAPI FXString FXStringVFormat(const FXchar* fmt,va_list args);
699 
700 extern FXAPI FXString FXStringVal(FXint num,FXint base=10);
701 extern FXAPI FXString FXStringVal(FXuint num,FXint base=10);
702 extern FXAPI FXString FXStringVal(FXlong num,FXint base=10);
703 extern FXAPI FXString FXStringVal(FXulong num,FXint base=10);
704 extern FXAPI FXString FXStringVal(FXfloat num,FXint prec=6,FXint exp=MAYBE);
705 extern FXAPI FXString FXStringVal(FXdouble num,FXint prec=6,FXint exp=MAYBE);
706 
707 extern FXAPI FXint FXIntVal(const FXString& s,FXint base=10);
708 extern FXAPI FXuint FXUIntVal(const FXString& s,FXint base=10);
709 extern FXAPI FXlong FXLongVal(const FXString& s,FXint base=10);
710 extern FXAPI FXulong FXULongVal(const FXString& s,FXint base=10);
711 extern FXAPI FXfloat FXFloatVal(const FXString& s);
712 extern FXAPI FXdouble FXDoubleVal(const FXString& s);
713 
714 extern FXAPI FXString fromAscii(const FXString& s);
715 extern FXAPI FXString toAscii(const FXString& s);
716 
717 extern FXAPI FXString escape(const FXString& s);
718 extern FXAPI FXString unescape(const FXString& s);
719 
720 extern FXAPI FXString normalize(const FXString& s);
721 extern FXAPI FXString decompose(const FXString& s,FXuint kind);
722 extern FXAPI FXString compose(const FXString& s,FXuint kind);
723 
724 extern FXAPI FXString& unixToDos(FXString& str);
725 extern FXAPI FXString& dosToUnix(FXString& str);
726 
727 }
728 
729 #endif
FXStream & operator>>(FXStream &store, FXDate &d)
FXint comparecase(const FXchar *s1, const FXchar *s2)
char FXchar
Definition: fxdefs.h:387
FXString fromAscii(const FXString &s)
FXString & dosToUnix(FXString &str)
FXString escape(const FXString &s)
unsigned int FXuint
Definition: fxdefs.h:396
FXString compose(const FXString &s, FXuint kind)
#define FX_SCANF(fmt, arg)
Definition: fxdefs.h:147
unsigned short FXnchar
Definition: fxdefs.h:412
FXint compare(const FXchar *s1, const FXchar *s2)
#define FXAPI
Definition: fxdefs.h:122
FXdouble FXDoubleVal(const FXString &s)
FXString toAscii(const FXString &s)
bool operator<=(const FXString &s1, const FXString &s2)
FXuint FXUIntVal(const FXString &s, FXint base=10)
bool operator>=(const FXString &s1, const FXString &s2)
FXfloat FXFloatVal(const FXString &s)
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
FXString normalize(const FXString &s)
double FXdouble
Definition: fxdefs.h:399
wchar_t FXwchar
Definition: fxdefs.h:411
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
FXString FXString FXStringVFormat(const FXchar *fmt, va_list args)
void swap(FXString &a, FXString &b)
Definition: FXString.h:628
FXDate operator+(const FXDate &d, FXint x)
Definition: FXDate.h:148
FXint FXIntVal(const FXString &s, FXint base=10)
FXString & unixToDos(FXString &str)
bool operator<(const FXString &s1, const FXString &s2)
FXString FXStringFormat(const FXchar *fmt,...) FX_PRINTF(1
FXlong FXLongVal(const FXString &s, FXint base=10)
FXint compareversion(const FXchar *s1, const FXchar *s2)
unsigned char FXuchar
Definition: fxdefs.h:392
bool operator>(const FXString &s1, const FXString &s2)
FXString unescape(const FXString &s)
float FXfloat
Definition: fxdefs.h:398
FXwchar wc(const FXchar *ptr)
Return wide character from utf8 string at ptr.
FXString decompose(const FXString &s, FXuint kind)
#define FX_PRINTF(fmt, arg)
Definition: fxdefs.h:146
FXStream & operator<<(FXStream &store, const FXDate &d)
FXString simplify(const FXString &file)
Simplify a file path; the path will remain relative if it was relative, or absolute if it was absolut...
FXulong FXULongVal(const FXString &s, FXint base=10)
bool operator!=(const FXString &s1, const FXString &s2)
FXString FXStringVal(FXint num, FXint base=10)
bool operator==(const FXString &s1, const FXString &s2)
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp