X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68ee7c47300b37e408ef9a04ec9f83af78e90817..4a45223c970eabf6ba66347129627775935c90b3:/src/common/variant.cpp?ds=sidebyside diff --git a/src/common/variant.cpp b/src/common/variant.cpp index a3ee8bf67f..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) @@ -387,7 +390,7 @@ bool wxVariantDataLong::Write(wxOutputStream& str) const { wxTextOutputStream s(str); - s.Write32(m_value); + s.Write32((size_t)m_value); return TRUE; } @@ -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 +