Use wxVector<> instead of macro-based wxArray

This commit is contained in:
Artur Wieczorek
2019-06-16 18:30:44 +02:00
parent f4e37e57e4
commit 2a24991110

View File

@@ -181,7 +181,7 @@ class TestRunner
{ {
public: public:
TestRunner( const wxString& name, wxPropertyGridManager* man, wxTextCtrl* ed, wxArrayString* errorMessages ) TestRunner( const wxString& name, wxPropertyGridManager* man, wxTextCtrl* ed, wxVector<wxString>* errorMessages )
{ {
m_name = name; m_name = name;
m_man = man; m_man = man;
@@ -221,7 +221,7 @@ public:
protected: protected:
wxPropertyGridManager* m_man; wxPropertyGridManager* m_man;
wxTextCtrl* m_ed; wxTextCtrl* m_ed;
wxArrayString* m_errorMessages; wxVector<wxString>* m_errorMessages;
wxString m_name; wxString m_name;
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
int m_preWarnings; int m_preWarnings;
@@ -287,9 +287,9 @@ int gpiro_cmpfunc(const void* a, const void* b)
return (int) (((size_t)p1->GetClientData()) - ((size_t)p2->GetClientData())); return (int) (((size_t)p1->GetClientData()) - ((size_t)p2->GetClientData()));
} }
wxArrayPGProperty GetPropertiesInRandomOrder( wxPropertyGridInterface* props, int iterationFlags = wxPG_ITERATE_ALL ) wxVector<wxPGProperty*> GetPropertiesInRandomOrder( wxPropertyGridInterface* props, int iterationFlags = wxPG_ITERATE_ALL )
{ {
wxArrayPGProperty arr; wxVector<wxPGProperty*> arr;
wxPropertyGridIterator it; wxPropertyGridIterator it;
@@ -333,7 +333,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
int failures = 0; int failures = 0;
bool _failed_ = false; bool _failed_ = false;
wxArrayString errorMessages; wxVector<wxString> errorMessages;
wxDialog* dlg = NULL; wxDialog* dlg = NULL;
dlg = new wxDialog(this,wxID_ANY,"wxPropertyGrid Regression Tests", dlg = new wxDialog(this,wxID_ANY,"wxPropertyGrid Regression Tests",
@@ -458,18 +458,18 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(DeleteProperty) RT_START_TEST(DeleteProperty)
wxPGVIterator it; wxPGVIterator it;
wxArrayPGProperty array; wxVector<wxPGProperty*> array;
for ( it = pgman->GetVIterator(wxPG_ITERATE_ALL&~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE))); for ( it = pgman->GetVIterator(wxPG_ITERATE_ALL&~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE)));
!it.AtEnd(); !it.AtEnd();
it.Next() ) it.Next() )
array.push_back(it.GetProperty()); array.push_back(it.GetProperty());
wxArrayPGProperty::reverse_iterator it2; wxVector<wxPGProperty*>::reverse_iterator it2;
for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 ) for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 )
{ {
wxPGProperty* p = (wxPGProperty*)*it2; wxPGProperty* p = *it2;
RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel(),p->GetName())); RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel(),p->GetName()));
pgman->DeleteProperty(p); pgman->DeleteProperty(p);
} }
@@ -1244,7 +1244,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
for ( i=0; i<3; i++ ) for ( i=0; i<3; i++ )
{ {
wxArrayPtrVoid arr; wxVector<wxPGProperty*> arr;
wxPropertyGridPage* page = pgman->GetPage(i); wxPropertyGridPage* page = pgman->GetPage(i);
@@ -1254,18 +1254,16 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
!it.AtEnd(); !it.AtEnd();
++it ) ++it )
{ {
arr.Add((void*)*it); arr.push_back(*it);
} }
if ( !arr.empty() ) if ( !arr.empty() )
{ {
size_t n; pgman->Collapse( arr[0] );
pgman->Collapse( (wxPGProperty*)arr.Item(0) ); for ( size_t n=arr.size()-1; n>0; n-- )
for ( n=arr.GetCount()-1; n>0; n-- )
{ {
pgman->Collapse( (wxPGProperty*)arr.Item(n) ); pgman->Collapse( arr[n] );
} }
} }
@@ -1425,9 +1423,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPropertyGridPage* page = pgman->GetPage(0); wxPropertyGridPage* page = pgman->GetPage(0);
wxArrayPGProperty arr1; wxVector<wxPGProperty*> arr1 = GetPropertiesInRandomOrder(page);
arr1 = GetPropertiesInRandomOrder(page);
if ( !_failed_ ) if ( !_failed_ )
{ {
@@ -1445,7 +1441,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
if ( !_failed_ ) if ( !_failed_ )
{ {
wxArrayPGProperty arr2 = GetPropertiesInRandomOrder(page); wxVector<wxPGProperty*> arr2 = GetPropertiesInRandomOrder(page);
for ( i=0; i<arr2.size(); i++ ) for ( i=0; i<arr2.size(); i++ )
{ {
@@ -1479,7 +1475,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
if ( !_failed_ ) if ( !_failed_ )
{ {
wxArrayPGProperty arr2 = GetPropertiesInRandomOrder(page); wxVector<wxPGProperty*> arr2 = GetPropertiesInRandomOrder(page);
for ( i=0; i<arr2.size(); i++ ) for ( i=0; i<arr2.size(); i++ )
{ {
@@ -1514,7 +1510,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
if ( !_failed_ ) if ( !_failed_ )
{ {
wxArrayPGProperty arr2 = GetPropertiesInRandomOrder(page); wxVector<wxPGProperty*> arr2 = GetPropertiesInRandomOrder(page);
for ( i=0; i<arr2.size(); i++ ) for ( i=0; i<arr2.size(); i++ )
{ {