diff options
Diffstat (limited to 'cpp/src/Ice/PropertiesI.cpp')
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 52 |
1 files changed, 2 insertions, 50 deletions
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index ad67bff93a0..95063f3e188 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/StringUtil.h> #include <Ice/PropertiesI.h> #include <Ice/Initialize.h> #include <Ice/LocalException.h> @@ -91,55 +92,6 @@ Ice::PropertiesI::getPropertiesForPrefix(const string& prefix) return result; } -// -// Match `s' against the pattern `pat'. A * in the pattern acts -// as a wildcard: it matches any non-empty sequence of characters -// other than a period (`.'). We match by hand here because -// it's portable across platforms (whereas regex() isn't). -// - -bool -Ice::PropertiesI::match(const string& s, const string& pat) -{ - assert(!s.empty()); - assert(!pat.empty()); - - if(pat.find('*') == string::npos) - { - return s == pat; - } - - string::size_type sIndex = 0; - string::size_type patIndex = 0; - do - { - if(pat[patIndex] == '*') - { - if(s[sIndex] == '.') // Don't allow matching x..y against x.*.y -- star matches non-empty sequence only. - { - return false; - } - while(sIndex < s.size() && s[sIndex] != '.') - { - ++sIndex; - } - patIndex++; - } - else - { - if(pat[patIndex] != s[sIndex]) - { - return false; - } - ++sIndex; - ++patIndex; - } - } - while(sIndex < s.size() && patIndex < pat.size()); - - return sIndex == s.size() && patIndex == pat.size(); -} - void Ice::PropertiesI::setProperty(const string& key, const string& value) { @@ -171,7 +123,7 @@ Ice::PropertiesI::setProperty(const string& key, const string& value) bool found = false; for(const char* const* j = *i; *j != 0 && !found; ++j) { - found = match(key, *j); + found = IceUtil::match(key, *j); } if(!found) { |