X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/137b730319c304f99a7b0dcd441c0fe332aa11b2..3db5226517a63bcdc983e638f1a312764fe1312f:/src/common/list.cpp diff --git a/src/common/list.cpp b/src/common/list.cpp index 9532eac9ca..42368c0e51 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -17,10 +17,6 @@ // headers // ----------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "list.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -147,7 +143,7 @@ void wxListBase::Init(wxKeyType keyType) m_nodeFirst = m_nodeLast = (wxNodeBase *) NULL; m_count = 0; - m_destroy = FALSE; + m_destroy = false; m_keyType = keyType; } @@ -345,7 +341,7 @@ wxNodeBase *wxListBase::Find(const wxListKey& key) const return (wxNodeBase *)NULL; } -wxNodeBase *wxListBase::Find(void *object) const +wxNodeBase *wxListBase::Find(const void *object) const { for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() ) { @@ -408,11 +404,11 @@ wxNodeBase *wxListBase::DetachNode(wxNodeBase *node) bool wxListBase::DeleteNode(wxNodeBase *node) { if ( !DetachNode(node) ) - return FALSE; + return false; DoDeleteNode(node); - return TRUE; + return true; } bool wxListBase::DeleteObject(void *object) @@ -422,12 +418,12 @@ bool wxListBase::DeleteObject(void *object) if ( current->GetData() == object ) { DeleteNode(current); - return TRUE; + return true; } } // not found - return FALSE; + return false; } void wxListBase::Clear() @@ -594,12 +590,6 @@ void wxObjectListNode::DeleteData() // 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]; @@ -624,12 +614,12 @@ bool wxStringList::Delete(const wxChar *s) if ( wxStrcmp(current->GetData(), s) == 0 ) { DeleteNode(current); - return TRUE; + return true; } } // not found - return FALSE; + return false; } void wxStringList::DoCopy(const wxStringList& other) @@ -645,14 +635,14 @@ void wxStringList::DoCopy(const wxStringList& other) wxStringList::wxStringList() { - DeleteContents(TRUE); + DeleteContents(true); } // Variable argument list, terminated by a zero // Makes new storage for the strings wxStringList::wxStringList (const wxChar *first, ...) { - DeleteContents(TRUE); + DeleteContents(true); if ( !first ) return; @@ -664,20 +654,26 @@ wxStringList::wxStringList (const wxChar *first, ...) { Add(s); + // icc gives this warning in its own va_arg() macro, argh +#ifdef __INTELC__ + #pragma warning(push) + #pragma warning(disable: 1684) +#endif + s = va_arg(ap, const wxChar *); - // if (s == NULL) -#ifdef __WXMSW__ - if ((int)(long) s == 0) -#else - if ((long) s == 0) + +#ifdef __INTELC__ + #pragma warning(pop) #endif + + if ( !s ) break; } va_end(ap); } -// Only makes new strings if arg is TRUE +// Only makes new strings if arg is true wxChar **wxStringList::ListToArray(bool new_copies) const { wxChar **string_array = new wxChar *[GetCount()]; @@ -702,10 +698,10 @@ bool wxStringList::Member(const wxChar *s) const { const wxChar *s1 = node->GetData(); if (s == s1 || wxStrcmp (s, s1) == 0) - return TRUE; + return true; } - return FALSE; + return false; } #ifdef __WXWINCE__ @@ -748,7 +744,7 @@ wxNode *wxStringList::Add(const wxChar *s) { return (wxNode *)wxStringListBase::Append(MYcopystring(s)); } - + wxNode *wxStringList::Prepend(const wxChar *s) { return (wxNode *)wxStringListBase::Insert(MYcopystring(s)); @@ -756,4 +752,15 @@ wxNode *wxStringList::Prepend(const wxChar *s) #endif // wxLIST_COMPATIBILITY +#else // wxUSE_STL = 1 + + #include + WX_DEFINE_LIST(wxObjectList); + +// with wxUSE_STL wxStringList contains wxString objects, not pointers +void wxStringListBase::DeleteFunction( const wxString WXUNUSED(X) ) +{ +} + #endif // !wxUSE_STL +