From 6346588525573c2b00f792bd153620b4ae4d40ab Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 22 Mar 2007 15:20:50 +0000 Subject: [PATCH] removed Matches(const wxChar *, int=0) overload: it creates ambiguity with Matches(const wxString&, int=0) one when re.Matches(s.c_str()) is called now that c_str() returns wxCStrData which can be converted to both const wxChar * and wxString git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/regex.h | 7 +++---- src/common/regex.cpp | 15 +++------------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/include/wx/regex.h b/include/wx/regex.h index bda45030d2..7f9b2c04b0 100644 --- a/include/wx/regex.h +++ b/include/wx/regex.h @@ -97,10 +97,9 @@ public: // len may be the length of text (ignored by most system regex libs) // // may only be called after successful call to Compile() - bool Matches(const wxChar *text, int flags = 0) const; - bool Matches(const wxChar *text, int flags, size_t len) const; - bool Matches(const wxString& text, int flags = 0) const - { return Matches(text.c_str(), flags, text.length()); } + bool Matches(const wxString& text, int flags = 0) const; + bool Matches(const wxChar *text, int flags, size_t len) const + { return Matches(wxString(text, len), flags); } // get the start index and the length of the match of the expression // (index 0) or a bracketed subexpression (index != 0) diff --git a/src/common/regex.cpp b/src/common/regex.cpp index 7217296d2f..33458574c9 100644 --- a/src/common/regex.cpp +++ b/src/common/regex.cpp @@ -634,21 +634,12 @@ bool wxRegEx::Compile(const wxString& expr, int flags) return true; } -bool wxRegEx::Matches(const wxChar *str, int flags, size_t len) const +bool wxRegEx::Matches(const wxString& str, int flags) const { wxCHECK_MSG( IsValid(), false, _T("must successfully Compile() first") ); - (void)len; - return m_impl->Matches(WXREGEX_CHAR(str), flags WXREGEX_IF_NEED_LEN(len)); -} - -bool wxRegEx::Matches(const wxChar *str, int flags) const -{ - wxCHECK_MSG( IsValid(), false, _T("must successfully Compile() first") ); - - return m_impl->Matches(WXREGEX_CHAR(str), - flags - WXREGEX_IF_NEED_LEN(wxStrlen(str))); + return m_impl->Matches(WXREGEX_CHAR(str), flags + WXREGEX_IF_NEED_LEN(str.length())); } bool wxRegEx::GetMatch(size_t *start, size_t *len, size_t index) const -- 2.45.2