optimization for faster execution: don't use wxString::Replace() all the times a wxType comparison is required

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-03-30 15:50:40 +00:00
parent b64d83f52b
commit 658d98040d
2 changed files with 14 additions and 17 deletions

View File

@@ -74,6 +74,15 @@ void wxType::SetTypeFromString(const wxString& t)
m_strType.Replace(" ,", ",");
m_strType = m_strType.Strip(wxString::both);
// now set the clean version
m_strTypeClean = m_strType;
m_strTypeClean.Replace("const", "");
m_strTypeClean.Replace("static", "");
m_strTypeClean.Replace("*", "");
m_strTypeClean.Replace("&", "");
m_strTypeClean.Replace("[]", "");
m_strTypeClean = m_strTypeClean.Strip(wxString::both);
}
bool wxType::IsOk() const
@@ -82,25 +91,14 @@ bool wxType::IsOk() const
// "reverse_iterator_impl<wxString::const_iterator>" type
// It can also contain commas, * and & operators etc
return !GetClean().IsEmpty();
}
wxString wxType::GetClean() const
{
wxString ret(m_strType);
ret.Replace("const", "");
ret.Replace("static", "");
ret.Replace("*", "");
ret.Replace("&", "");
ret.Replace("[]", "");
return ret.Strip(wxString::both);
return !m_strTypeClean.IsEmpty();
}
bool wxType::operator==(const wxType& m) const
{
// brain-dead comparison:
if (GetClean() == m.GetClean() &&
if (m_strTypeClean == m.m_strTypeClean &&
IsConst() == m.IsConst() &&
IsStatic() == m.IsStatic() &&
IsPointer() == m.IsPointer() &&