X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e75b65f7c801f98fd75e0863d29d59e4b12b6fb..9a62fa17b1c342b5b1e1bb9b96373e170a9d8b6f:/include/wx/arrstr.h diff --git a/include/wx/arrstr.h b/include/wx/arrstr.h index 11f32a466f..18d7651c4f 100644 --- a/include/wx/arrstr.h +++ b/include/wx/arrstr.h @@ -27,9 +27,9 @@ typedef wxString _wxArraywxBaseArrayStringBase; _WX_DECLARE_BASEARRAY_2(_wxArraywxBaseArrayStringBase, wxBaseArrayStringBase, wxArray_SortFunction, class WXDLLIMPEXP_BASE); -WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, +WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, wxBaseArrayStringBase, WXDLLIMPEXP_BASE); -_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, +_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, wxBaseArrayStringBase, = wxStringSortAscending, class WXDLLIMPEXP_BASE, CMPFUNCwxString); @@ -42,11 +42,20 @@ public: wxArrayString() { } wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { } + wxArrayString(size_t sz, const wxChar** a); + wxArrayString(size_t sz, const wxString* a); int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const; void Sort(bool reverseOrder = false); void Sort(CompareFunction function); + void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); } + + size_t Add(const wxString& string, size_t copies = 1) + { + wxArrayStringBase::Add(string, copies); + return size() - copies; + } }; class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase @@ -109,6 +118,10 @@ public: // of course, using explicit would be even better - if all compilers // supported it... wxArrayString(int autoSort) { Init(autoSort != 0); } + // C string array ctor + wxArrayString(size_t sz, const wxChar** a); + // wxString string array ctor + wxArrayString(size_t sz, const wxString* a); // copy ctor wxArrayString(const wxArrayString& array); // assignment operator @@ -159,7 +172,7 @@ public: // once you are done with it. Will return NULL if the // ArrayString was empty. #if WXWIN_COMPATIBILITY_2_4 - wxString* GetStringArray() const; + wxDEPRECATED( wxString* GetStringArray() const ); #endif // item management @@ -179,7 +192,7 @@ public: void Remove(const wxChar *sz); // remove item by index #if WXWIN_COMPATIBILITY_2_4 - void Remove(size_t nIndex, size_t nRemove = 1) { RemoveAt(nIndex, nRemove); } + wxDEPRECATED( void Remove(size_t nIndex, size_t nRemove = 1) ); #endif void RemoveAt(size_t nIndex, size_t nRemove = 1); @@ -208,7 +221,7 @@ public: typedef int difference_type; typedef size_t size_type; - // FIXME: same in dynarray.h + // TODO: this code duplicates the one in dynarray.h class reverse_iterator { typedef wxString value_type; @@ -226,13 +239,13 @@ public: reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } reference operator*() const { return *m_ptr; } pointer operator->() const { return m_ptr; } - itor operator++() { --m_ptr; return *this; } - itor operator++(int) + itor& operator++() { --m_ptr; return *this; } + const itor operator++(int) { reverse_iterator tmp = *this; --m_ptr; return tmp; } - itor operator--() { ++m_ptr; return *this; } - itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } - bool operator ==(const itor& it) { return m_ptr == it.m_ptr; } - bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } + itor& operator--() { ++m_ptr; return *this; } + const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } }; class const_reverse_iterator @@ -253,13 +266,13 @@ public: const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } reference operator*() const { return *m_ptr; } pointer operator->() const { return m_ptr; } - itor operator++() { --m_ptr; return *this; } - itor operator++(int) + itor& operator++() { --m_ptr; return *this; } + const itor operator++(int) { itor tmp = *this; --m_ptr; return tmp; } - itor operator--() { ++m_ptr; return *this; } - itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } - bool operator ==(const itor& it) { return m_ptr == it.m_ptr; } - bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } + itor& operator--() { ++m_ptr; return *this; } + const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } }; wxArrayString(const_iterator first, const_iterator last)