added wxArrayString::operator==() and !=()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -80,6 +80,20 @@ reasons it is not virtual, so this class should not be derived from.
|
|||||||
|
|
||||||
Assignment operator.
|
Assignment operator.
|
||||||
|
|
||||||
|
\membersection{wxArrayString::operator==}\label{wxarraystringoperatorequal}
|
||||||
|
|
||||||
|
\constfunc{bool}{operator $==$}{\param{const wxArrayString\&}{ array}}
|
||||||
|
|
||||||
|
Compares 2 arrays respecting the case. Returns TRUE only if the arrays have
|
||||||
|
the same number of elements and the same strings in the same order.
|
||||||
|
|
||||||
|
\membersection{wxArrayString::operator!=}\label{wxarraystringoperatornotequal}
|
||||||
|
|
||||||
|
\constfunc{bool}{operator $!=$}{\param{const wxArrayString\&}{ array}}
|
||||||
|
|
||||||
|
Compares 2 arrays respecting the case. Returns TRUE if the arrays have
|
||||||
|
different number of elements or if the elements don't match pairwise.
|
||||||
|
|
||||||
\membersection{wxArrayString::operator[]}\label{wxarraystringoperatorindex}
|
\membersection{wxArrayString::operator[]}\label{wxarraystringoperatorindex}
|
||||||
|
|
||||||
\func{wxString\&}{operator[]}{\param{size\_t }{nIndex}}
|
\func{wxString\&}{operator[]}{\param{size\_t }{nIndex}}
|
||||||
|
@@ -1016,6 +1016,12 @@ public:
|
|||||||
// sort array elements using specified comparaison function
|
// sort array elements using specified comparaison function
|
||||||
void Sort(CompareFunction compareFunction);
|
void Sort(CompareFunction compareFunction);
|
||||||
|
|
||||||
|
// comparison
|
||||||
|
// compare two arrays case sensitively
|
||||||
|
bool operator==(const wxArrayString& a) const;
|
||||||
|
// compare two arrays case sensitively
|
||||||
|
bool operator!=(const wxArrayString& a) const { return !(*this == a); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Copy(const wxArrayString& src); // copies the contents of another array
|
void Copy(const wxArrayString& src); // copies the contents of another array
|
||||||
|
|
||||||
|
@@ -2155,3 +2155,17 @@ void wxArrayString::DoSort()
|
|||||||
qsort(m_pItems, m_nCount, sizeof(wxChar *), wxStringCompareFunction);
|
qsort(m_pItems, m_nCount, sizeof(wxChar *), wxStringCompareFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxArrayString::operator==(const wxArrayString& a) const
|
||||||
|
{
|
||||||
|
if ( m_nCount != a.m_nCount )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for ( size_t n = 0; n < m_nCount; n++ )
|
||||||
|
{
|
||||||
|
if ( Item(n) != a[n] )
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user