X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f124ddf4502341eb60d41d27da7f24f4ae9fd25c..b6a20a20d010d643e52914f51aa0700df0da925f:/src/common/variant.cpp diff --git a/src/common/variant.cpp b/src/common/variant.cpp index d2dd9665ba..79f7c116a7 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "variant.h" #endif @@ -44,13 +44,13 @@ using namespace std ; IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject) -wxVariant WXDLLEXPORT wxNullVariant; +wxVariant WXDLLIMPEXP_BASE wxNullVariant; /* * wxVariantDataList */ -class WXDLLEXPORT wxVariantDataList: public wxVariantData +class WXDLLIMPEXP_BASE wxVariantDataList: public wxVariantData { DECLARE_DYNAMIC_CLASS(wxVariantDataList) public: @@ -94,7 +94,7 @@ wxVariantDataList::~wxVariantDataList() void wxVariantDataList::SetValue(const wxList& value) { Clear(); - wxNode* node = value.GetFirst(); + wxList::compatibility_iterator node = value.GetFirst(); while (node) { wxVariant* var = (wxVariant*) node->GetData(); @@ -105,7 +105,7 @@ void wxVariantDataList::SetValue(const wxList& value) void wxVariantDataList::Clear() { - wxNode* node = m_value.GetFirst(); + wxList::compatibility_iterator node = m_value.GetFirst(); while (node) { wxVariant* var = (wxVariant*) node->GetData(); @@ -122,7 +122,7 @@ void wxVariantDataList::Copy(wxVariantData& data) wxVariantDataList& listData = (wxVariantDataList&) data; listData.Clear(); - wxNode* node = m_value.GetFirst(); + wxList::compatibility_iterator node = m_value.GetFirst(); while (node) { wxVariant* var = (wxVariant*) node->GetData(); @@ -136,8 +136,8 @@ bool wxVariantDataList::Eq(wxVariantData& data) const wxASSERT_MSG( (data.GetType() == wxT("list")), wxT("wxVariantDataList::Eq: argument mismatch") ); wxVariantDataList& listData = (wxVariantDataList&) data; - wxNode* node1 = m_value.GetFirst(); - wxNode* node2 = listData.GetValue().GetFirst(); + wxList::compatibility_iterator node1 = m_value.GetFirst(); + wxList::compatibility_iterator node2 = listData.GetValue().GetFirst(); while (node1 && node2) { wxVariant* var1 = (wxVariant*) node1->GetData(); @@ -164,7 +164,7 @@ bool wxVariantDataList::Write(wxSTD ostream& str) const bool wxVariantDataList::Write(wxString& str) const { str = wxT(""); - wxNode* node = m_value.GetFirst(); + wxList::compatibility_iterator node = m_value.GetFirst(); while (node) { wxVariant* var = (wxVariant*) node->GetData(); @@ -198,7 +198,7 @@ bool wxVariantDataList::Read(wxString& WXUNUSED(str)) * wxVariantDataStringList */ -class WXDLLEXPORT wxVariantDataStringList: public wxVariantData +class WXDLLIMPEXP_BASE wxVariantDataStringList: public wxVariantData { DECLARE_DYNAMIC_CLASS(wxVariantDataStringList) public: @@ -245,8 +245,8 @@ bool wxVariantDataStringList::Eq(wxVariantData& data) const wxASSERT_MSG( (data.GetType() == wxT("stringlist")), wxT("wxVariantDataStringList::Eq: argument mismatch") ); wxVariantDataStringList& listData = (wxVariantDataStringList&) data; - wxStringList::Node *node1 = m_value.GetFirst(); - wxStringList::Node *node2 = listData.GetValue().GetFirst(); + wxStringList::compatibility_iterator node1 = m_value.GetFirst(); + wxStringList::compatibility_iterator node2 = listData.GetValue().GetFirst(); while (node1 && node2) { wxString str1 ( node1->GetData() ); @@ -273,10 +273,10 @@ bool wxVariantDataStringList::Write(wxSTD ostream& str) const bool wxVariantDataStringList::Write(wxString& str) const { str.Empty(); - wxStringList::Node *node = m_value.GetFirst(); + wxStringList::compatibility_iterator node = m_value.GetFirst(); while (node) { - wxChar* s = node->GetData(); + const wxChar* s = node->GetData(); if (node != m_value.GetFirst()) str += wxT(" "); str += s; @@ -306,7 +306,7 @@ bool wxVariantDataStringList::Read(wxString& WXUNUSED(str)) * wxVariantDataLong */ -class WXDLLEXPORT wxVariantDataLong: public wxVariantData +class WXDLLIMPEXP_BASE wxVariantDataLong: public wxVariantData { DECLARE_DYNAMIC_CLASS(wxVariantDataLong) public: @@ -407,7 +407,7 @@ bool wxVariantDataLong::Read(wxString& str) * wxVariantDataReal */ -class WXDLLEXPORT wxVariantDataReal: public wxVariantData +class WXDLLIMPEXP_BASE wxVariantDataReal: public wxVariantData { DECLARE_DYNAMIC_CLASS(wxVariantDataReal) public: @@ -508,7 +508,7 @@ bool wxVariantDataReal::Read(wxString& str) * wxVariantDataBool */ -class WXDLLEXPORT wxVariantDataBool: public wxVariantData +class WXDLLIMPEXP_BASE wxVariantDataBool: public wxVariantData { DECLARE_DYNAMIC_CLASS(wxVariantDataBool) public: @@ -612,7 +612,7 @@ bool wxVariantDataBool::Read(wxString& str) * wxVariantDataChar */ -class WXDLLEXPORT wxVariantDataChar: public wxVariantData +class WXDLLIMPEXP_BASE wxVariantDataChar: public wxVariantData { DECLARE_DYNAMIC_CLASS(wxVariantDataChar) public: @@ -713,18 +713,9 @@ bool wxVariantDataChar::Read(wxString& str) * wxVariantDataString */ -#if defined(__BORLANDC__) && defined(__WIN16__) -// Change name because of truncation -#define wxVariantDataString wxVariantStringData -#endif - -class WXDLLEXPORT wxVariantDataString: public wxVariantData +class WXDLLIMPEXP_BASE wxVariantDataString: public wxVariantData { -#if defined(__BORLANDC__) && defined(__WIN16__) -DECLARE_DYNAMIC_CLASS(wxVariantStringData) -#else DECLARE_DYNAMIC_CLASS(wxVariantDataString) -#endif public: wxVariantDataString() { } wxVariantDataString(const wxString& value) { m_value = value; } @@ -816,11 +807,7 @@ bool wxVariantDataString::Read(wxString& str) return TRUE; } -#if defined(__BORLANDC__) && defined(__WIN16__) -IMPLEMENT_DYNAMIC_CLASS(wxVariantStringData, wxVariantData) -#else IMPLEMENT_DYNAMIC_CLASS(wxVariantDataString, wxVariantData) -#endif /* * wxVariantDataVoidPtr @@ -1735,7 +1722,7 @@ wxVariant wxVariant::operator[] (size_t idx) const wxVariantDataStringList* data = (wxVariantDataStringList*) m_data; wxASSERT_MSG( (idx < (size_t) data->GetValue().GetCount()), wxT("Invalid index for array") ); - wxVariant variant( wxString( (wxChar*) (data->GetValue().Item(idx)->GetData()) )); + wxVariant variant( wxString( (const wxChar*) (data->GetValue().Item(idx)->GetData()) )); return variant; } return wxNullVariant; @@ -1942,7 +1929,7 @@ bool wxVariant::Member(const wxVariant& value) const { wxList& list = GetList(); - wxNode* node = list.GetFirst(); + wxList::compatibility_iterator node = list.GetFirst(); while (node) { wxVariant* other = (wxVariant*) node->GetData(); @@ -1959,10 +1946,10 @@ bool wxVariant::Delete(int item) wxList& list = GetList(); wxASSERT_MSG( (item < (int) list.GetCount()), wxT("Invalid index to Delete") ); - wxNode* node = list.Item(item); + wxList::compatibility_iterator node = list.Item(item); wxVariant* variant = (wxVariant*) node->GetData(); delete variant; - delete node; + list.Erase(node); return TRUE; } @@ -2019,9 +2006,9 @@ bool wxVariant::Convert(bool* value) const { wxString val(((wxVariantDataString*)GetData())->GetValue()); val.MakeLower(); - if (val == wxT("TRUE") || val == wxT("yes")) + if (val == wxT("true") || val == wxT("yes")) *value = TRUE; - else if (val == wxT("FALSE") || val == wxT("no")) + else if (val == wxT("false") || val == wxT("no")) *value = FALSE; else return FALSE;