summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-29 00:36:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-29 09:56:08 +0100
commit3829892dbc5475a49250729541be369ea9532d28 (patch)
tree9a57bc4865772c6613db2c71c6fde609d8563e09 /ucb
parentde82a40f84c69081a517617989c344ec9597cb45 (diff)
merge together 5 or ascii isalpha/isalnum/isdigit implementations
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/regexp/regexp.cxx17
1 files changed, 5 insertions, 12 deletions
diff --git a/ucb/source/regexp/regexp.cxx b/ucb/source/regexp/regexp.cxx
index 18136bc16b5d..695c8bf9a74e 100644
--- a/ucb/source/regexp/regexp.cxx
+++ b/ucb/source/regexp/regexp.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
+#include <comphelper/string.hxx>
namespace unnamed_ucb_regexp {} using namespace unnamed_ucb_regexp;
// unnamed namespaces don't work well yet...
@@ -186,29 +187,21 @@ bool Regexp::matches(rtl::OUString const & rString,
//============================================================================
namespace unnamed_ucb_regexp {
-inline bool isAlpha(sal_Unicode c)
-{
- return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
-}
-
-inline bool isDigit(sal_Unicode c)
-{
- return c >= '0' && c <= '9';
-}
-
bool isScheme(rtl::OUString const & rString, bool bColon)
{
+ using comphelper::string::isalphaAscii;
+ using comphelper::string::isdigitAscii;
// Return true if rString matches <scheme> (plus a trailing ":" if bColon
// is true) from RFC 2396:
sal_Unicode const * p = rString.getStr();
sal_Unicode const * pEnd = p + rString.getLength();
- if (p != pEnd && isAlpha(*p))
+ if (p != pEnd && isalphaAscii(*p))
for (++p;;)
{
if (p == pEnd)
return !bColon;
sal_Unicode c = *p++;
- if (!(isAlpha(c) || isDigit(c)
+ if (!(isalphaAscii(c) || isdigitAscii(c)
|| c == '+' || c == '-' || c == '.'))
return bColon && c == ':' && p == pEnd;
}