- Corrected bug in wxTimeSpan::IsShorterThan() for equal time spans.
- Use std::unordered_{map,set} for wxHashMap/Set if available (Jan van Dijk).
- Added wxString::Capitalize() and MakeCapitalized().
+- Added wxArrayString::swap().
- Added wxSHUTDOWN_LOGOFF and wxSHUTDOWN_FORCE wxShutdown() flags (troelsk).
All (Unix):
void reserve(size_type n) /* base::reserve*/;
void resize(size_type n, value_type v = value_type());
size_type size() const { return GetCount(); }
+ void swap(wxArrayString& other)
+ {
+ // not sure if we can rely on having std::swap() everywhere so do it
+ // manually
+ const size_t savedSize = m_nSize;
+ const size_t savedCount = m_nCount;
+ wxString * const savedItems = m_pItems;
+ const bool savedAutoSort = m_autoSort;
+
+ m_nSize = other.m_nSize;
+ m_nCount = other.m_nCount;
+ m_pItems = other.m_pItems;
+ m_autoSort = other.m_autoSort;
+
+ other.m_nSize = savedSize;
+ other.m_nCount = savedCount;
+ other.m_pItems = savedItems;
+ other.m_autoSort = savedAutoSort;
+ }
protected:
void Init(bool autoSort); // common part of all ctors
CPPUNIT_TEST( wxArrayCharTest );
CPPUNIT_TEST( TestSTL );
CPPUNIT_TEST( Alloc );
+ CPPUNIT_TEST( Swap );
CPPUNIT_TEST_SUITE_END();
void wxStringArrayTest();
void wxArrayCharTest();
void TestSTL();
void Alloc();
+ void Swap();
DECLARE_NO_COPY_CLASS(ArraysTestCase)
};
CPPUNIT_ASSERT_EQUAL( 9, a[1] );
}
+void ArraysTestCase::Swap()
+{
+ wxArrayString a1, a2;
+ a1.swap(a2);
+ CPPUNIT_ASSERT( a1.empty() && a2.empty() );
+
+ a1.push_back("Foo");
+ a1.swap(a2);
+ CPPUNIT_ASSERT( a1.empty() );
+ CPPUNIT_ASSERT_EQUAL( 1, a2.size() );
+
+ a1.push_back("Bar");
+ a1.push_back("Baz");
+ a2.swap(a1);
+ CPPUNIT_ASSERT_EQUAL( 1, a1.size() );
+ CPPUNIT_ASSERT_EQUAL( 2, a2.size() );
+
+ a1.swap(a2);
+ CPPUNIT_ASSERT_EQUAL( 2, a1.size() );
+ CPPUNIT_ASSERT_EQUAL( 1, a2.size() );
+}
+
void ArraysTestCase::TestSTL()
{
wxArrayInt list1;