X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/886dd7d28e50c003cc88b81b968d487a3c17b0d7..e433504316adbf73756f7f5e2e79564b1659ab98:/include/wx/string.h?ds=sidebyside diff --git a/include/wx/string.h b/include/wx/string.h index dacd065248..8c8379b0db 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -101,7 +101,7 @@ const unsigned int wxSTRING_MAXLEN = UINT_MAX - 100; // ---------------------------------------------------------------------------- // global pointer to empty string -extern WXDLLEXPORT_DATA_BASE(const wxChar*) wxEmptyString; +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString; // --------------------------------------------------------------------------- // global functions complementing standard C string library replacements for @@ -166,7 +166,7 @@ inline int Stricmp(const char *psz1, const char *psz2) } // return an empty wxString -class WXDLLEXPORT_BASE wxString; // not yet defined +class WXDLLIMPEXP_BASE wxString; // not yet defined inline const wxString& wxGetEmptyString() { return *(wxString *)&wxEmptyString; } // --------------------------------------------------------------------------- @@ -174,7 +174,7 @@ inline const wxString& wxGetEmptyString() { return *(wxString *)&wxEmptyString; // is never used directly (but had to be put here to allow inlining) // --------------------------------------------------------------------------- -struct WXDLLEXPORT_BASE wxStringData +struct WXDLLIMPEXP_BASE wxStringData { int nRefs; // reference count size_t nDataLength, // actual string length @@ -233,9 +233,9 @@ struct WXDLLEXPORT_BASE wxStringData // - regular expressions support // --------------------------------------------------------------------------- -class WXDLLEXPORT_BASE wxString +class WXDLLIMPEXP_BASE wxString { -friend class WXDLLEXPORT_BASE wxArrayString; +friend class WXDLLIMPEXP_BASE wxArrayString; // NB: special care was taken in arranging the member functions in such order // that all inline functions can be effectively inlined, verify that all @@ -607,15 +607,15 @@ public: // non-destructive concatenation // - friend wxString WXDLLEXPORT_BASE operator+(const wxString& string1, const wxString& string2); + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); // - friend wxString WXDLLEXPORT_BASE operator+(const wxString& string, wxChar ch); + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); // - friend wxString WXDLLEXPORT_BASE operator+(wxChar ch, const wxString& string); + friend wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); // - friend wxString WXDLLEXPORT_BASE operator+(const wxString& string, const wxChar *psz); + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz); // - friend wxString WXDLLEXPORT_BASE operator+(const wxChar *psz, const wxString& string); + friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string); // stream-like functions // insert an int into string @@ -1027,12 +1027,19 @@ public: // from the array (operator[] or Item() method), a reference is returned. // ---------------------------------------------------------------------------- -class WXDLLEXPORT_BASE wxArrayString +int WXDLLIMPEXP_BASE wxStringSortAscending(wxString*, wxString*); +int WXDLLIMPEXP_BASE wxStringSortDescending(wxString*, wxString*); + +class WXDLLIMPEXP_BASE wxArrayString { public: // type of function used by wxArrayString::Sort() typedef int (*CompareFunction)(const wxString& first, const wxString& second); + // type of function used by wxArrayString::Sort(), for compatibility with + // wxArray + typedef int (*CompareFunction2)(wxString* first, + wxString* second); // constructors and destructor // default ctor @@ -1095,11 +1102,13 @@ public: return Item(Count() - 1); } +#if WXWIN_COMPATIBILITY_2_4 // return a wxString[], useful for the controls which // take one in their ctor. You must delete[] it yourself // once you are done with it. Will return NULL if the // ArrayString was empty. wxString* GetStringArray() const; +#endif // item management // Search the element in the array, starting from the beginning if @@ -1117,8 +1126,10 @@ public: // remove first item matching this value void Remove(const wxChar *sz); // remove item by index - void Remove(size_t nIndex, size_t nRemove = 1); - void RemoveAt(size_t nIndex, size_t nRemove = 1) { Remove(nIndex, nRemove); } +#if WXWIN_COMPATIBILITY_2_4 + void Remove(size_t nIndex, size_t nRemove = 1) { RemoveAt(nIndex, nRemove); } +#endif + void RemoveAt(size_t nIndex, size_t nRemove = 1); // sorting // sort array elements in alphabetical order (or reversed alphabetical @@ -1126,6 +1137,7 @@ public: void Sort(bool reverseOrder = FALSE); // sort array elements using specified comparaison function void Sort(CompareFunction compareFunction); + void Sort(CompareFunction2 compareFunction); // comparison // compare two arrays case sensitively @@ -1151,7 +1163,7 @@ private: bool m_autoSort; // if TRUE, keep the array always sorted }; -class WXDLLEXPORT_BASE wxSortedArrayString : public wxArrayString +class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString { public: wxSortedArrayString() : wxArrayString(TRUE) @@ -1164,7 +1176,7 @@ public: // wxStringBuffer: a tiny class allowing to get a writable pointer into string // ---------------------------------------------------------------------------- -class WXDLLEXPORT_BASE wxStringBuffer +class WXDLLIMPEXP_BASE wxStringBuffer { public: wxStringBuffer(wxString& str, size_t lenWanted = 1024) @@ -1249,11 +1261,11 @@ inline bool operator!=(const wxCharBuffer& s1, const wxString& s2) { return (s2.Cmp((const char *)s1) != 0); } #endif // wxUSE_UNICODE/!wxUSE_UNICODE -wxString WXDLLEXPORT_BASE operator+(const wxString& string1, const wxString& string2); -wxString WXDLLEXPORT_BASE operator+(const wxString& string, wxChar ch); -wxString WXDLLEXPORT_BASE operator+(wxChar ch, const wxString& string); -wxString WXDLLEXPORT_BASE operator+(const wxString& string, const wxChar *psz); -wxString WXDLLEXPORT_BASE operator+(const wxChar *psz, const wxString& string); +wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch); +wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string); +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz); +wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string); #if wxUSE_UNICODE inline wxString operator+(const wxString& string, const wxWCharBuffer& buf) { return string + (const wchar_t *)buf; } @@ -1277,8 +1289,8 @@ inline wxString operator+(const wxCharBuffer& buf, const wxString& string) #include "wx/iosfwrap.h" -WXDLLEXPORT_BASE wxSTD istream& operator>>(wxSTD istream&, wxString&); -WXDLLEXPORT_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); +WXDLLIMPEXP_BASE wxSTD istream& operator>>(wxSTD istream&, wxString&); +WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); #endif // wxSTD_STRING_COMPATIBILITY