Use wxVariant::IsType() function to check the type of variant values in wxPG.

Since there is a dedicated function to check the type of variant then there is not necessary to call wxVariant::GetType() function and perform explicit comparisons of returned strings.
This commit is contained in:
Artur Wieczorek
2015-03-29 21:36:12 +02:00
parent e4ea660dfd
commit 5353a00180
7 changed files with 27 additions and 27 deletions

View File

@@ -327,7 +327,7 @@ bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int
bool wxIntProperty::IntToValue( wxVariant& variant, int value, int WXUNUSED(argFlags) ) const
{
if ( variant.GetType() != wxPG_VARIANT_TYPE_LONG || variant != (long)value )
if ( !variant.IsType(wxPG_VARIANT_TYPE_LONG) || variant != (long)value )
{
variant = (long)value;
return true;
@@ -640,7 +640,7 @@ wxString wxUIntProperty::ValueToString( wxVariant& value,
if ( index >= wxPG_UINT_TEMPLATE_MAX )
index = wxPG_UINT_DEC;
if ( value.GetType() == wxPG_VARIANT_TYPE_LONG )
if (value.IsType(wxPG_VARIANT_TYPE_LONG))
{
return wxString::Format(gs_uintTemplates32[index],
(unsigned long)value.GetLong());
@@ -1223,7 +1223,7 @@ bool wxEnumProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& WXUNUS
// Make sure string value is in the list,
// unless property has string as preferred value type
// To reduce code size, use conversion here as well
if ( value.GetType() == wxPG_VARIANT_TYPE_STRING )
if ( value.IsType(wxPG_VARIANT_TYPE_STRING) )
return ValueFromString_(value, NULL, value.GetString(), wxPG_PROPERTY_SPECIFIC);
return true;
@@ -1232,7 +1232,7 @@ bool wxEnumProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& WXUNUS
wxString wxEnumProperty::ValueToString( wxVariant& value,
int WXUNUSED(argFlags) ) const
{
if ( value.GetType() == wxPG_VARIANT_TYPE_STRING )
if ( value.IsType(wxPG_VARIANT_TYPE_STRING) )
return value.GetString();
int index = m_choices.Index(value.GetLong());