diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-29 00:36:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-29 09:56:08 +0100 |
commit | 3829892dbc5475a49250729541be369ea9532d28 (patch) | |
tree | 9a57bc4865772c6613db2c71c6fde609d8563e09 /svtools | |
parent | de82a40f84c69081a517617989c344ec9597cb45 (diff) |
merge together 5 or ascii isalpha/isalnum/isdigit implementations
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/edit/syntaxhighlight.cxx | 24 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 8 | ||||
-rw-r--r-- | svtools/source/svrtf/parrtf.cxx | 5 |
3 files changed, 13 insertions, 24 deletions
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 ), |