compilation fix in wxUSE_STL case after r54761

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-08-31 15:05:02 +00:00
parent ad8ae78878
commit 2549484fe5
2 changed files with 23 additions and 15 deletions

View File

@ -121,7 +121,7 @@ void ItemContainerWidgetsPage::StartTest(const wxString& label)
wxLogMessage(_T("Test - %s:"), label.c_str());
}
void ItemContainerWidgetsPage::EndTest(const wxMaybeSortedArrayString& items)
void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
{
const unsigned count = m_container->GetCount();
@ -177,7 +177,7 @@ void ItemContainerWidgetsPage::EndTest(const wxMaybeSortedArrayString& items)
}
wxString
ItemContainerWidgetsPage::DumpContainerData(const wxMaybeSortedArrayString& expected) const
ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const
{
wxString str;
str << _T("Current content:\n");
@ -229,6 +229,20 @@ bool ItemContainerWidgetsPage::VerifyClientData(wxUIntPtr i, const wxString& str
return true;
}
/* static */
wxArrayString
ItemContainerWidgetsPage::MakeArray(const wxSortedArrayString& sorted)
{
wxArrayString a;
const size_t count = sorted.size();
a.reserve(count);
for ( size_t n = 0; n < count; n++ )
a.push_back(sorted[n]);
return a;
}
void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
{
m_container = GetContainer();
@ -238,9 +252,9 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
GetWidget()->GetClassInfo()->GetClassName(),
(m_container->IsSorted() ? "Sorted" : "Unsorted"));
const wxMaybeSortedArrayString&
expected_result = m_container->IsSorted() ? m_itemsSorted
: m_items;
const wxArrayString
expected_result = m_container->IsSorted() ? MakeArray(m_itemsSorted)
: m_items;
StartTest(_T("Append one item"));
wxString item = m_items[0];

View File

@ -12,14 +12,6 @@
#include "widgets.h"
// define a common base class for sorted and normal string arrays
#if wxUSE_STL
typedef wxBaseArrayStringBase wxMaybeSortedArrayString;
#else
// in non-STL build wxSortedArrayString derives from wxArrayString
typedef wxArrayString wxMaybeSortedArrayString;
#endif
class ItemContainerWidgetsPage : public WidgetsPage
{
public:
@ -34,7 +26,7 @@ public:
private:
void StartTest(const wxString& label);
void EndTest(const wxMaybeSortedArrayString& result);
void EndTest(const wxArrayString& result);
// Track client data in wxItemContainer instances
wxClientData* CreateClientData(int value);
@ -45,7 +37,9 @@ private:
bool VerifyAllClientDataDestroyed();
bool VerifyClientData(wxUIntPtr i, const wxString& str);
wxString DumpContainerData(const wxMaybeSortedArrayString& expected) const;
wxString DumpContainerData(const wxArrayString& expected) const;
static wxArrayString MakeArray(const wxSortedArrayString& sorted);
wxArrayString m_items;
wxSortedArrayString m_itemsSorted;