Added better asserts, helps with debugging strange wxVariant issues

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli 2009-06-06 15:27:55 +00:00
parent 756c98b02e
commit 45e82d4ceb

View File

@ -589,14 +589,24 @@ expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
} \ } \
expdecl classname& classname##RefFromVariant( wxVariant& variant ) \ expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
{ \ { \
wxASSERT( variant.GetType() == #classname );\ wxASSERT_MSG( variant.GetType() == wxS(#classname), \
classname##VariantData *data = (classname##VariantData*) variant.GetData();\ wxString::Format("Variant type should have been '%s'" \
"instead of '%s'", \
wxS(#classname), \
variant.GetType().c_str())); \
classname##VariantData *data = \
(classname##VariantData*) variant.GetData(); \
return data->GetValue();\ return data->GetValue();\
} \ } \
expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \ expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
{ \ { \
wxASSERT( variant.GetType() == #classname );\ wxASSERT_MSG( variant.GetType() == wxS(#classname), \
classname##VariantData *data = (classname##VariantData*) variant.GetData();\ wxString::Format("Variant type should have been '%s'" \
"instead of '%s'", \
wxS(#classname), \
variant.GetType().c_str())); \
classname##VariantData *data = \
(classname##VariantData*) variant.GetData(); \
return data->GetValue();\ return data->GetValue();\
} }