summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-02-10 12:23:44 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-02-10 12:23:44 +0000
commit50a9bc07bf0e76b7bdf993e611037539f42aa385 (patch)
treea992a0bfc655023325f4856758f7649ab5fcdc5c /cpp/src
parentadding bidir (diff)
downloadice-50a9bc07bf0e76b7bdf993e611037539f42aa385.tar.bz2
ice-50a9bc07bf0e76b7bdf993e611037539f42aa385.tar.xz
ice-50a9bc07bf0e76b7bdf993e611037539f42aa385.zip
Fixed match method to optionally match period (useful for IcePack)
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IcePack/ObjectRegistryI.cpp2
-rw-r--r--cpp/src/IceUtil/StringUtil.cpp9
2 files changed, 7 insertions, 4 deletions
diff --git a/cpp/src/IcePack/ObjectRegistryI.cpp b/cpp/src/IcePack/ObjectRegistryI.cpp
index 2fd46f9bc83..ca72955089f 100644
--- a/cpp/src/IcePack/ObjectRegistryI.cpp
+++ b/cpp/src/IcePack/ObjectRegistryI.cpp
@@ -218,7 +218,7 @@ ObjectRegistryI::findAll(const string& expression, const Ice::Current&) const
for(IdentityObjectDescDict::const_iterator p = objects.begin(); p != objects.end(); ++p)
{
if(expression.empty() ||
- IceUtil::match(Ice::identityToString(p->second.proxy->ice_getIdentity()), expression))
+ IceUtil::match(Ice::identityToString(p->second.proxy->ice_getIdentity()), expression, true))
{
result.push_back(p->second);
}
diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp
index 72bb715369f..232e30f4f06 100644
--- a/cpp/src/IceUtil/StringUtil.cpp
+++ b/cpp/src/IceUtil/StringUtil.cpp
@@ -263,7 +263,7 @@ IceUtil::checkQuote(const string& s, string::size_type start)
// it's portable across platforms (whereas regex() isn't).
//
bool
-IceUtil::match(const string& s, const string& pat)
+IceUtil::match(const string& s, const string& pat, bool matchPeriod)
{
assert(!s.empty());
assert(!pat.empty());
@@ -279,11 +279,14 @@ IceUtil::match(const string& s, const string& pat)
{
if(pat[patIndex] == '*')
{
- if(s[sIndex] == '.') // Don't allow matching x..y against x.*.y -- star matches non-empty sequence only.
+ //
+ // Don't allow matching x..y against x.*.y if requested -- star matches non-empty sequence only.
+ //
+ if(!matchPeriod && s[sIndex] == '.')
{
return false;
}
- while(sIndex < s.size() && s[sIndex] != '.')
+ while(sIndex < s.size() && (matchPeriod || s[sIndex] != '.'))
{
++sIndex;
}