#ifndef WX_PRECOMP
#include "wx/defs.h"
#include "wx/list.h"
- #include "wx/utils.h" // for copystring() (beurk...)
#endif
+#if !wxUSE_STL
+
// =============================================================================
// implementation
// =============================================================================
// -----------------------------------------------------------------------------
// wxListKey
// -----------------------------------------------------------------------------
-
wxListKey wxDefaultListKey;
bool wxListKey::operator==(wxListKeyValue value) const
delete[] objArray;
}
+void wxListBase::Reverse()
+{
+ wxNodeBase* node = m_nodeFirst;
+ wxNodeBase* tmp;
+
+ while (node)
+ {
+ // swap prev and next pointers
+ tmp = node->m_next;
+ node->m_next = node->m_previous;
+ node->m_previous = tmp;
+
+ // this is the node that was next before swapping
+ node = tmp;
+ }
+
+ // swap first and last node
+ tmp = m_nodeFirst; m_nodeFirst = m_nodeLast; m_nodeLast = tmp;
+}
+
+void wxListBase::DeleteNodes(wxNodeBase* first, wxNodeBase* last)
+{
+ wxNodeBase* node = first;
+
+ while (node != last)
+ {
+ wxNodeBase* next = node->GetNext();
+ DeleteNode(node);
+ node = next;
+ }
+}
+
// ============================================================================
// compatibility section from now on
// ============================================================================
delete (wxObject *)GetData();
}
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxStringList
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+static inline wxChar* MYcopystring(const wxString& s)
+{
+ wxChar* copy = new wxChar[s.length() + 1];
+ return wxStrcpy(copy, s.c_str());
+}
+
+static inline wxChar* MYcopystring(const wxChar* s)
+{
+ wxChar* copy = new wxChar[wxStrlen(s) + 1];
+ return wxStrcpy(copy, s);
+}
IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxObject)
{
wxChar *s = node->GetData();
if ( new_copies )
- string_array[i] = copystring(s);
+ string_array[i] = MYcopystring(s);
else
string_array[i] = s;
node = node->GetNext();
delete [] array;
}
+wxNode *wxStringList::Add(const wxChar *s)
+{
+ return (wxNode *)wxStringListBase::Append(MYcopystring(s));
+}
+
+wxNode *wxStringList::Prepend(const wxChar *s)
+{
+ return (wxNode *)wxStringListBase::Insert(MYcopystring(s));
+}
+
#endif // wxLIST_COMPATIBILITY
+#endif // !wxUSE_STL