summaryrefslogtreecommitdiff
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
parentde82a40f84c69081a517617989c344ec9597cb45 (diff)
merge together 5 or ascii isalpha/isalnum/isdigit implementations
-rw-r--r--comphelper/inc/comphelper/string.hxx12
-rw-r--r--forms/source/xforms/submission/serialization_urlencoded.cxx7
-rw-r--r--sc/source/core/tool/compiler.cxx3
-rw-r--r--sc/source/ui/app/inputhdl.cxx5
-rw-r--r--sd/source/ui/docshell/docshel2.cxx11
-rw-r--r--stoc/prj/build.lst2
-rw-r--r--stoc/source/uriproc/UriReferenceFactory.cxx41
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx11
-rw-r--r--svtools/source/edit/syntaxhighlight.cxx24
-rw-r--r--svtools/source/svhtml/parhtml.cxx8
-rw-r--r--svtools/source/svrtf/parrtf.cxx5
-rw-r--r--sw/source/filter/html/parcss1.cxx35
-rw-r--r--sw/source/ui/misc/glosdoc.cxx7
-rw-r--r--sw/source/ui/uno/unoatxt.cxx5
-rw-r--r--sw/source/ui/vba/vbatemplate.cxx7
-rw-r--r--ucb/source/regexp/regexp.cxx17
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx6
-rw-r--r--xmlhelp/source/treeview/tvread.cxx3
18 files changed, 83 insertions, 126 deletions
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 627c04c984bf..0fadc73d16e7 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -353,6 +353,11 @@ COMPHELPER_DLLPUBLIC inline bool isdigitAscii(sal_Unicode c)
return ((c >= '0') && (c <= '9'));
}
+COMPHELPER_DLLPUBLIC inline bool isxdigitAscii(sal_Unicode c)
+{
+ return isdigitAscii(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
+}
+
COMPHELPER_DLLPUBLIC inline bool islowerAscii(sal_Unicode c)
{
return ((c >= 'a') && (c <= 'z'));
@@ -363,9 +368,14 @@ COMPHELPER_DLLPUBLIC inline bool isupperAscii(sal_Unicode c)
return ((c >= 'A') && (c <= 'Z'));
}
+COMPHELPER_DLLPUBLIC inline bool isalphaAscii(sal_Unicode c)
+{
+ return islowerAscii(c) || isupperAscii(c);
+}
+
COMPHELPER_DLLPUBLIC inline bool isalnumAscii(sal_Unicode c)
{
- return isdigitAscii(c) || islowerAscii(c) || isupperAscii(c);
+ return isalphaAscii(c) || isdigitAscii(c);
}
} }
diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx
index b0f498ff1b96..021acad5b830 100644
--- a/forms/source/xforms/submission/serialization_urlencoded.cxx
+++ b/forms/source/xforms/submission/serialization_urlencoded.cxx
@@ -38,6 +38,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
#include <unotools/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <stdio.h>
@@ -66,10 +67,8 @@ CSerializationURLEncoded::CSerializationURLEncoded()
*/
sal_Bool CSerializationURLEncoded::is_unreserved(sal_Char c)
{
- //digit?
- if (c >= '0' && c <= '9') return sal_True;
- if (c >= 'A' && c <= 'Z') return sal_True;
- if (c >= 'a' && c <= 'z') return sal_True;
+ if (comphelper::string::isalnumAscii(c))
+ return sal_True;
switch (c) {
case '-':
case '_':
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2c14b8649169..f8199a6ecadc 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -47,6 +47,7 @@
#include <com/sun/star/sheet/FormulaMapGroup.hpp>
#include <comphelper/processfactory.hxx>
#include <unotools/transliterationwrapper.hxx>
+#include <comphelper/string.hxx>
#include <tools/urlobj.hxx>
#include <rtl/math.hxx>
#include <ctype.h>
@@ -2711,7 +2712,7 @@ bool ScCompiler::IsPredetectedReference( const String& rName )
return false; // :#REF!.AB42 or :#REF!42 or :#REF!#REF!
break;
default:
- if ((('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) &&
+ if (comphelper::string::isalpha(c) &&
((mnPredetectedReference > 1 && ':' == c2) || 0 == c2))
return false; // AB#REF!: or AB#REF!
}
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 44dfe326fe66..1524397a121f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -62,6 +62,7 @@
#include <vcl/help.hxx>
#include <vcl/cursor.hxx>
#include <tools/urlobj.hxx>
+#include <comphelper/string.hxx>
#include <formula/formulahelper.hxx>
#include "inputwin.hxx"
@@ -768,7 +769,7 @@ void ScInputHandler::ShowTipCursor()
if( nLeftParentPos != STRING_NOTFOUND )
{
sal_Unicode c = ( nLeftParentPos > 0 ) ? aSelText.GetChar( nLeftParentPos-1 ) : 0;
- if( !((c >= 'A' && c<= 'Z') || (c>= 'a' && c<= 'z' )) )
+ if( !(comphelper::string::isalphaAscii(c)) )
continue;
nNextFStart = aHelper.GetFunctionStart( aSelText, nLeftParentPos, sal_True);
if( aHelper.GetNextFunc( aSelText, false, nNextFStart, &nNextFEnd, &ppFDesc, &aArgs ) )
@@ -1012,7 +1013,7 @@ void ScInputHandler::UseFormulaData()
// nLeftParentPos can be 0 if a parenthesis is inserted before the formula
sal_Unicode c = ( nLeftParentPos > 0 ) ? aFormula.GetChar( nLeftParentPos-1 ) : 0;
- if( !((c >= 'A' && c<= 'Z') || (c>= 'a' && c<= 'z') ) )
+ if( !(comphelper::string::isalphaAscii(c)) )
continue;
nNextFStart = aHelper.GetFunctionStart( aFormula, nLeftParentPos, sal_True);
if( aHelper.GetNextFunc( aFormula, false, nNextFStart, &nNextFEnd, &ppFDesc, &aArgs ) )
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx
index 5f1737cc6c57..8cea1449fb7c 100644
--- a/sd/source/ui/docshell/docshel2.cxx
+++ b/sd/source/ui/docshell/docshel2.cxx
@@ -51,6 +51,7 @@
#include "fupoor.hxx"
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
+#include <comphelper/string.hxx>
namespace sd {
@@ -391,16 +392,14 @@ bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStrin
bIsStandardName = true;
}
}
- else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= 'a' &&
- rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= 'z' &&
- rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 )
+ else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 &&
+ comphelper::string::islowerAscii(rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) ) )
{
// lower case, single character: reserved
bIsStandardName = true;
}
- else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= 'A' &&
- rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= 'Z' &&
- rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 )
+ else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 &&
+ comphelper::string::isupperAscii(rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) ) )
{
// upper case, single character: reserved
bIsStandardName = true;
diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst
index c7a1fe693919..f55be3005116 100644
--- a/stoc/prj/build.lst
+++ b/stoc/prj/build.lst
@@ -1,4 +1,4 @@
-tc stoc : DESKTOP:rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt registry NULL
+tc stoc : DESKTOP:rdbmaker cppuhelper comphelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt registry NULL
tc stoc usr1 - all tc_mkout NULL
tc stoc\inc nmake - all tc_inc NULL
tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL
diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx
index 1d87c69ab07c..afba3ca4da7c 100644
--- a/stoc/source/uriproc/UriReferenceFactory.cxx
+++ b/stoc/source/uriproc/UriReferenceFactory.cxx
@@ -51,6 +51,7 @@
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/weak.hxx"
+#include "comphelper/string.hxx"
#include "osl/diagnose.h"
#include "rtl/string.h"
#include "rtl/ustrbuf.hxx"
@@ -64,30 +65,16 @@
namespace css = com::sun::star;
-namespace {
-
-bool isDigit(sal_Unicode c) { //TODO: generally available?
- return c >= '0' && c <= '9';
-}
+using comphelper::string::isalphaAscii;
+using comphelper::string::isdigitAscii;
+using comphelper::string::isxdigitAscii;
+using comphelper::string::islowerAscii;
+using comphelper::string::isupperAscii;
-bool isUpperCase(sal_Unicode c) { //TODO: generally available?
- return c >= 'A' && c <= 'Z';
-}
-
-bool isLowerCase(sal_Unicode c) { //TODO: generally available?
- return c >= 'a' && c <= 'z';
-}
-
-bool isAlpha(sal_Unicode c) { //TODO: generally available?
- return isUpperCase(c) || isLowerCase(c);
-}
-
-bool isHexDigit(sal_Unicode c) { //TODO: generally available?
- return isDigit(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
-}
+namespace {
sal_Unicode toLowerCase(sal_Unicode c) { //TODO: generally available?
- return isUpperCase(c) ? c + ('a' - 'A') : c;
+ return isupperAscii(c) ? c + ('a' - 'A') : c;
}
bool equalIgnoreCase(sal_Unicode c1, sal_Unicode c2) {
@@ -99,8 +86,8 @@ bool equalIgnoreEscapeCase(rtl::OUString const & s1, rtl::OUString const & s2) {
if (s1.getLength() == s2.getLength()) {
for (sal_Int32 i = 0; i < s1.getLength();) {
if (s1[i] == '%' && s2[i] == '%' && s1.getLength() - i > 2
- && isHexDigit(s1[i + 1]) && isHexDigit(s1[i + 2])
- && isHexDigit(s2[i + 1]) && isHexDigit(s2[i + 2])
+ && isxdigitAscii(s1[i + 1]) && isxdigitAscii(s1[i + 2])
+ && isxdigitAscii(s2[i + 1]) && isxdigitAscii(s2[i + 2])
&& equalIgnoreCase(s1[i + 1], s2[i + 1])
&& equalIgnoreCase(s1[i + 2], s2[i + 2]))
{
@@ -118,12 +105,12 @@ bool equalIgnoreEscapeCase(rtl::OUString const & s1, rtl::OUString const & s2) {
}
sal_Int32 parseScheme(rtl::OUString const & uriReference) {
- if (uriReference.getLength() >= 2 && isAlpha(uriReference[0])) {
+ if (uriReference.getLength() >= 2 && isalphaAscii(uriReference[0])) {
for (sal_Int32 i = 0; i < uriReference.getLength(); ++i) {
sal_Unicode c = uriReference[i];
if (c == ':') {
return i;
- } else if (!isAlpha(c) && !isDigit(c) && c != '+' && c != '-'
+ } else if (!isalphaAscii(c) && !isdigitAscii(c) && c != '+' && c != '-'
&& c != '.')
{
break;
@@ -392,7 +379,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse(
RTL_CONSTASCII_STRINGPARAM("com.sun.star.uri.UriSchemeParser_"));
for (sal_Int32 i = 0; i < scheme.getLength(); ++i) {
sal_Unicode c = scheme[i];
- if (isUpperCase(c)) {
+ if (isupperAscii(c)) {
buf.append(toLowerCase(c));
} else if (c == '+') {
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("PLUS"));
@@ -401,7 +388,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse(
} else if (c == '.') {
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("DOT"));
} else {
- OSL_ASSERT(isLowerCase(c) || isDigit(c));
+ OSL_ASSERT(islowerAscii(c) || isdigitAscii(c));
buf.append(c);
}
}
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 86c72fb3619b..b7aa067aeb0b 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -32,7 +32,8 @@
#include "passwordcontainer.hxx"
#include <unotools/pathoptions.hxx>
-#include "cppuhelper/factory.hxx"
+#include <cppuhelper/factory.hxx>
+#include <comphelper/string.hxx>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/task/MasterPasswordRequest.hpp>
@@ -42,10 +43,6 @@
#include <rtl/digest.h>
#include <rtl/byteseq.hxx>
-#ifndef _TOOLS_INETSTRM_HXX
-// @@@ #include <inetstrm.hxx>
-#endif
-
using namespace std;
using namespace osl;
using namespace utl;
@@ -73,9 +70,7 @@ static ::rtl::OUString createIndex( vector< ::rtl::OUString > lines )
while( *pLine )
{
- if( ( *pLine >= 'A' && *pLine <= 'Z' )
- || ( *pLine >= 'a' && *pLine <= 'z' )
- || ( *pLine >= '0' && *pLine <= '9' ) )
+ if (comphelper::string::isalnumAscii(*pLine))
{
aResult += ::rtl::OString::valueOf( *pLine );
}
diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx
index df9c9d1acea9..dc4e9a3728be 100644
--- a/svtools/source/edit/syntaxhighlight.cxx
+++ b/svtools/source/edit/syntaxhighlight.cxx
@@ -32,9 +32,9 @@
#include <svtools/syntaxhighlight.hxx>
#include <unotools/charclass.hxx>
+#include <comphelper/string.hxx>
#include <tools/debug.hxx>
-
// ##########################################################################
// ATTENTION: all these words needs to be in small caps
// ##########################################################################
@@ -261,22 +261,10 @@ class BasicSimpleCharClass
static LetterTable aLetterTable;
public:
- static sal_Bool isAlpha( sal_Unicode c, bool bCompatible )
- {
- sal_Bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
- || (bCompatible && aLetterTable.isLetter( c ));
- return bRet;
- }
-
- static sal_Bool isDigit( sal_Unicode c )
- {
- sal_Bool bRet = (c >= '0' && c <= '9');
- return bRet;
- }
-
- static sal_Bool isAlphaNumeric( sal_Unicode c, bool bCompatible )
+ static sal_Bool isAlpha( sal_Unicode c )
{
- sal_Bool bRet = isDigit( c ) || isAlpha( c, bCompatible );
+ sal_Bool bRet = comphelper::string::isalphaAscii(c) ||
+ aLetterTable.isLetter(c);
return bRet;
}
};
@@ -373,7 +361,7 @@ sal_Bool SimpleTokenizer_Impl::testCharFlags( sal_Unicode c, sal_uInt16 nTestFla
else if( c > 255 )
{
bRet = (( CHAR_START_IDENTIFIER | CHAR_IN_IDENTIFIER ) & nTestFlags) != 0
- ? BasicSimpleCharClass::isAlpha( c, true ) : false;
+ ? BasicSimpleCharClass::isAlpha(c) : false;
}
return bRet;
}
@@ -484,7 +472,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType,
{
// Naechstes Zeichen holen
c = peekChar();
- bIdentifierChar = BasicSimpleCharClass::isAlpha( c, true );
+ bIdentifierChar = BasicSimpleCharClass::isAlpha(c);
if( bIdentifierChar )
getChar();
}
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 8cfe024ee77f..770f03bda8ee 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -432,12 +432,12 @@ int HTMLParser::FilterToken( int nToken )
return nToken;
}
-#define HTML_ISDIGIT( c ) (c >= '0' && c <= '9')
-#define HTML_ISALPHA( c ) ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') )
-#define HTML_ISALNUM( c ) ( HTML_ISALPHA(c) || HTML_ISDIGIT(c) )
+#define HTML_ISDIGIT( c ) comphelper::string::isdigitAscii(c)
+#define HTML_ISALPHA( c ) comphelper::string::isalphaAscii(c)
+#define HTML_ISALNUM( c ) comphelper::string::isalnumAscii(c)
#define HTML_ISSPACE( c ) ( ' ' == c || (c >= 0x09 && c <= 0x0d) )
#define HTML_ISPRINTABLE( c ) ( c >= 32 && c != 127)
-#define HTML_ISHEXDIGIT( c ) ( HTML_ISDIGIT(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') )
+#define HTML_ISHEXDIGIT( c ) comphelper::string::isxdigitAscii(c)
int HTMLParser::ScanText( const sal_Unicode cBreak )
{
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index 5a04328045c6..02b102e578a1 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -36,12 +36,13 @@
#include <svtools/rtftoken.h>
#include <svtools/rtfkeywd.hxx>
#include <svtools/parrtf.hxx>
+#include <comphelper/string.hxx>
const int MAX_STRING_LEN = 1024;
const int MAX_TOKEN_LEN = 128;
-#define RTF_ISDIGIT( c ) (c >= '0' && c <= '9')
-#define RTF_ISALPHA( c ) ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') )
+#define RTF_ISDIGIT( c ) comphelper::string::isdigitAscii(c)
+#define RTF_ISALPHA( c ) comphelper::string::isalphaAscii(c)
SvRTFParser::SvRTFParser( SvStream& rIn, sal_uInt8 nStackSize )
: SvParser( rIn, nStackSize ),
diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx
index 635695255984..cb3a376222f4 100644
--- a/sw/source/filter/html/parcss1.cxx
+++ b/sw/source/filter/html/parcss1.cxx
@@ -36,7 +36,7 @@
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
#include <svtools/htmltokn.h>
-
+#include <comphelper/string.hxx>
#include "css1kywd.hxx"
#include "parcss1.hxx"
@@ -157,18 +157,15 @@ CSS1Token CSS1Parser::GetNextToken()
case '@': // '@import' | '@XXX'
{
cNextCh = GetNextChar();
- if( ('A' <= cNextCh && cNextCh <= 'Z') ||
- ('a' <= cNextCh && cNextCh <= 'z') )
+ if (comphelper::string::isalphaAscii(cNextCh))
{
// den naechsten Identifer scannen
::rtl::OUStringBuffer sTmpBuffer( 32L );
do {
sTmpBuffer.append( cNextCh );
cNextCh = GetNextChar();
- } while( ('A' <= cNextCh && cNextCh <= 'Z') ||
- ('a' <= cNextCh && cNextCh <= 'z') ||
- ('0' <= cNextCh && cNextCh <= '9') ||
- ('-'==cNextCh && !IsEOF()) );
+ } while( (comphelper::string::isalnumAscii(cNextCh) ||
+ '-' == cNextCh) && !IsEOF() );
aToken += String(sTmpBuffer.makeStringAndClear());
@@ -263,10 +260,8 @@ CSS1Token CSS1Parser::GetNextToken()
do {
sTmpBuffer.append( cNextCh );
cNextCh = GetNextChar();
- } while( ('A' <= cNextCh && cNextCh <= 'Z') ||
- ('a' <= cNextCh && cNextCh <= 'z') ||
- ('0' <= cNextCh && cNextCh <= '9') ||
- ('-' == cNextCh && !IsEOF()) );
+ } while( (comphelper::string::isalnumAscii(cNextCh) ||
+ '-' == cNextCh) && !IsEOF() );
aToken += String(sTmpBuffer.makeStringAndClear());
@@ -409,10 +404,8 @@ CSS1Token CSS1Parser::GetNextToken()
do {
sTmpBuffer2.append( cNextCh );
cNextCh = GetNextChar();
- } while( ( ('A' <= cNextCh && cNextCh <= 'Z') ||
- ('a' <= cNextCh && cNextCh <= 'z') ||
- ('0' <= cNextCh && cNextCh <= '9') ||
- '-'==cNextCh) && !IsEOF() );
+ } while( (comphelper::string::isalnumAscii(cNextCh) ||
+ '-' == cNextCh) && !IsEOF() );
aIdent += String(sTmpBuffer2.makeStringAndClear());
@@ -606,9 +599,7 @@ CSS1Token CSS1Parser::GetNextToken()
// kein break;
default: // IDENT | syntax error
- // TODO IsAlpha
- if( ('A' <= cNextCh && cNextCh <= 'Z') ||
- ('a' <= cNextCh && cNextCh <= 'z') )
+ if (comphelper::string::isalphaAscii(cNextCh))
{
// IDENT
@@ -626,12 +617,8 @@ CSS1Token CSS1Parser::GetNextToken()
('a'<=cNextCh && 'f'>=cNextCh) );
}
cNextCh = GetNextChar();
- // TODO: AlphaNumeric
- } while( ( ('0'<=cNextCh && '9'>=cNextCh) ||
- ('A'<=cNextCh && 'Z'>=cNextCh) ||
- ('a'<=cNextCh && 'z'>=cNextCh) ||
- '-'==cNextCh ) &&
- !IsEOF() );
+ } while( (comphelper::string::isalnumAscii(cNextCh) ||
+ '-' == cNextCh) && !IsEOF() );
aToken += String(sTmpBuffer.makeStringAndClear());
diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx
index 78994abfc25f..3db77a08cb31 100644
--- a/sw/source/ui/misc/glosdoc.cxx
+++ b/sw/source/ui/misc/glosdoc.cxx
@@ -46,6 +46,7 @@
#include <svl/fstathelper.hxx>
#include <unotools/pathoptions.hxx>
#include <unotools/tempfile.hxx>
+#include <comphelper/string.hxx>
#include <swtypes.hxx>
#include <uitool.hxx>
#include <glosdoc.hxx>
@@ -68,10 +69,8 @@ String lcl_CheckFileName( const String& rNewFilePath,
for( xub_StrLen i = 0; i < rNewGroupName.Len(); i++ )
{
sal_Unicode cChar = rNewGroupName.GetChar(i);
- if( (cChar >= 'A' && cChar <= 'Z') ||
- (cChar >= 'a' && cChar <= 'z') ||
- (cChar >= '0' && cChar <= '9') ||
- cChar == '_' || cChar == 0x20 )
+ if (comphelper::string::isalnumAscii(cChar) ||
+ cChar == '_' || cChar == 0x20)
{
sRet += cChar;
}
diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx
index b6d75ec18d08..4c695408f8a9 100644
--- a/sw/source/ui/uno/unoatxt.cxx
+++ b/sw/source/ui/uno/unoatxt.cxx
@@ -63,6 +63,7 @@
#include <svl/macitem.hxx>
#include <editeng/acorrcfg.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
#include <memory>
@@ -195,9 +196,7 @@ uno::Reference< text::XAutoTextGroup > SwXAutoTextContainer::insertNewByName(
for(sal_Int32 nPos = 0; nPos < aGroupName.getLength(); nPos++)
{
sal_Unicode cChar = aGroupName[nPos];
- if( ((cChar >= 'A') && (cChar <= 'Z')) ||
- ((cChar >= 'a') && (cChar <= 'z')) ||
- ((cChar >= '0') && (cChar <= '9')) ||
+ if (comphelper::string::isalnumAscii(cChar) ||
(cChar == '_') ||
(cChar == 0x20) ||
(cChar == GLOS_DELIM) )
diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx
index 6216b853ee3e..9774a971f114 100644
--- a/sw/source/ui/vba/vbatemplate.cxx
+++ b/sw/source/ui/vba/vbatemplate.cxx
@@ -32,6 +32,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/text/XAutoTextContainer.hpp>
#include <tools/urlobj.hxx>
+#include <comphelper/string.hxx>
#include <osl/file.hxx>
using namespace ::ooo::vba;
@@ -44,10 +45,8 @@ String lcl_CheckGroupName( const String& rGroupName )
for( xub_StrLen i = 0; i < rGroupName.Len(); i++ )
{
sal_Unicode cChar = rGroupName.GetChar(i);
- if( (cChar >= 'A' && cChar <= 'Z') ||
- (cChar >= 'a' && cChar <= 'z') ||
- (cChar >= '0' && cChar <= '9') ||
- cChar == '_' || cChar == 0x20 )
+ if (comphelper::string::isalnumAscii(cChar) ||
+ cChar == '_' || cChar == 0x20)
{
sRet += cChar;
}
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;
}
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 0c3e8fd1b8a3..542167b69c12 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -66,6 +66,7 @@
#include <l10ntools/compilehelp.hxx>
#include <comphelper/storagehelper.hxx>
+#include <comphelper/string.hxx>
#include "databases.hxx"
#include "urlparameter.hxx"
@@ -1686,8 +1687,7 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage(
inline bool isLetter( sal_Unicode c )
{
- bool bLetter = ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
- return bLetter;
+ return comphelper::string::isalphaAscii(c);
}
void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< ::rtl::OUString > &rv,
@@ -1709,7 +1709,7 @@ void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< ::r
{
rtl::OUString aPureEntry = aEntry.copy( nLastSlash + 1 );
- // Check language sceme
+ // Check language scheme
int nLen = aPureEntry.getLength();
const sal_Unicode* pc = aPureEntry.getStr();
bool bStartCanBeLanguage = ( nLen >= 2 && isLetter( pc[0] ) && isLetter( pc[1] ) );
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index ce9acf05663a..b07c2421f05f 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -1144,8 +1144,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpP
inline bool isLetter( sal_Unicode c )
{
- bool bLetter = ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
- return bLetter;
+ return comphelper::string::isalphaAscii(c);
}
void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< ::rtl::OUString > &rv,