- virtual void Copy(wxVariantData& data);
- 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
+wxVariant::wxVariant(short val, const wxString& name)
+{
+ m_data = new wxVariantDataLong((long)val);
+ m_name = name;
+}
+
+bool wxVariant::operator== (long value) const
+{
+ 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_data->GetRefCount() == 1)
+ {
+ ((wxVariantDataLong*)GetData())->SetValue(value);
+ }
+ else
+ {
+ UnRef();
+ m_data = 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
+{
+DECLARE_DYNAMIC_CLASS(wxVariantDoubleData)
+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