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

FXString.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                           S t r i n g   O b j e c t                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXString.h,v 1.151 2009/01/06 13:07:27 fox Exp $                         *
00022 ********************************************************************************/
00023 #ifndef FXSTRING_H
00024 #define FXSTRING_H
00025 
00026 namespace FX {
00027 
00028 
00029 class FXStream;
00030 
00031 
00032 /**
00033 * FXString provides essential string manipulation capabilities.
00034 */
00035 class FXAPI FXString {
00036 private:
00037   FXchar* str;
00038 public:
00039   static const FXchar null[];
00040 public:
00041   static const FXchar      value2Digit[36];
00042   static const signed char digit2Value[256];
00043 public:
00044   static const signed char utfBytes[256];
00045 public:
00046 
00047   /// Create empty string
00048   FXString();
00049 
00050   /// Copy construct
00051   FXString(const FXString& s);
00052 
00053   /// Construct and init from string
00054   FXString(const FXchar* s);
00055 
00056   /// Construct and init from wide character string
00057   FXString(const FXwchar* s);
00058 
00059   /// Construct and init from narrow character string
00060   FXString(const FXnchar* s);
00061 
00062   /// Construct and init with substring
00063   FXString(const FXchar* s,FXint n);
00064 
00065   /// Construct and init with wide character substring
00066   FXString(const FXwchar* s,FXint n);
00067 
00068   /// Construct and init with narrow character substring
00069   FXString(const FXnchar* s,FXint n);
00070 
00071   /// Construct and fill with constant
00072   FXString(FXchar c,FXint n);
00073 
00074   /// Length of text in bytes
00075   FXint length() const { return *(((FXint*)str)-1); }
00076 
00077   /// Change the length of the string to len
00078   void length(FXint len);
00079 
00080   /// Count number of utf8 characters
00081   FXint count() const;
00082 
00083   /// Count number of utf8 characters in subrange start...end
00084   FXint count(FXint start,FXint end) const;
00085 
00086   /// Return byte offset of utf8 character at index
00087   FXint offset(FXint indx) const;
00088 
00089   /// Return index of utf8 character at byte offset
00090   FXint index(FXint offs) const;
00091 
00092   /// Validate position to point to begin of utf8 character
00093   FXint validate(FXint p) const;
00094 
00095   /// Return extent of utf8 character at position
00096   FXint extent(FXint p) const { return utfBytes[(FXuchar)str[p]]; }
00097 
00098   /// Increment byte offset by one utf8 character
00099   FXint inc(FXint p) const;
00100 
00101   /// Increment byte offset by n utf8 characters
00102   FXint inc(FXint p,FXint n) const;
00103 
00104   /// Decrement byte offset by one utf8 character
00105   FXint dec(FXint p) const;
00106 
00107   /// Decrement byte offset by n utf8 characters
00108   FXint dec(FXint p,FXint n) const;
00109 
00110   /// Get text contents
00111   const FXchar* text() const { return (const FXchar*)str; }
00112 
00113   /// See if string is empty
00114   FXbool empty() const { return (((FXint*)str)[-1]==0); }
00115 
00116   /// See if string is empty
00117   FXbool operator!() const { return (((FXint*)str)[-1]==0); }
00118 
00119   /// Return a non-const reference to the ith character
00120   FXchar& operator[](FXint i){ return str[i]; }
00121 
00122   /// Return a const reference to the ith character
00123   const FXchar& operator[](FXint i) const { return str[i]; }
00124 
00125   /// Return a non-const reference to the ith character
00126   FXchar& at(FXint i){ return str[i]; }
00127 
00128   /// Return a const reference to the ith character
00129   const FXchar& at(FXint i) const { return str[i]; }
00130 
00131   /// Return a non-const reference to the first character
00132   FXchar& head(){ return str[0]; }
00133 
00134   /// Return a const reference to the first character
00135   const FXchar& head() const { return str[0]; }
00136 
00137   /// Return a non-const reference to the last character
00138   FXchar& tail(){ return str[length()-1]; }
00139 
00140   /// Return a const reference to the last character
00141   const FXchar& tail() const { return str[length()-1]; }
00142 
00143   /// Return wide character starting at offset i
00144   FXwchar wc(FXint i) const;
00145 
00146   /// Assign a string to this
00147   FXString& operator=(const FXchar* s);
00148 
00149   /// Assign a wide character string to this
00150   FXString& operator=(const FXwchar* s);
00151 
00152   /// Assign a narrow character string to this
00153   FXString& operator=(const FXnchar* s);
00154 
00155   /// Assign another string to this
00156   FXString& operator=(const FXString& s);
00157 
00158   /// Convert to lower case
00159   FXString& lower();
00160 
00161   /// Convert to upper case
00162   FXString& upper();
00163 
00164   /// Return num partition(s) from a given start partition in a string separated by delimiters delim.
00165   FXString section(FXchar delim,FXint start,FXint num=1) const;
00166 
00167   /// Return num partition(s) from a given start partition in a string separated by set of delimiters from delim of size n
00168   FXString section(const FXchar* delim,FXint n,FXint start,FXint num) const;
00169 
00170   /// Return num partition(s) from a given start partition in a string separated by set of delimiters from delim.
00171   FXString section(const FXchar* delim,FXint start,FXint num=1) const;
00172 
00173   /// Return num partition(s) from a given start partition in a string separated by set of delimiters from delim.
00174   FXString section(const FXString& delim,FXint start,FXint num=1) const;
00175 
00176   /// Adopt string s, leaving s empty
00177   FXString& adopt(FXString& s);
00178 
00179   /// Assign character c to this string
00180   FXString& assign(FXchar c);
00181 
00182   /// Assign n characters c to this string
00183   FXString& assign(FXchar c,FXint n);
00184 
00185   /// Assign first n characters of string s to this string
00186   FXString& assign(const FXchar *s,FXint n);
00187 
00188   /// Assign first n characters of wide character string s to this string
00189   FXString& assign(const FXwchar *s,FXint n);
00190 
00191   /// Assign first n characters of narrow character string s to this string
00192   FXString& assign(const FXnchar *s,FXint n);
00193 
00194   /// Assign string s to this string
00195   FXString& assign(const FXchar* s);
00196 
00197   /// Assign wide character string s to this string
00198   FXString& assign(const FXwchar* s);
00199 
00200   /// Assign narrow character string s to this string
00201   FXString& assign(const FXnchar* s);
00202 
00203   /// Assign string s to this string
00204   FXString& assign(const FXString& s);
00205 
00206   /// Insert character at specified position
00207   FXString& insert(FXint pos,FXchar c);
00208 
00209   /// Insert n characters c at specified position
00210   FXString& insert(FXint pos,FXchar c,FXint n);
00211 
00212   /// Insert first n characters of string at specified position
00213   FXString& insert(FXint pos,const FXchar* s,FXint n);
00214 
00215   /// Insert first n characters of wide character string at specified position
00216   FXString& insert(FXint pos,const FXwchar* s,FXint n);
00217 
00218   /// Insert first n characters of narrow character string at specified position
00219   FXString& insert(FXint pos,const FXnchar* s,FXint n);
00220 
00221   /// Insert string at specified position
00222   FXString& insert(FXint pos,const FXchar* s);
00223 
00224   /// Insert wide character string at specified position
00225   FXString& insert(FXint pos,const FXwchar* s);
00226 
00227   /// Insert narrow character string at specified position
00228   FXString& insert(FXint pos,const FXnchar* s);
00229 
00230   /// Insert string at specified position
00231   FXString& insert(FXint pos,const FXString& s);
00232 
00233   /// Prepend string with input character
00234   FXString& prepend(FXchar c);
00235 
00236   /// Prepend string with n characters c
00237   FXString& prepend(FXchar c,FXint n);
00238 
00239   /// Prepend first n characters of string s
00240   FXString& prepend(const FXchar* s,FXint n);
00241 
00242   /// Prepend first n characters of wide character string s
00243   FXString& prepend(const FXwchar* s,FXint n);
00244 
00245   /// Prepend first n characters of narrow character string s
00246   FXString& prepend(const FXnchar* s,FXint n);
00247 
00248   /// Prepend string with string s
00249   FXString& prepend(const FXchar* s);
00250 
00251   /// Prepend string with wide character string
00252   FXString& prepend(const FXwchar* s);
00253 
00254   /// Prepend string with narrow character string
00255   FXString& prepend(const FXnchar* s);
00256 
00257   /// Prepend string with string s
00258   FXString& prepend(const FXString& s);
00259 
00260   /// Append character c to this string
00261   FXString& append(FXchar c);
00262 
00263   /// Append n characters c to this string
00264   FXString& append(FXchar c,FXint n);
00265 
00266   /// Append first n characters of string s to this string
00267   FXString& append(const FXchar* s,FXint n);
00268 
00269   /// Append first n characters of wide character string s to this string
00270   FXString& append(const FXwchar* s,FXint n);
00271 
00272   /// Append first n characters of narrow character string s to this string
00273   FXString& append(const FXnchar* s,FXint n);
00274 
00275   /// Append string s to this string
00276   FXString& append(const FXchar* s);
00277 
00278   /// Append wide character string s to this string
00279   FXString& append(const FXwchar* s);
00280 
00281   /// Append narrow character string s to this string
00282   FXString& append(const FXnchar* s);
00283 
00284   /// Append string s to this string
00285   FXString& append(const FXString& s);
00286 
00287   /// Replace a single character
00288   FXString& replace(FXint pos,FXchar c);
00289 
00290   /// Replace the m characters at pos with n characters c
00291   FXString& replace(FXint pos,FXint m,FXchar c,FXint n);
00292 
00293   /// Replaces the m characters at pos with first n characters of string s
00294   FXString& replace(FXint pos,FXint m,const FXchar* s,FXint n);
00295 
00296   /// Replaces the m characters at pos with first n characters of wide character string s
00297   FXString& replace(FXint pos,FXint m,const FXwchar* s,FXint n);
00298 
00299   /// Replaces the m characters at pos with first n characters of narrow character string s
00300   FXString& replace(FXint pos,FXint m,const FXnchar* s,FXint n);
00301 
00302   /// Replace the m characters at pos with string s
00303   FXString& replace(FXint pos,FXint m,const FXchar* s);
00304 
00305   /// Replace the m characters at pos with wide character string s
00306   FXString& replace(FXint pos,FXint m,const FXwchar* s);
00307 
00308   /// Replace the m characters at pos with narrow character string s
00309   FXString& replace(FXint pos,FXint m,const FXnchar* s);
00310 
00311   /// Replace the m characters at pos with string s
00312   FXString& replace(FXint pos,FXint m,const FXString& s);
00313 
00314   /// Move range of m characters from src position to dst position
00315   FXString& move(FXint dst,FXint src,FXint n);
00316 
00317   /// Remove one character
00318   FXString& erase(FXint pos);
00319 
00320   /// Remove substring
00321   FXString& erase(FXint pos,FXint n);
00322 
00323   /// Return number of occurrences of ch in string
00324   FXint contains(FXchar ch) const;
00325 
00326   /// Return number of occurrences of string sub in string
00327   FXint contains(const FXchar* sub,FXint n) const;
00328 
00329   /// Return number of occurrences of string sub in string
00330   FXint contains(const FXchar* sub) const;
00331 
00332   /// Return number of occurrences of string sub in string
00333   FXint contains(const FXString& sub) const;
00334 
00335   /// Substitute one character by another
00336   FXString& substitute(FXchar org,FXchar sub,FXbool all=true);
00337 
00338   /// Substitute one string by another
00339   FXString& substitute(const FXchar* org,FXint olen,const FXchar *rep,FXint rlen,FXbool all=true);
00340 
00341   /// Substitute one string by another
00342   FXString& substitute(const FXchar* org,const FXchar *rep,FXbool all=true);
00343 
00344   /// Substitute one string by another
00345   FXString& substitute(const FXString& org,const FXString& rep,FXbool all=true);
00346 
00347   /// Simplify whitespace in string
00348   FXString& simplify();
00349 
00350   /// Remove leading and trailing whitespace
00351   FXString& trim();
00352 
00353   /// Remove leading whitespace
00354   FXString& trimBegin();
00355 
00356   /// Remove trailing whitespace
00357   FXString& trimEnd();
00358 
00359   /// Truncate string at pos
00360   FXString& trunc(FXint pos);
00361 
00362   /// Clear
00363   FXString& clear();
00364 
00365   /// Get left most part
00366   FXString left(FXint n) const;
00367 
00368   /// Get right most part
00369   FXString right(FXint n) const;
00370 
00371   /// Get some part in the middle
00372   FXString mid(FXint pos,FXint n) const;
00373 
00374   /**
00375   * Return all characters before the n-th occurrence of ch,
00376   * searching from the beginning of the string. If the character
00377   * is not found, return the entire string.  If n<=0, return
00378   * the empty string.
00379   */
00380   FXString before(FXchar ch,FXint n=1) const;
00381 
00382   /**
00383   * Return all characters before the n-th occurrence of ch,
00384   * searching from the end of the string. If the character
00385   * is not found, return the empty string. If n<=0, return
00386   * the entire string.
00387   */
00388   FXString rbefore(FXchar ch,FXint n=1) const;
00389 
00390   /**
00391   * Return all characters after the nth occurrence of ch,
00392   * searching from the beginning of the string. If the character
00393   * is not found, return the empty string.  If n<=0, return
00394   * the entire string.
00395   */
00396   FXString after(FXchar ch,FXint n=1) const;
00397 
00398   /**
00399   * Return all characters after the nth occurrence of ch,
00400   * searching from the end of the string. If the character
00401   * is not found, return the entire string. If n<=0, return
00402   * the empty string.
00403   */
00404   FXString rafter(FXchar ch,FXint n=1) const;
00405 
00406   /// Find a character, searching forward; return position or -1
00407   FXint find(FXchar c,FXint pos=0) const;
00408 
00409   /// Find a character, searching backward; return position or -1
00410   FXint rfind(FXchar c,FXint pos=2147483647) const;
00411 
00412   /// Find n-th occurrence of character, searching forward; return position or -1
00413   FXint find(FXchar c,FXint pos,FXint n) const;
00414 
00415   /// Find n-th occurrence of character, searching backward; return position or -1
00416   FXint rfind(FXchar c,FXint pos,FXint n) const;
00417 
00418   /// Find a substring of length n, searching forward; return position or -1
00419   FXint find(const FXchar* substr,FXint n,FXint pos) const;
00420 
00421   /// Find a substring of length n, searching backward; return position or -1
00422   FXint rfind(const FXchar* substr,FXint n,FXint pos) const;
00423 
00424   /// Find a substring, searching forward; return position or -1
00425   FXint find(const FXchar* substr,FXint pos=0) const;
00426 
00427   /// Find a substring, searching backward; return position or -1
00428   FXint rfind(const FXchar* substr,FXint pos=2147483647) const;
00429 
00430   /// Find a substring, searching forward; return position or -1
00431   FXint find(const FXString& substr,FXint pos=0) const;
00432 
00433   /// Find a substring, searching backward; return position or -1
00434   FXint rfind(const FXString& substr,FXint pos=2147483647) const;
00435 
00436   /// Find first character in the set of size n, starting from pos; return position or -1
00437   FXint find_first_of(const FXchar* set,FXint n,FXint pos) const;
00438 
00439   /// Find first character in the set, starting from pos; return position or -1
00440   FXint find_first_of(const FXchar* set,FXint pos=0) const;
00441 
00442   /// Find first character in the set, starting from pos; return position or -1
00443   FXint find_first_of(const FXString& set,FXint pos=0) const;
00444 
00445   /// Find first character, starting from pos; return position or -1
00446   FXint find_first_of(FXchar c,FXint pos=0) const;
00447 
00448   /// Find last character in the set of size n, starting from pos; return position or -1
00449   FXint find_last_of(const FXchar* set,FXint n,FXint pos) const;
00450 
00451   /// Find last character in the set, starting from pos; return position or -1
00452   FXint find_last_of(const FXchar* set,FXint pos=2147483647) const;
00453 
00454   /// Find last character in the set, starting from pos; return position or -1
00455   FXint find_last_of(const FXString& set,FXint pos=2147483647) const;
00456 
00457   /// Find last character, starting from pos; return position or -1
00458   FXint find_last_of(FXchar c,FXint pos=0) const;
00459 
00460   /// Find first character NOT in the set of size n, starting from pos; return position or -1
00461   FXint find_first_not_of(const FXchar* set,FXint n,FXint pos) const;
00462 
00463   /// Find first character NOT in the set, starting from pos; return position or -1
00464   FXint find_first_not_of(const FXchar* set,FXint pos=0) const;
00465 
00466   /// Find first character NOT in the set, starting from pos; return position or -1
00467   FXint find_first_not_of(const FXString& set,FXint pos=0) const;
00468 
00469   /// Find first character NOT equal to c, starting from pos; return position or -1
00470   FXint find_first_not_of(FXchar c,FXint pos=0) const;
00471 
00472   /// Find last character NOT in the set of size n, starting from pos; return position or -1
00473   FXint find_last_not_of(const FXchar* set,FXint n,FXint pos) const;
00474 
00475   /// Find last character NOT in the set, starting from pos; return position or -1
00476   FXint find_last_not_of(const FXchar* set,FXint pos=2147483647) const;
00477 
00478   /// Find last character NOT in the set, starting from pos; return position or -1
00479   FXint find_last_not_of(const FXString& set,FXint pos=2147483647) const;
00480 
00481   /// Find last character NOT equal to c, starting from pos; return position or -1
00482   FXint find_last_not_of(FXchar c,FXint pos=0) const;
00483 
00484   /// Scan a string a-la scanf
00485   FXint scan(const FXchar* fmt,...) const FX_SCANF(2,3) ;
00486   FXint vscan(const FXchar* fmt,va_list args) const;
00487 
00488   /// Format a string a-la printf
00489   FXint format(const FXchar* fmt,...) FX_PRINTF(2,3) ;
00490   FXint vformat(const FXchar* fmt,va_list args);
00491 
00492   /// Convert to long integer
00493   FXlong toLong(FXint base=10) const;
00494 
00495   /// Convert to unsigned long integer
00496   FXulong toULong(FXint base=10) const;
00497 
00498   /// Convert to integer
00499   FXint toInt(FXint base=10) const;
00500 
00501   /// Convert to unsigned integer
00502   FXuint toUInt(FXint base=10) const;
00503 
00504   /// Convert to double
00505   FXdouble toDouble() const;
00506 
00507   /// Convert to float
00508   FXfloat toFloat() const;
00509 
00510   /// Convert from long integer
00511   FXString& fromLong(FXlong number,FXint base=10);
00512 
00513   /// Convert from unsigned long integer
00514   FXString& fromULong(FXulong number,FXint base=10);
00515 
00516   /// Convert from integer
00517   FXString& fromInt(FXint number,FXint base=10);
00518 
00519   /// Convert from unsigned integer
00520   FXString& fromUInt(FXuint number,FXint base=10);
00521 
00522   /// Convert from double
00523   FXString& fromDouble(FXdouble number,FXint prec=6,FXint fmt=2);
00524 
00525   /// Convert from float
00526   FXString& fromFloat(FXfloat number,FXint prec=6,FXint fmt=2);
00527 
00528   /**
00529   * Return a string value by converting an integer number to a string,
00530   * using the given number base, which must be between 2 and 16.
00531   */
00532   static FXString value(FXint num,FXint base=10);
00533   static FXString value(FXuint num,FXint base=10);
00534 
00535   /**
00536   * Return a string value by converting a long integer number to a string,
00537   * using the given number base, which must be between 2 and 16.
00538   */
00539   static FXString value(FXlong num,FXint base=10);
00540   static FXString value(FXulong num,FXint base=10);
00541 
00542   /**
00543   * Return a string value by converting real number to a string, using the given
00544   * procision and exponential notation mode, which may be 0 (never), 1 (always),
00545   * or 2 (when needed).
00546   */
00547   static FXString value(FXfloat num,FXint prec=6,FXint fmt=2);
00548   static FXString value(FXdouble num,FXint prec=6,FXint fmt=2);
00549 
00550   /**
00551   * Return a string value from printf-like format arguments.
00552   */
00553   static FXString value(const FXchar* fmt,...) FX_PRINTF(1,2) ;
00554 
00555   /**
00556   * Return a string value from vprintf-like format arguments.
00557   */
00558   static FXString vvalue(const FXchar* fmt,va_list args);
00559 
00560   /// Check if the string contains special characters or leading or trailing whitespace
00561   FXbool shouldEscape(FXchar lquote=0,FXchar rquote=0) const;
00562 
00563   /// Escape special characters, and optionally enclose with left and right quotes
00564   FXString& escape(FXchar lquote=0,FXchar rquote=0);
00565 
00566   /// Unescape special characters, and optionally remove left and right quotes
00567   FXString& unescape(FXchar lquote=0,FXchar rquote=0);
00568 
00569   /// Get hash value
00570   FXuint hash() const;
00571 
00572   /// Append operators
00573   FXString& operator+=(const FXString& s);
00574   FXString& operator+=(const FXchar* s);
00575   FXString& operator+=(const FXwchar* s);
00576   FXString& operator+=(const FXnchar* s);
00577   FXString& operator+=(FXchar c);
00578 
00579   /// Swap two strings
00580   friend inline void swap(FXString& a,FXString& b);
00581 
00582   /// Saving to a stream
00583   friend FXAPI FXStream& operator<<(FXStream& store,const FXString& s);
00584 
00585   /// Load from a stream
00586   friend FXAPI FXStream& operator>>(FXStream& store,FXString& s);
00587 
00588   /// Delete
00589  ~FXString();
00590   };
00591 
00592 
00593 /// Swap two strings
00594 inline void swap(FXString& a,FXString& b){ FXchar *t=a.str; a.str=b.str; b.str=t; }
00595 
00596 /// Saving to a stream
00597 extern FXAPI FXStream& operator<<(FXStream& store,const FXString& s);
00598 
00599 /// Load from a stream
00600 extern FXAPI FXStream& operator>>(FXStream& store,FXString& s);
00601 
00602 
00603 /// Compare
00604 extern FXAPI FXint compare(const FXchar* s1,const FXchar* s2);
00605 extern FXAPI FXint compare(const FXchar* s1,const FXString& s2);
00606 extern FXAPI FXint compare(const FXString& s1,const FXchar* s2);
00607 extern FXAPI FXint compare(const FXString& s1,const FXString& s2);
00608 
00609 /// Compare up to n
00610 extern FXAPI FXint compare(const FXchar* s1,const FXchar* s2,FXint n);
00611 extern FXAPI FXint compare(const FXchar* s1,const FXString& s2,FXint n);
00612 extern FXAPI FXint compare(const FXString& s1,const FXchar* s2,FXint n);
00613 extern FXAPI FXint compare(const FXString& s1,const FXString& s2,FXint n);
00614 
00615 /// Compare case insensitive
00616 extern FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2);
00617 extern FXAPI FXint comparecase(const FXchar* s1,const FXString& s2);
00618 extern FXAPI FXint comparecase(const FXString& s1,const FXchar* s2);
00619 extern FXAPI FXint comparecase(const FXString& s1,const FXString& s2);
00620 
00621 /// Compare case insensitive up to n
00622 extern FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2,FXint n);
00623 extern FXAPI FXint comparecase(const FXchar* s1,const FXString& s2,FXint n);
00624 extern FXAPI FXint comparecase(const FXString& s1,const FXchar* s2,FXint n);
00625 extern FXAPI FXint comparecase(const FXString& s1,const FXString& s2,FXint n);
00626 
00627 /// Compare with numeric interpretation
00628 extern FXAPI FXint compareversion(const FXchar* s1,const FXchar* s2);
00629 extern FXAPI FXint compareversion(const FXchar* s1,const FXString& s2);
00630 extern FXAPI FXint compareversion(const FXString& s1,const FXchar* s2);
00631 extern FXAPI FXint compareversion(const FXString& s1,const FXString& s2);
00632 
00633 /// Equality operators
00634 extern FXAPI FXbool operator==(const FXString& s1,const FXString& s2);
00635 extern FXAPI FXbool operator==(const FXString& s1,const FXchar* s2);
00636 extern FXAPI FXbool operator==(const FXchar* s1,const FXString& s2);
00637 
00638 /// Inequality operators
00639 extern FXAPI FXbool operator!=(const FXString& s1,const FXString& s2);
00640 extern FXAPI FXbool operator!=(const FXString& s1,const FXchar* s2);
00641 extern FXAPI FXbool operator!=(const FXchar* s1,const FXString& s2);
00642 
00643 /// Lexicographic less than operators
00644 extern FXAPI FXbool operator<(const FXString& s1,const FXString& s2);
00645 extern FXAPI FXbool operator<(const FXString& s1,const FXchar* s2);
00646 extern FXAPI FXbool operator<(const FXchar* s1,const FXString& s2);
00647 
00648 /// Lexicographic less than or equal operators
00649 extern FXAPI FXbool operator<=(const FXString& s1,const FXString& s2);
00650 extern FXAPI FXbool operator<=(const FXString& s1,const FXchar* s2);
00651 extern FXAPI FXbool operator<=(const FXchar* s1,const FXString& s2);
00652 
00653 /// Lexicographic greater than operators
00654 extern FXAPI FXbool operator>(const FXString& s1,const FXString& s2);
00655 extern FXAPI FXbool operator>(const FXString& s1,const FXchar* s2);
00656 extern FXAPI FXbool operator>(const FXchar* s1,const FXString& s2);
00657 
00658 /// Lexicographic greater than or equal operators
00659 extern FXAPI FXbool operator>=(const FXString& s1,const FXString& s2);
00660 extern FXAPI FXbool operator>=(const FXString& s1,const FXchar* s2);
00661 extern FXAPI FXbool operator>=(const FXchar* s1,const FXString& s2);
00662 
00663 /// Concatenate FXString and FXString
00664 extern FXAPI FXString operator+(const FXString& s1,const FXString& s2);
00665 
00666 /// Concatenate FXString and a string
00667 extern FXAPI FXString operator+(const FXString& s1,const FXchar* s2);
00668 extern FXAPI FXString operator+(const FXString& s1,const FXwchar* s2);
00669 extern FXAPI FXString operator+(const FXString& s1,const FXnchar* s2);
00670 
00671 /// Concatenate string and FXString
00672 extern FXAPI FXString operator+(const FXchar* s1,const FXString& s2);
00673 extern FXAPI FXString operator+(const FXwchar* s1,const FXString& s2);
00674 extern FXAPI FXString operator+(const FXnchar* s1,const FXString& s2);
00675 
00676 /// Concatenate string and single character
00677 extern FXAPI FXString operator+(const FXString& s,FXchar c);
00678 extern FXAPI FXString operator+(FXchar c,const FXString& s);
00679 
00680 /// Return utf8 from ascii containing unicode escapes
00681 extern FXAPI FXString fromAscii(const FXString& s);
00682 
00683 /// Return ascii containing unicode escapes from utf8
00684 extern FXAPI FXString toAscii(const FXString& s);
00685 
00686 /// Return normalized string, i.e. reordering of diacritical marks
00687 extern FXAPI FXString normalize(const FXString& s);
00688 
00689 /// Return normalized decomposition of string
00690 extern FXAPI FXString decompose(const FXString& s,FXuint kind);
00691 
00692 /// Return normalized composition of string; this first performs normalized decomposition
00693 extern FXAPI FXString compose(const FXString& s,FXuint kind);
00694 
00695 /// Convert unix string to dos string
00696 extern FXAPI FXString& unixToDos(FXString& str);
00697 
00698 /// Convert dos string to unix string
00699 extern FXAPI FXString& dosToUnix(FXString& str);
00700 
00701 }
00702 
00703 #endif

Copyright © 1997-2009 Jeroen van der Zijp