corrected (?) wxStringList::Delete()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1184 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 1998-12-12 22:05:02 +00:00
parent abacc20c32
commit f0824a5a4a
2 changed files with 18 additions and 3 deletions

View File

@ -475,8 +475,7 @@ public:
wxNode *Add(const char *s) wxNode *Add(const char *s)
{ return (wxNode *)wxStringListBase::Append(copystring(s)); } { return (wxNode *)wxStringListBase::Append(copystring(s)); }
void Delete(const char *s) bool Delete(const char *s);
{ wxStringListBase::DeleteObject((char *)s); }
char **ListToArray(bool new_copies = FALSE) const; char **ListToArray(bool new_copies = FALSE) const;
bool Member(const char *s) const; bool Member(const char *s) const;

View File

@ -397,7 +397,6 @@ bool wxListBase::DeleteObject(void *object)
return FALSE; return FALSE;
} }
void wxListBase::Clear() void wxListBase::Clear()
{ {
wxNodeBase *current = m_nodeFirst; wxNodeBase *current = m_nodeFirst;
@ -520,6 +519,23 @@ void wxStringListNode::DeleteData()
delete [] (char *)GetData(); 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) void wxStringList::DoCopy(const wxStringList& other)
{ {
wxASSERT( GetCount() == 0 ); // this list must be empty before copying! wxASSERT( GetCount() == 0 ); // this list must be empty before copying!