Added GetStringArray method.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13178 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1026,6 +1026,12 @@ public:
|
|||||||
// get last item
|
// get last item
|
||||||
wxString& Last() const { wxASSERT( !IsEmpty() ); return Item(Count() - 1); }
|
wxString& Last() const { wxASSERT( !IsEmpty() ); return Item(Count() - 1); }
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
// item management
|
// item management
|
||||||
// Search the element in the array, starting from the beginning if
|
// Search the element in the array, starting from the beginning if
|
||||||
// bFromEnd is FALSE or from end otherwise. If bCase, comparison is case
|
// bFromEnd is FALSE or from end otherwise. If bCase, comparison is case
|
||||||
|
@@ -1894,10 +1894,11 @@ wxString& wxString::replace(size_t nStart, size_t nLen,
|
|||||||
// ArrayString
|
// ArrayString
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// size increment = max(50% of current size, ARRAY_MAXSIZE_INCREMENT)
|
// size increment = min(50% of current size, ARRAY_MAXSIZE_INCREMENT)
|
||||||
#define ARRAY_MAXSIZE_INCREMENT 4096
|
#define ARRAY_MAXSIZE_INCREMENT 4096
|
||||||
|
|
||||||
#ifndef ARRAY_DEFAULT_INITIAL_SIZE // also defined in dynarray.h
|
#ifndef ARRAY_DEFAULT_INITIAL_SIZE // also defined in dynarray.h
|
||||||
#define ARRAY_DEFAULT_INITIAL_SIZE (16)
|
#define ARRAY_DEFAULT_INITIAL_SIZE (16)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STRING(p) ((wxString *)(&(p)))
|
#define STRING(p) ((wxString *)(&(p)))
|
||||||
@@ -2047,6 +2048,21 @@ void wxArrayString::Shrink()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return a wxString[] as required for some control ctors.
|
||||||
|
wxString* wxArrayString::GetStringArray() const
|
||||||
|
{
|
||||||
|
wxString *array = 0;
|
||||||
|
|
||||||
|
if( m_nCount > 0 )
|
||||||
|
{
|
||||||
|
array = new wxString[m_nCount];
|
||||||
|
for( size_t i = 0; i < m_nCount; i++ )
|
||||||
|
array[i] = m_pItems[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
// searches the array for an item (forward or backwards)
|
// searches the array for an item (forward or backwards)
|
||||||
int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const
|
int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user