+ long thisValue;
+ if (!Convert(&thisValue))
+ return false;
+ else
+ return (value == thisValue);
+}
+
+bool wxVariant::operator!= (long value) const
+{
+ return (!((*this) == value));
+}
+
+void wxVariant::operator= (long value)
+{
+ if (GetType() == wxT("long") &&
+ m_refData->GetRefCount() == 1)
+ {
+ ((wxVariantDataLong*)GetData())->SetValue(value);
+ }
+ else
+ {
+ UnRef();
+ m_refData = new wxVariantDataLong(value);
+ }
+}
+
+long wxVariant::GetLong() const
+{
+ long value;
+ if (Convert(& value))
+ return value;
+ else
+ {
+ wxFAIL_MSG(wxT("Could not convert to a long"));
+ return 0;
+ }
+}
+
+// -----------------------------------------------------------------
+// wxVariantDoubleData
+// -----------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxVariantDoubleData: public wxVariantData
+{
+public:
+ wxVariantDoubleData() { m_value = 0.0; }
+ wxVariantDoubleData(double value) { m_value = value; }
+
+ inline double GetValue() const { return m_value; }
+ inline void SetValue(double value) { m_value = value; }
+
+ virtual bool Eq(wxVariantData& data) const;
+ virtual bool Read(wxString& str);
+#if wxUSE_STD_IOSTREAM
+ virtual bool Write(wxSTD ostream& str) const;
+#endif
+ virtual bool Write(wxString& str) const;
+#if wxUSE_STD_IOSTREAM
+ virtual bool Read(wxSTD istream& str);
+#endif
+#if wxUSE_STREAMS
+ virtual bool Read(wxInputStream& str);
+ virtual bool Write(wxOutputStream &str) const;
+#endif // wxUSE_STREAMS
+ virtual wxString GetType() const { return wxT("double"); }
+
+ wxVariantData* Clone() const { return new wxVariantDoubleData(m_value); }
+
+ DECLARE_WXANY_CONVERSION()
+protected:
+ double m_value;
+};
+
+IMPLEMENT_TRIVIAL_WXANY_CONVERSION(double, wxVariantDoubleData)
+
+bool wxVariantDoubleData::Eq(wxVariantData& data) const
+{
+ wxASSERT_MSG( (data.GetType() == wxT("double")), wxT("wxVariantDoubleData::Eq: argument mismatch") );
+
+ wxVariantDoubleData& otherData = (wxVariantDoubleData&) data;
+
+ return wxIsSameDouble(otherData.m_value, m_value);
+}
+
+#if wxUSE_STD_IOSTREAM
+bool wxVariantDoubleData::Write(wxSTD ostream& str) const
+{
+ wxString s;
+ Write(s);
+ str << (const char*) s.mb_str();
+ return true;