projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
documented static_data parameter of SetAlpha()
[wxWidgets.git]
/
src
/
common
/
variant.cpp
diff --git
a/src/common/variant.cpp
b/src/common/variant.cpp
index 6df6999ab156392f7fd7e4282070fd0d1779805b..466d35983017584a04704b8e684918d7ca0ceeff 100644
(file)
--- a/
src/common/variant.cpp
+++ b/
src/common/variant.cpp
@@
-164,7
+164,7
@@
bool wxVariantDataList::Write(wxSTD ostream& str) const
bool wxVariantDataList::Write(wxString& str) const
{
bool wxVariantDataList::Write(wxString& str) const
{
- str = wx
T("")
;
+ str = wx
EmptyString
;
wxList::compatibility_iterator node = m_value.GetFirst();
while (node)
{
wxList::compatibility_iterator node = m_value.GetFirst();
while (node)
{
@@
-194,6
+194,7
@@
bool wxVariantDataList::Read(wxString& WXUNUSED(str))
// TODO
return false;
}
// TODO
return false;
}
+#if WXWIN_COMPATIBILITY_2_4
/*
* wxVariantDataStringList
/*
* wxVariantDataStringList
@@
-303,6
+304,8
@@
bool wxVariantDataStringList::Read(wxString& WXUNUSED(str))
return false;
}
return false;
}
+#endif //2.4 compat
+
/*
* wxVariantDataLong
*/
/*
* wxVariantDataLong
*/
@@
-1248,12
+1251,16
@@
wxVariant::wxVariant(const wxChar* val, const wxString& name)
m_name = name;
}
m_name = name;
}
+#if WXWIN_COMPATIBILITY_2_4
+
wxVariant::wxVariant(const wxStringList& val, const wxString& name)
{
m_data = new wxVariantDataStringList(val);
m_name = name;
}
wxVariant::wxVariant(const wxStringList& val, const wxString& name)
{
m_data = new wxVariantDataStringList(val);
m_name = name;
}
+#endif
+
wxVariant::wxVariant(const wxList& val, const wxString& name) // List of variants
{
m_data = new wxVariantDataList(val);
wxVariant::wxVariant(const wxList& val, const wxString& name) // List of variants
{
m_data = new wxVariantDataList(val);
@@
-1539,6
+1546,8
@@
void wxVariant::operator= (const wxChar* value)
}
}
}
}
+#if WXWIN_COMPATIBILITY_2_4
+
bool wxVariant::operator== (const wxStringList& value) const
{
wxASSERT_MSG( (GetType() == wxT("stringlist")), wxT("Invalid type for == operator") );
bool wxVariant::operator== (const wxStringList& value) const
{
wxASSERT_MSG( (GetType() == wxT("stringlist")), wxT("Invalid type for == operator") );
@@
-1549,7
+1558,10
@@
bool wxVariant::operator== (const wxStringList& value) const
bool wxVariant::operator!= (const wxStringList& value) const
{
bool wxVariant::operator!= (const wxStringList& value) const
{
- return (!((*this) == value));
+ wxASSERT_MSG( (GetType() == wxT("stringlist")), wxT("Invalid type for == operator") );
+
+ wxVariantDataStringList other(value);
+ return !(m_data->Eq(other));
}
void wxVariant::operator= (const wxStringList& value)
}
void wxVariant::operator= (const wxStringList& value)
@@
-1566,6
+1578,8
@@
void wxVariant::operator= (const wxStringList& value)
}
}
}
}
+#endif
+
bool wxVariant::operator== (const wxList& value) const
{
wxASSERT_MSG( (GetType() == wxT("list")), wxT("Invalid type for == operator") );
bool wxVariant::operator== (const wxList& value) const
{
wxASSERT_MSG( (GetType() == wxT("list")), wxT("Invalid type for == operator") );
@@
-1710,7
+1724,11
@@
wxArrayString wxVariant::GetArrayString() const
// Treat a list variant as an array
wxVariant wxVariant::operator[] (size_t idx) const
{
// Treat a list variant as an array
wxVariant wxVariant::operator[] (size_t idx) const
{
+#if WXWIN_COMPATIBILITY_2_4
wxASSERT_MSG( (GetType() == wxT("list") || GetType() == wxT("stringlist")), wxT("Invalid type for array operator") );
wxASSERT_MSG( (GetType() == wxT("list") || GetType() == wxT("stringlist")), wxT("Invalid type for array operator") );
+#else
+ wxASSERT_MSG( GetType() == wxT("list"), wxT("Invalid type for array operator") );
+#endif
if (GetType() == wxT("list"))
{
if (GetType() == wxT("list"))
{
@@
-1718,6
+1736,7
@@
wxVariant wxVariant::operator[] (size_t idx) const
wxASSERT_MSG( (idx < (size_t) data->GetValue().GetCount()), wxT("Invalid index for array") );
return * (wxVariant*) (data->GetValue().Item(idx)->GetData());
}
wxASSERT_MSG( (idx < (size_t) data->GetValue().GetCount()), wxT("Invalid index for array") );
return * (wxVariant*) (data->GetValue().Item(idx)->GetData());
}
+#if WXWIN_COMPATIBILITY_2_4
else if (GetType() == wxT("stringlist"))
{
wxVariantDataStringList* data = (wxVariantDataStringList*) m_data;
else if (GetType() == wxT("stringlist"))
{
wxVariantDataStringList* data = (wxVariantDataStringList*) m_data;
@@
-1727,6
+1746,7
@@
wxVariant wxVariant::operator[] (size_t idx) const
wxVariant variant( str );
return variant;
}
wxVariant variant( str );
return variant;
}
+#endif
return wxNullVariant;
}
return wxNullVariant;
}
@@
-1746,18
+1766,24
@@
wxVariant& wxVariant::operator[] (size_t idx)
// Return the number of elements in a list
int wxVariant::GetCount() const
{
// Return the number of elements in a list
int wxVariant::GetCount() const
{
+#if WXWIN_COMPATIBILITY_2_4
wxASSERT_MSG( (GetType() == wxT("list") || GetType() == wxT("stringlist")), wxT("Invalid type for GetCount()") );
wxASSERT_MSG( (GetType() == wxT("list") || GetType() == wxT("stringlist")), wxT("Invalid type for GetCount()") );
+#else
+ wxASSERT_MSG( GetType() == wxT("list"), wxT("Invalid type for GetCount()") );
+#endif
if (GetType() == wxT("list"))
{
wxVariantDataList* data = (wxVariantDataList*) m_data;
return data->GetValue().GetCount();
}
if (GetType() == wxT("list"))
{
wxVariantDataList* data = (wxVariantDataList*) m_data;
return data->GetValue().GetCount();
}
+#if WXWIN_COMPATIBILITY_2_4
else if (GetType() == wxT("stringlist"))
{
wxVariantDataStringList* data = (wxVariantDataStringList*) m_data;
return data->GetValue().GetCount();
}
else if (GetType() == wxT("stringlist"))
{
wxVariantDataStringList* data = (wxVariantDataStringList*) m_data;
return data->GetValue().GetCount();
}
+#endif
return 0;
}
return 0;
}
@@
-1769,7
+1795,7
@@
wxString wxVariant::MakeString() const
if (GetData()->Write(str))
return str;
}
if (GetData()->Write(str))
return str;
}
- return wx
String(wxT(""))
;
+ return wx
EmptyString
;
}
// Accessors
}
// Accessors
@@
-1782,7
+1808,7
@@
void wxVariant::SetData(wxVariantData* data)
// Returns a string representing the type of the variant,
// Returns a string representing the type of the variant,
-// e.g. "string", "bool", "
stringlist", "
list", "double", "long"
+// e.g. "string", "bool", "list", "double", "long"
wxString wxVariant::GetType() const
{
if (IsNull())
wxString wxVariant::GetType() const
{
if (IsNull())
@@
-1897,6
+1923,8
@@
wxList& wxVariant::GetList() const
return (wxList&) ((wxVariantDataList*) m_data)->GetValue();
}
return (wxList&) ((wxVariantDataList*) m_data)->GetValue();
}
+#if WXWIN_COMPATIBILITY_2_4
+
wxStringList& wxVariant::GetStringList() const
{
wxASSERT( (GetType() == wxT("stringlist")) );
wxStringList& wxVariant::GetStringList() const
{
wxASSERT( (GetType() == wxT("stringlist")) );
@@
-1904,6
+1932,8
@@
wxStringList& wxVariant::GetStringList() const
return (wxStringList&) ((wxVariantDataStringList*) m_data)->GetValue();
}
return (wxStringList&) ((wxVariantDataStringList*) m_data)->GetValue();
}
+#endif
+
// Make empty list
void wxVariant::NullList()
{
// Make empty list
void wxVariant::NullList()
{
@@
-1964,7
+1994,7
@@
void wxVariant::ClearList()
}
else
{
}
else
{
- if (
GetType() != wxT("list"
))
+ if (
!GetType().IsSameAs(wxT("list")
))
{
delete m_data;
m_data = NULL;
{
delete m_data;
m_data = NULL;
@@
-2074,7
+2104,8
@@
bool wxVariant::Convert(wxDateTime* value) const
}
// Fallback to string conversion
wxString val;
}
// Fallback to string conversion
wxString val;
- return Convert(&val) && (value->ParseDate(val));
+ return Convert(&val) &&
+ (value->ParseDateTime(val) || value->ParseDate(val));
}
#endif // wxUSE_DATETIME
}
#endif // wxUSE_DATETIME