Remove unneeded calls to c_str()

This commit is contained in:
Artur Wieczorek
2018-11-10 20:44:53 +01:00
parent 322d6874c3
commit e2115d0d6f
7 changed files with 36 additions and 36 deletions

View File

@@ -547,7 +547,7 @@ expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
wxString::Format(wxS("Variant type should have been '%s'") \ wxString::Format(wxS("Variant type should have been '%s'") \
wxS("instead of '%s'"), \ wxS("instead of '%s'"), \
wxS(#classname), \ wxS(#classname), \
variant.GetType().c_str())); \ variant.GetType())); \
classname##VariantData *data = \ classname##VariantData *data = \
(classname##VariantData*) variant.GetData(); \ (classname##VariantData*) variant.GetData(); \
return data->GetValue();\ return data->GetValue();\
@@ -558,7 +558,7 @@ expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
wxString::Format(wxS("Variant type should have been '%s'") \ wxString::Format(wxS("Variant type should have been '%s'") \
wxS("instead of '%s'"), \ wxS("instead of '%s'"), \
wxS(#classname), \ wxS(#classname), \
variant.GetType().c_str())); \ variant.GetType())); \
classname##VariantData *data = \ classname##VariantData *data = \
(classname##VariantData*) variant.GetData(); \ (classname##VariantData*) variant.GetData(); \
return data->GetValue();\ return data->GetValue();\

View File

@@ -1085,7 +1085,7 @@ int wxSystemColourProperty::ColToInd( const wxColour& colour ) const
if ( colour == GetColour(ind) ) if ( colour == GetColour(ind) )
{ {
/*wxLogDebug(wxS("%s(%s): Index %i for ( getcolour(%i,%i,%i), colour(%i,%i,%i))"), /*wxLogDebug(wxS("%s(%s): Index %i for ( getcolour(%i,%i,%i), colour(%i,%i,%i))"),
GetClassName(),GetLabel().c_str(), GetClassName(),GetLabel(),
(int)i,(int)GetColour(ind).Red(),(int)GetColour(ind).Green(),(int)GetColour(ind).Blue(), (int)i,(int)GetColour(ind).Red(),(int)GetColour(ind).Green(),(int)GetColour(ind).Blue(),
(int)colour.Red(),(int)colour.Green(),(int)colour.Blue());*/ (int)colour.Red(),(int)colour.Green(),(int)colour.Blue());*/
return ind; return ind;

View File

@@ -337,7 +337,7 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
{ {
wxString unitsString = property->GetAttribute(wxPG_ATTR_UNITS, wxEmptyString); wxString unitsString = property->GetAttribute(wxPG_ATTR_UNITS, wxEmptyString);
if ( !unitsString.empty() ) if ( !unitsString.empty() )
text = wxString::Format(wxS("%s %s"), text.c_str(), unitsString.c_str() ); text = wxString::Format(wxS("%s %s"), text, unitsString );
} }
} }
@@ -919,7 +919,7 @@ void wxPGProperty::GetDisplayInfo( unsigned int column,
wxASSERT_MSG( cell.GetData(), wxASSERT_MSG( cell.GetData(),
wxString::Format(wxS("Invalid cell for property %s"), wxString::Format(wxS("Invalid cell for property %s"),
GetName().c_str()) ); GetName()) );
// We need to return customized cell object. // We need to return customized cell object.
if (pCell) if (pCell)
@@ -1470,7 +1470,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
wxVariant newValue; wxVariant newValue;
AdaptListToValue(value, &newValue); AdaptListToValue(value, &newValue);
value = newValue; value = newValue;
//wxLogDebug(wxS(">> %s.SetValue() adapted list value to type '%s'"),GetName().c_str(),value.GetType().c_str()); //wxLogDebug(wxS(">> %s.SetValue() adapted list value to type '%s'"),GetName(),value.GetType());
} }
if ( HasFlag( wxPG_PROP_AGGREGATE) ) if ( HasFlag( wxPG_PROP_AGGREGATE) )
@@ -1486,7 +1486,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
wxVariantList::iterator node; wxVariantList::iterator node;
unsigned int i = 0; unsigned int i = 0;
//wxLogDebug(wxS(">> %s.SetValue() pList parsing"),GetName().c_str()); //wxLogDebug(wxS(">> %s.SetValue() pList parsing"),GetName());
// Children in list can be in any order, but we will give hint to // Children in list can be in any order, but we will give hint to
// GetPropertyByNameWH(). This optimizes for full list parsing. // GetPropertyByNameWH(). This optimizes for full list parsing.
@@ -1496,7 +1496,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
wxPGProperty* child = GetPropertyByNameWH(childValue.GetName(), i); wxPGProperty* child = GetPropertyByNameWH(childValue.GetName(), i);
if ( child ) if ( child )
{ {
//wxLogDebug(wxS("%i: child = %s, childValue.GetType()=%s"),i,child->GetBaseName().c_str(),childValue.GetType().c_str()); //wxLogDebug(wxS("%i: child = %s, childValue.GetType()=%s"),i,child->GetBaseName(),childValue.GetType());
if ( childValue.IsType(wxPG_VARIANT_TYPE_LIST) ) if ( childValue.IsType(wxPG_VARIANT_TYPE_LIST) )
{ {
if ( child->HasFlag(wxPG_PROP_AGGREGATE) && !(flags & wxPG_SETVAL_AGGREGATED) ) if ( child->HasFlag(wxPG_PROP_AGGREGATE) && !(flags & wxPG_SETVAL_AGGREGATED) )
@@ -1966,7 +1966,7 @@ double wxPGProperty::GetAttributeAsDouble( const wxString& name, double defVal )
wxVariant wxPGProperty::GetAttributesAsList() const wxVariant wxPGProperty::GetAttributesAsList() const
{ {
wxVariantList tempList; wxVariantList tempList;
wxVariant v( tempList, wxString::Format(wxS("@%s@attr"),m_name.c_str()) ); wxVariant v( tempList, wxString::Format(wxS("@%s@attr"),m_name) );
wxPGAttributeStorage::const_iterator it = m_attributes.StartIteration(); wxPGAttributeStorage::const_iterator it = m_attributes.StartIteration();
wxVariant variant; wxVariant variant;
@@ -2496,7 +2496,7 @@ void wxPGProperty::AdaptListToValue( wxVariant& list, wxVariant* value ) const
unsigned int n = 0; unsigned int n = 0;
wxVariant childValue = list[n]; wxVariant childValue = list[n];
//wxLogDebug(wxS(">> %s.AdaptListToValue()"),GetBaseName().c_str()); //wxLogDebug(wxS(">> %s.AdaptListToValue()"),GetBaseName());
for ( unsigned int i = 0; i < GetChildCount(); i++ ) for ( unsigned int i = 0; i < GetChildCount(); i++ )
{ {
@@ -2504,7 +2504,7 @@ void wxPGProperty::AdaptListToValue( wxVariant& list, wxVariant* value ) const
if ( childValue.GetName() == child->GetBaseName() ) if ( childValue.GetName() == child->GetBaseName() )
{ {
//wxLogDebug(wxS(" %s(n=%i), %s"),childValue.GetName().c_str(),n,childValue.GetType().c_str()); //wxLogDebug(wxS(" %s(n=%i), %s"),childValue.GetName(),n,childValue.GetType());
if ( childValue.IsType(wxPG_VARIANT_TYPE_LIST) ) if ( childValue.IsType(wxPG_VARIANT_TYPE_LIST) )
{ {
@@ -2678,11 +2678,11 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y,
/* /*
if ( current ) if ( current )
{ {
wxLogDebug(wxS("%s::GetItemAtY(%i) -> %s"),this->GetLabel().c_str(),y,current->GetLabel().c_str()); wxLogDebug(wxS("%s::GetItemAtY(%i) -> %s"),this->GetLabel(),y,current->GetLabel());
} }
else else
{ {
wxLogDebug(wxS("%s::GetItemAtY(%i) -> NULL"),this->GetLabel().c_str(),y); wxLogDebug(wxS("%s::GetItemAtY(%i) -> NULL"),this->GetLabel(),y);
} }
*/ */

View File

@@ -2095,8 +2095,8 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
/* /*
wxLogDebug(wxS(" -> DoDrawItems(\"%s\" -> \"%s\"") wxLogDebug(wxS(" -> DoDrawItems(\"%s\" -> \"%s\"")
wxS(" %i -> %i height=%i (ch=%i), itemsRect = 0x%lX %i,%i %ix%i)"), wxS(" %i -> %i height=%i (ch=%i), itemsRect = 0x%lX %i,%i %ix%i)"),
firstItem->GetLabel().c_str(), firstItem->GetLabel(),
lastItem->GetLabel().c_str(), lastItem->GetLabel(),
firstItemTopY, lastItemBottomY, firstItemTopY, lastItemBottomY,
(int)(lastItemBottomY - firstItemTopY), (int)(lastItemBottomY - firstItemTopY),
(int)m_height, (int)m_height,
@@ -4021,8 +4021,8 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
/* /*
if (p) if (p)
{ {
wxLogDebug(wxS("SelectProperty( %s (%s[%i]) )"),p->GetLabel().c_str(), wxLogDebug(wxS("SelectProperty( %s (%s[%i]) )"),p->GetLabel(),
p->m_parent->GetLabel().c_str(),p->GetIndexInParent()); p->m_parent->GetLabel(),p->GetIndexInParent());
} }
else else
{ {
@@ -6438,13 +6438,13 @@ wxPGProperty* wxPropertyGridPopulator::Add( const wxString& propClass,
if ( parent->HasFlag(wxPG_PROP_AGGREGATE) ) if ( parent->HasFlag(wxPG_PROP_AGGREGATE) )
{ {
ProcessError(wxString::Format(wxS("new children cannot be added to '%s'"),parent->GetName().c_str())); ProcessError(wxString::Format(wxS("new children cannot be added to '%s'"),parent->GetName()));
return NULL; return NULL;
} }
if ( !classInfo || !classInfo->IsKindOf(wxCLASSINFO(wxPGProperty)) ) if ( !classInfo || !classInfo->IsKindOf(wxCLASSINFO(wxPGProperty)) )
{ {
ProcessError(wxString::Format(wxS("'%s' is not valid property class"),propClass.c_str())); ProcessError(wxString::Format(wxS("'%s' is not valid property class"),propClass));
return NULL; return NULL;
} }
@@ -6487,7 +6487,7 @@ wxPGChoices wxPropertyGridPopulator::ParseChoices( const wxString& choicesString
wxString ids = choicesString.substr(1); wxString ids = choicesString.substr(1);
wxPGHashMapS2P::iterator it = m_dictIdChoices.find(ids); wxPGHashMapS2P::iterator it = m_dictIdChoices.find(ids);
if ( it == m_dictIdChoices.end() ) if ( it == m_dictIdChoices.end() )
ProcessError(wxString::Format(wxS("No choices defined for id '%s'"),ids.c_str())); ProcessError(wxString::Format(wxS("No choices defined for id '%s'"),ids));
else else
choices.AssignData((wxPGChoicesData*)it->second); choices.AssignData((wxPGChoicesData*)it->second);
} }
@@ -6528,7 +6528,7 @@ wxPGChoices wxPropertyGridPopulator::ParseChoices( const wxString& choicesString
choices.Add(label, l); choices.Add(label, l);
} }
labelValid = false; labelValid = false;
//wxLogDebug(wxS("%s, %s"),label.c_str(),value.c_str()); //wxLogDebug(wxS("%s, %s"),label,value);
value.clear(); value.clear();
label.clear(); label.clear();
state = 1; state = 1;
@@ -6645,7 +6645,7 @@ bool wxPropertyGridPopulator::AddAttribute( const wxString& name,
} }
else else
{ {
ProcessError(wxString::Format(wxS("Invalid attribute type '%s'"),type.c_str())); ProcessError(wxString::Format(wxS("Invalid attribute type '%s'"),type));
return false; return false;
} }
} }
@@ -6659,7 +6659,7 @@ bool wxPropertyGridPopulator::AddAttribute( const wxString& name,
void wxPropertyGridPopulator::ProcessError( const wxString& msg ) void wxPropertyGridPopulator::ProcessError( const wxString& msg )
{ {
wxLogError(_("Error in resource: %s"),msg.c_str()); wxLogError(_("Error in resource: %s"),msg);
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@@ -399,7 +399,7 @@ void wxPGTypeOperationFailed( const wxPGProperty* p,
{ {
wxASSERT( p != NULL ); wxASSERT( p != NULL );
wxLogError( _("Type operation \"%s\" failed: Property labeled \"%s\" is of type \"%s\", NOT \"%s\"."), wxLogError( _("Type operation \"%s\" failed: Property labeled \"%s\" is of type \"%s\", NOT \"%s\"."),
op.c_str(), p->GetLabel().c_str(), p->GetValue().GetType().c_str(), typestr.c_str() ); op, p->GetLabel(), p->GetValue().GetType(), typestr );
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -434,7 +434,7 @@ void wxPropertyGridInterface::SetValidationFailureBehavior( int vfbFlags )
wxPGProperty* wxPropertyGridInterface::GetPropertyByNameA( const wxString& name ) const wxPGProperty* wxPropertyGridInterface::GetPropertyByNameA( const wxString& name ) const
{ {
wxPGProperty* p = GetPropertyByName(name); wxPGProperty* p = GetPropertyByName(name);
wxASSERT_MSG(p,wxString::Format(wxS("no property with name '%s'"),name.c_str())); wxASSERT_MSG(p,wxString::Format(wxS("no property with name '%s'"),name));
return p; return p;
} }

View File

@@ -1599,7 +1599,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
wxStrcmp(current->GetType(), p->GetValue().GetType()) == 0, wxStrcmp(current->GetType(), p->GetValue().GetType()) == 0,
wxString::Format( wxString::Format(
wxS("setting value of property \"%s\" from variant"), wxS("setting value of property \"%s\" from variant"),
p->GetName().c_str()) p->GetName())
); );
p->SetValue(*current); p->SetValue(*current);

View File

@@ -385,14 +385,14 @@ bool NumericValidation( const wxPGProperty* property,
if ( !maxOk ) if ( !maxOk )
msg = wxString::Format( msg = wxString::Format(
_("Value must be %s or higher."), _("Value must be %s or higher."),
smin.c_str()); smin);
else else
{ {
wxVariant vmax = WXVARIANT(max); wxVariant vmax = WXVARIANT(max);
wxString smax = property->ValueToString(vmax); wxString smax = property->ValueToString(vmax);
msg = wxString::Format( msg = wxString::Format(
_("Value must be between %s and %s."), _("Value must be between %s and %s."),
smin.c_str(), smax.c_str()); smin, smax);
} }
pValidationInfo->SetFailureMessage(msg); pValidationInfo->SetFailureMessage(msg);
} }
@@ -416,14 +416,14 @@ bool NumericValidation( const wxPGProperty* property,
if ( !minOk ) if ( !minOk )
msg = wxString::Format( msg = wxString::Format(
_("Value must be %s or less."), _("Value must be %s or less."),
smax.c_str()); smax);
else else
{ {
wxVariant vmin = WXVARIANT(min); wxVariant vmin = WXVARIANT(min);
wxString smin = property->ValueToString(vmin); wxString smin = property->ValueToString(vmin);
msg = wxString::Format( msg = wxString::Format(
_("Value must be between %s and %s."), _("Value must be between %s and %s."),
smin.c_str(), smax.c_str()); smin, smax);
} }
pValidationInfo->SetFailureMessage(msg); pValidationInfo->SetFailureMessage(msg);
} }
@@ -499,14 +499,14 @@ bool NumericValidation( const wxPGProperty* property,
if ( !maxOk ) if ( !maxOk )
msg = wxString::Format( msg = wxString::Format(
_("Value must be %s or higher."), _("Value must be %s or higher."),
smin.c_str()); smin);
else else
{ {
wxVariant vmax = WXVARIANT(max); wxVariant vmax = WXVARIANT(max);
wxString smax = property->ValueToString(vmax); wxString smax = property->ValueToString(vmax);
msg = wxString::Format( msg = wxString::Format(
_("Value must be between %s and %s."), _("Value must be between %s and %s."),
smin.c_str(), smax.c_str()); smin, smax);
} }
pValidationInfo->SetFailureMessage(msg); pValidationInfo->SetFailureMessage(msg);
} }
@@ -530,14 +530,14 @@ bool NumericValidation( const wxPGProperty* property,
if ( !minOk ) if ( !minOk )
msg = wxString::Format( msg = wxString::Format(
_("Value must be %s or less."), _("Value must be %s or less."),
smax.c_str()); smax);
else else
{ {
wxVariant vmin = WXVARIANT(min); wxVariant vmin = WXVARIANT(min);
wxString smin = property->ValueToString(vmin); wxString smin = property->ValueToString(vmin);
msg = wxString::Format( msg = wxString::Format(
_("Value must be between %s and %s."), _("Value must be between %s and %s."),
smin.c_str(), smax.c_str()); smin, smax);
} }
pValidationInfo->SetFailureMessage(msg); pValidationInfo->SetFailureMessage(msg);
} }
@@ -923,7 +923,7 @@ const wxString& wxPropertyGrid::DoubleToString(wxString& target,
*precTemplate << wxS('f'); *precTemplate << wxS('f');
} }
target.Printf( precTemplate->c_str(), value ); target.Printf( *precTemplate, value );
} }
else else
{ {
@@ -1131,7 +1131,7 @@ wxString wxBoolProperty::ValueToString( wxVariant& value,
else else
notFmt = wxS("Not %s"); notFmt = wxS("Not %s");
return wxString::Format(notFmt.c_str(), m_label.c_str()); return wxString::Format(notFmt, m_label);
} }
} }