]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/string.h
Removing more CodeWarrior project files.
[wxWidgets.git] / interface / wx / string.h
index a88ae09f14d5e718ad97a7b4089d63eea1bd7d23..b937a5267bf4ff1198d4f5321102789566a8585b 100644 (file)
@@ -36,7 +36,7 @@
     for important warnings and advices for using it, please read
     the @ref overview_string.
 
-    In wxWidgets 3.0 wxString always stores Unicode strings, so you should
+    Since wxWidgets 3.0 wxString always stores Unicode strings, so you should
     be sure to read also @ref overview_unicode.
 
 
     @stdobjects
     ::wxEmptyString
 
-    @see @ref overview_string, @ref overview_unicode, wxUString
+    @see @ref overview_string, @ref overview_unicode, wxUString,
+         wxCharBuffer, wxUniChar, wxStringTokenizer, @ref group_funcmacro_string
 */
 class wxString
 {
@@ -488,26 +489,6 @@ public:
     */
     int CmpNoCase(const wxString& s) const;
 
-
-    //@{
-    /**
-        Comparison operators
-    */
-    bool operator ==(const wxString& x, const wxString& y);
-    bool operator ==(const wxString& x, wxUniChar ch);
-    bool operator !=(const wxString& x, const wxString& y);
-    bool operator !=(const wxString& x, wxUniChar ch);
-    bool operator(const wxString& x, const wxString& y);
-    bool operator(const wxString& x, wxUniChar ch);
-    bool operator =(const wxString& x, const wxString& y);
-    bool operator =(const wxString& x, wxUniChar ch);
-    bool operator(const wxString& x, const wxString& y);
-    bool operator(const wxString& x, wxUniChar ch);
-    bool operator =(const wxString& x, const wxString& y);
-    bool operator =(const wxString& x, wxUniChar ch);
-    //@}
-
-
     /**
         Returns @true if target appears anywhere in wxString; else @false.
         This is a wxWidgets 1.xx compatibility function; you should not use it in new
@@ -559,7 +540,7 @@ public:
 
         @see FormatV(), Printf()
     */
-    static wxString Format(const wxChar format, ...);
+    static wxString Format(const wxString& format, ...);
 
     /**
         This static function returns the string containing the result of calling
@@ -567,7 +548,7 @@ public:
 
         @see Format(), PrintfV()
     */
-    static wxString FormatV(const wxChar format, va_list argptr);
+    static wxString FormatV(const wxString& format, va_list argptr);
 
     /**
         Returns the number of occurrences of @e ch in the string.
@@ -672,6 +653,8 @@ public:
 
     /**
         Returns @true if the string contains only ASCII characters.
+        See wxUniChar::IsAscii for more details.
+
         This is a wxWidgets 1.xx compatibility function; you should not use it in new
         code.
     */
@@ -1119,8 +1102,6 @@ public:
     wxString& operator<<(const char* psz);
     wxString& operator<<(const wchar_t* pwz);
     wxString& operator<<(const wxCStrData& psz);
-    wxString& operator<<(const char* psz);
-    wxString& operator<<(wxUniCharRef ch);
     wxString& operator<<(char ch);
     wxString& operator<<(unsigned char ch);
     wxString& operator<<(wchar_t ch);
@@ -1161,7 +1142,7 @@ public:
     //@{
     /**
         Assignment: the effect of each operation is the same as for the corresponding
-        constructor (see @ref wxString() "wxString constructors").
+        constructor (see wxString constructors).
     */
     wxString operator =(const wxString& str);
     wxString operator =(wxUniChar c);
@@ -1368,6 +1349,56 @@ public:
     //@}
 };
 
+
+
+//@{
+/**
+    Comparison operator for string types.
+*/
+inline bool operator==(const wxString& s1, const wxString& s2);
+inline bool operator!=(const wxString& s1, const wxString& s2);
+inline bool operator< (const wxString& s1, const wxString& s2);
+inline bool operator> (const wxString& s1, const wxString& s2);
+inline bool operator<=(const wxString& s1, const wxString& s2);
+inline bool operator>=(const wxString& s1, const wxString& s2);
+inline bool operator==(const wxString& s1, const wxCStrData& s2);
+inline bool operator==(const wxCStrData& s1, const wxString& s2);
+inline bool operator!=(const wxString& s1, const wxCStrData& s2);
+inline bool operator!=(const wxCStrData& s1, const wxString& s2);
+inline bool operator==(const wxString& s1, const wxWCharBuffer& s2);
+inline bool operator==(const wxWCharBuffer& s1, const wxString& s2);
+inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2);
+inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2);
+inline bool operator==(const wxString& s1, const wxCharBuffer& s2);
+inline bool operator==(const wxCharBuffer& s1, const wxString& s2);
+inline bool operator!=(const wxString& s1, const wxCharBuffer& s2);
+inline bool operator!=(const wxCharBuffer& s1, const wxString& s2);
+//@}
+
+//@{
+/**
+    Comparison operators char types.
+*/
+inline bool operator==(const wxUniChar& c, const wxString& s);
+inline bool operator==(const wxUniCharRef& c, const wxString& s);
+inline bool operator==(char c, const wxString& s);
+inline bool operator==(wchar_t c, const wxString& s);
+inline bool operator==(int c, const wxString& s);
+inline bool operator==(const wxString& s, const wxUniChar& c);
+inline bool operator==(const wxString& s, const wxUniCharRef& c);
+inline bool operator==(const wxString& s, char c);
+inline bool operator==(const wxString& s, wchar_t c);
+inline bool operator!=(const wxUniChar& c, const wxString& s);
+inline bool operator!=(const wxUniCharRef& c, const wxString& s);
+inline bool operator!=(char c, const wxString& s);
+inline bool operator!=(wchar_t c, const wxString& s);
+inline bool operator!=(int c, const wxString& s);
+inline bool operator!=(const wxString& s, const wxUniChar& c);
+inline bool operator!=(const wxString& s, const wxUniCharRef& c);
+inline bool operator!=(const wxString& s, char c);
+inline bool operator!=(const wxString& s, wchar_t c);
+//@}
+
 /**
     The global wxString instance of an empty string.
     Used extensively in the entire wxWidgets API.
@@ -1376,7 +1407,6 @@ wxString wxEmptyString;
 
 
 
-
 /**
     @class wxStringBufferLength
 
@@ -1499,3 +1529,29 @@ public:
     */
     wxStringCharType* operator wxStringCharType *();
 };
+
+
+/** @addtogroup group_funcmacro_string */
+//@{
+
+/**
+    Allows to extend a function with the signature:
+    @code bool SomeFunc(const wxUniChar& c) @endcode
+    which operates on a single character, to an entire wxString.
+
+    E.g. if you want to check if an entire string contains only digits,
+    you can do:
+    @code
+        if (wxStringCheck<wxIsdigit>(myString))
+            ... // the entire string contains oly digits!
+        else
+            ... // at least one character of myString is not a digit
+    @endcode
+
+    @return @true if the given function returns a non-zero value for all
+            characters of the @a val string.
+*/
+template<bool (T)(const wxUniChar& c)>
+    inline bool wxStringCheck(const wxString& val);
+
+//@}