X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/479cd5de40ca8029c79e780170fa7c0af7ec0297..2ec6905c69c73f908533697c770c690657f4371c:/src/common/variant.cpp diff --git a/src/common/variant.cpp b/src/common/variant.cpp index a8ab35073d..a0c5b4bdab 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -38,11 +38,14 @@ #include "wx/string.h" #include "wx/variant.h" +#if wxUSE_TIMEDATE IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject) wxTime::tFormat wxTime::ms_Format = wxTime::wx12h; wxTime::tPrecision wxTime::ms_Precision = wxTime::wxStdMinSec; +wxChar wxTime::ms_bufTime[128]; +#endif IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject) @@ -828,7 +831,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxVariantDataString, wxVariantData) * wxVariantDataTime */ -#if wxUSE_TIMEDATE +// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled +#if wxUSE_TIMEDATE && !defined(__WATCOMC__) class wxVariantDataTime: public wxVariantData { @@ -1135,7 +1139,8 @@ wxVariant::wxVariant(const wxList& val, const wxString& name) // List of variant m_name = name; } -#if wxUSE_TIMEDATE +// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled +#if wxUSE_TIMEDATE && !defined(__WATCOMC__) wxVariant::wxVariant(const wxTime& val, const wxString& name) // Time { m_data = new wxVariantDataTime(val); @@ -1348,8 +1353,8 @@ bool wxVariant::operator== (const wxString& value) const wxString thisValue; if (!Convert(&thisValue)) return FALSE; - else - return (value == thisValue); + + return value == thisValue; } bool wxVariant::operator!= (const wxString& value) const @@ -1439,14 +1444,15 @@ void wxVariant::operator= (const wxList& value) } } -#if wxUSE_TIMEDATE +// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled +#if wxUSE_TIMEDATE && !defined(__WATCOMC__) bool wxVariant::operator== (const wxTime& value) const { wxTime thisValue; if (!Convert(&thisValue)) return FALSE; - else - return (value == thisValue); + + return value == thisValue; } bool wxVariant::operator!= (const wxTime& value) const @@ -1473,8 +1479,8 @@ bool wxVariant::operator== (const wxDate& value) const wxDate thisValue; if (!Convert(&thisValue)) return FALSE; - else - return (value == thisValue); + + return (value == thisValue); } bool wxVariant::operator!= (const wxDate& value) const @@ -1504,7 +1510,7 @@ bool wxVariant::operator== (void* value) const bool wxVariant::operator!= (void* value) const { - return (!((*this) == value)); + return (!((*this) == (void*) value)); } void wxVariant::operator= (void* value) @@ -1663,40 +1669,38 @@ bool wxVariant::GetBool() const wxString wxVariant::GetString() const { wxString value; - if (Convert(& value)) - return value; - else + if (!Convert(& value)) { wxFAIL_MSG(wxT("Could not convert to a string")); - return wxString(""); } + + return value; } -#if wxUSE_TIMEDATE +// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled +#if wxUSE_TIMEDATE && !defined(__WATCOMC__) wxTime wxVariant::GetTime() const { wxTime value; - if (Convert(& value)) - return value; - else + if (!Convert(& value)) { wxFAIL_MSG(wxT("Could not convert to a time")); - return wxTime(); } + + return value; } wxDate wxVariant::GetDate() const { wxDate value; - if (Convert(& value)) - return value; - else + if (!Convert(& value)) { wxFAIL_MSG(wxT("Could not convert to a date")); - return wxDate(); } + + return value; } -#endif +#endif // wxUSE_TIMEDATE void* wxVariant::GetVoidPtr() const { @@ -1872,7 +1876,8 @@ bool wxVariant::Convert(wxString* value) const return TRUE; } -#if wxUSE_TIMEDATE +// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled +#if wxUSE_TIMEDATE && !defined(__WATCOMC__) bool wxVariant::Convert(wxTime* value) const { wxString type(GetType()); @@ -1898,3 +1903,4 @@ bool wxVariant::Convert(wxDate* value) const } #endif // wxUSE_TIMEDATE +