]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/list.cpp
no message
[wxWidgets.git] / src / common / list.cpp
index 4eaf11949ecfb039fdc6c32d5f6de48e9ce66987..a98385159dc3b7d2f80fea8b1729654e1422abac 100644 (file)
@@ -292,7 +292,7 @@ wxNodeBase *wxListBase::Item(size_t n) const
         }
     }
 
-//    wxFAIL_MSG( "invalid index in wxListBase::Item" );
+    wxFAIL_MSG( "invalid index in wxListBase::Item" );
 
     return (wxNodeBase *)NULL;
 }
@@ -397,7 +397,6 @@ bool wxListBase::DeleteObject(void *object)
     return FALSE;
 }
 
-
 void wxListBase::Clear()
 {
     wxNodeBase *current = m_nodeFirst;
@@ -520,6 +519,23 @@ void wxStringListNode::DeleteData()
     delete [] (char *)GetData();
 }
 
+bool wxStringList::Delete(const char *s)
+{
+    wxStringListNode *current;
+
+    for ( current = GetFirst(); current; current = current->GetNext() )
+    {
+        if ( strcmp(current->GetData(), s) == 0 )
+        {
+            DeleteNode(current);
+            return TRUE;
+        }
+    }
+
+    // not found
+    return FALSE;
+}
+
 void wxStringList::DoCopy(const wxStringList& other)
 {
     wxASSERT( GetCount() == 0 );    // this list must be empty before copying!
@@ -612,11 +628,11 @@ void wxStringList::Sort()
     }
 
     qsort (array, N, sizeof (char *), wx_comparestrings);
-    Clear();
 
-    for (i = 0; i < N; i++)
-        Append (array[i]);
+    i = 0;
+    for ( node = GetFirst(); node; node = node->GetNext() )
+        node->SetData( array[i++] );
 
-    delete[]array;
+    delete [] array;
 }