/////////////////////////////////////////////////////////////////////////////
-// Name: variant.cpp
+// Name: src/common/variant.cpp
// Purpose: wxVariant class, container for any type
// Author: Julian Smart
// Modified by:
wxVariantDataList(const wxList& list);
~wxVariantDataList();
- wxList& GetValue() const { return m_value; }
+ wxList& GetValue() { return m_value; }
void SetValue(const wxList& value) ;
virtual void Copy(wxVariantData& data);
bool wxVariantDataReal::Write(wxString& str) const
{
- str.Printf(wxT("%.4f"), m_value);
+ str.Printf(wxT("%.14g"), m_value);
return true;
}
bool wxVariantDataChar::Read(wxString& str)
{
- m_value = str.ToAscii()[0u];
+ m_value = str.ToAscii()[size_t(0)];
return true;
}
if (GetType() == wxT("list"))
{
wxVariantDataList* data = (wxVariantDataList*) m_data;
- wxASSERT_MSG( (idx < (size_t) data->GetValue().GetCount()), wxT("Invalid index for array") );
+ wxASSERT_MSG( (idx < 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;
- wxASSERT_MSG( (idx < (size_t) data->GetValue().GetCount()), wxT("Invalid index for array") );
+ wxASSERT_MSG( (idx < data->GetValue().GetCount()), wxT("Invalid index for array") );
wxString str( (const wxChar*) (data->GetValue().Item(idx)->GetData()) );
wxVariant variant( str );
wxASSERT_MSG( (GetType() == wxT("list")), wxT("Invalid type for array operator") );
wxVariantDataList* data = (wxVariantDataList*) m_data;
- wxASSERT_MSG( (idx < (size_t) data->GetValue().GetCount()), wxT("Invalid index for array") );
+ wxASSERT_MSG( (idx < data->GetValue().GetCount()), wxT("Invalid index for array") );
return * (wxVariant*) (data->GetValue().Item(idx)->GetData());
}
// Return the number of elements in a list
-int wxVariant::GetCount() const
+size_t wxVariant::GetCount() const
{
#if WXWIN_COMPATIBILITY_2_4
wxASSERT_MSG( (GetType() == wxT("list") || GetType() == wxT("stringlist")), wxT("Invalid type for GetCount()") );
}
// Deletes the nth element of the list
-bool wxVariant::Delete(int item)
+bool wxVariant::Delete(size_t item)
{
wxList& list = GetList();
- wxASSERT_MSG( (item < (int) list.GetCount()), wxT("Invalid index to Delete") );
+ wxASSERT_MSG( (item < list.GetCount()), wxT("Invalid index to Delete") );
wxList::compatibility_iterator node = list.Item(item);
wxVariant* variant = (wxVariant*) node->GetData();
delete variant;
(value->ParseDateTime(val) || value->ParseDate(val));
}
#endif // wxUSE_DATETIME
-