X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd0b170911637899ac3c126367ee5821f357c185..4def3b359546ee186b3db723db719f85b761f36a:/src/common/variant.cpp?ds=sidebyside diff --git a/src/common/variant.cpp b/src/common/variant.cpp index ccc6b92526..a0c5b4bdab 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -11,6 +11,8 @@ #ifdef __GNUG__ #pragma implementation "variant.h" +#pragma implementation "time.h" +#pragma implementation "date.h" #endif // For compilers that support precompilation, includes "wx/wx.h". @@ -36,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) @@ -385,7 +390,7 @@ bool wxVariantDataLong::Write(wxOutputStream& str) const { wxTextOutputStream s(str); - s.Write32(m_value); + s.Write32((size_t)m_value); return TRUE; } @@ -826,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 { @@ -1133,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); @@ -1346,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 @@ -1437,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 @@ -1471,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 @@ -1502,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) @@ -1661,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 { @@ -1870,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()); @@ -1896,3 +1903,4 @@ bool wxVariant::Convert(wxDate* value) const } #endif // wxUSE_TIMEDATE +