Refactor string manipulations in wxPropertyGrid::ExpandEscapeSequence and CreateEscapeSequences.
Share wxString::clear() method to initialize empty destination string.
This commit is contained in:
@@ -1736,18 +1736,17 @@ wxPoint wxPropertyGrid::GetGoodEditorDialogPosition( wxPGProperty* p,
|
|||||||
|
|
||||||
wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& src_str )
|
wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& src_str )
|
||||||
{
|
{
|
||||||
|
dst_str.clear();
|
||||||
|
|
||||||
if ( src_str.empty() )
|
if ( src_str.empty() )
|
||||||
{
|
{
|
||||||
dst_str = src_str;
|
return dst_str;
|
||||||
return src_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool prev_is_slash = false;
|
bool prev_is_slash = false;
|
||||||
|
|
||||||
wxString::const_iterator i = src_str.begin();
|
wxString::const_iterator i = src_str.begin();
|
||||||
|
|
||||||
dst_str.clear();
|
|
||||||
|
|
||||||
for ( ; i != src_str.end(); ++i )
|
for ( ; i != src_str.end(); ++i )
|
||||||
{
|
{
|
||||||
wxUniChar a = *i;
|
wxUniChar a = *i;
|
||||||
@@ -1795,17 +1794,16 @@ wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& sr
|
|||||||
|
|
||||||
wxString& wxPropertyGrid::CreateEscapeSequences( wxString& dst_str, wxString& src_str )
|
wxString& wxPropertyGrid::CreateEscapeSequences( wxString& dst_str, wxString& src_str )
|
||||||
{
|
{
|
||||||
|
dst_str.clear();
|
||||||
|
|
||||||
if ( src_str.empty() )
|
if ( src_str.empty() )
|
||||||
{
|
{
|
||||||
dst_str = src_str;
|
return dst_str;
|
||||||
return src_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString::const_iterator i = src_str.begin();
|
wxString::const_iterator i = src_str.begin();
|
||||||
wxUniChar prev_a = wxS('\0');
|
wxUniChar prev_a = wxS('\0');
|
||||||
|
|
||||||
dst_str.clear();
|
|
||||||
|
|
||||||
for ( ; i != src_str.end(); ++i )
|
for ( ; i != src_str.end(); ++i )
|
||||||
{
|
{
|
||||||
wxChar a = *i;
|
wxChar a = *i;
|
||||||
|
Reference in New Issue
Block a user