diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2015-05-23 15:22:28 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-05-26 08:46:32 +0000 |
commit | 563a3935b8c2bfeaf18007019a1bbb4e1133bf11 (patch) | |
tree | bd678cbe62fe4a18498ddf390fcdd6326a16771f | |
parent | 19fc914aa6ab19890abf0e25712049e3ff9957ae (diff) |
BASIC: Remove BasicCharClass::IsLetterTab
Change-Id: Ib6a13cb7a5725d451c0f8d64c2c543a8a9ec2ad0
Reviewed-on: https://gerrit.libreoffice.org/15876
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | basic/source/comp/basiccharclass.cxx | 78 | ||||
-rw-r--r-- | basic/source/comp/scanner.cxx | 8 | ||||
-rw-r--r-- | basic/source/comp/token.cxx | 2 | ||||
-rw-r--r-- | basic/source/inc/basiccharclass.hxx | 13 |
4 files changed, 14 insertions, 87 deletions
diff --git a/basic/source/comp/basiccharclass.cxx b/basic/source/comp/basiccharclass.cxx index 8e404cc42c7f..415e64fb6371 100644 --- a/basic/source/comp/basiccharclass.cxx +++ b/basic/source/comp/basiccharclass.cxx @@ -23,78 +23,12 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -BasicCharClass::BasicCharClass() -{ - for( sal_uInt16 i = 0; i < 256; ++i ) - IsLetterTab[i] = false; - - IsLetterTab[0xC0] = true; // À , CAPITAL LETTER A WITH GRAVE ACCENT - IsLetterTab[0xC1] = true; // Á , CAPITAL LETTER A WITH ACUTE ACCENT - IsLetterTab[0xC2] = true; // Â , CAPITAL LETTER A WITH CIRCUMFLEX ACCENT - IsLetterTab[0xC3] = true; // Ã , CAPITAL LETTER A WITH TILDE - IsLetterTab[0xC4] = true; // Ä , CAPITAL LETTER A WITH DIAERESIS - IsLetterTab[0xC5] = true; // Å , CAPITAL LETTER A WITH RING ABOVE - IsLetterTab[0xC6] = true; // Æ , CAPITAL LIGATURE AE - IsLetterTab[0xC7] = true; // Ç , CAPITAL LETTER C WITH CEDILLA - IsLetterTab[0xC8] = true; // È , CAPITAL LETTER E WITH GRAVE ACCENT - IsLetterTab[0xC9] = true; // É , CAPITAL LETTER E WITH ACUTE ACCENT - IsLetterTab[0xCA] = true; // Ê , CAPITAL LETTER E WITH CIRCUMFLEX ACCENT - IsLetterTab[0xCB] = true; // Ë , CAPITAL LETTER E WITH DIAERESIS - IsLetterTab[0xCC] = true; // Ì , CAPITAL LETTER I WITH GRAVE ACCENT - IsLetterTab[0xCD] = true; // Í , CAPITAL LETTER I WITH ACUTE ACCENT - IsLetterTab[0xCE] = true; // Î , CAPITAL LETTER I WITH CIRCUMFLEX ACCENT - IsLetterTab[0xCF] = true; // Ï , CAPITAL LETTER I WITH DIAERESIS - IsLetterTab[0xD0] = true; // Ð , CAPITAL LETTER ETH - IsLetterTab[0xD1] = true; // Ñ , CAPITAL LETTER N WITH TILDE - IsLetterTab[0xD2] = true; // Ò , CAPITAL LETTER O WITH GRAVE ACCENT - IsLetterTab[0xD3] = true; // Ó , CAPITAL LETTER O WITH ACUTE ACCENT - IsLetterTab[0xD4] = true; // Ô , CAPITAL LETTER O WITH CIRCUMFLEX ACCENT - IsLetterTab[0xD5] = true; // Õ , CAPITAL LETTER O WITH TILDE - IsLetterTab[0xD6] = true; // Ö , CAPITAL LETTER O WITH DIAERESIS - IsLetterTab[0xD8] = true; // Ø , CAPITAL LETTER O WITH STROKE - IsLetterTab[0xD9] = true; // Ù , CAPITAL LETTER U WITH GRAVE ACCENT - IsLetterTab[0xDA] = true; // Ú , CAPITAL LETTER U WITH ACUTE ACCENT - IsLetterTab[0xDB] = true; // Û , CAPITAL LETTER U WITH CIRCUMFLEX ACCENT - IsLetterTab[0xDC] = true; // Ü , CAPITAL LETTER U WITH DIAERESIS - IsLetterTab[0xDD] = true; // Ý , CAPITAL LETTER Y WITH ACUTE ACCENT - IsLetterTab[0xDE] = true; // Þ , CAPITAL LETTER THORN - IsLetterTab[0xDF] = true; // ß , SMALL LETTER SHARP S - IsLetterTab[0xE0] = true; // à , SMALL LETTER A WITH GRAVE ACCENT - IsLetterTab[0xE1] = true; // á , SMALL LETTER A WITH ACUTE ACCENT - IsLetterTab[0xE2] = true; // â , SMALL LETTER A WITH CIRCUMFLEX ACCENT - IsLetterTab[0xE3] = true; // ã , SMALL LETTER A WITH TILDE - IsLetterTab[0xE4] = true; // ä , SMALL LETTER A WITH DIAERESIS - IsLetterTab[0xE5] = true; // å , SMALL LETTER A WITH RING ABOVE - IsLetterTab[0xE6] = true; // æ , SMALL LIGATURE AE - IsLetterTab[0xE7] = true; // ç , SMALL LETTER C WITH CEDILLA - IsLetterTab[0xE8] = true; // è , SMALL LETTER E WITH GRAVE ACCENT - IsLetterTab[0xE9] = true; // é , SMALL LETTER E WITH ACUTE ACCENT - IsLetterTab[0xEA] = true; // ê , SMALL LETTER E WITH CIRCUMFLEX ACCENT - IsLetterTab[0xEB] = true; // ë , SMALL LETTER E WITH DIAERESIS - IsLetterTab[0xEC] = true; // ì , SMALL LETTER I WITH GRAVE ACCENT - IsLetterTab[0xED] = true; // í , SMALL LETTER I WITH ACUTE ACCENT - IsLetterTab[0xEE] = true; // î , SMALL LETTER I WITH CIRCUMFLEX ACCENT - IsLetterTab[0xEF] = true; // ï , SMALL LETTER I WITH DIAERESIS - IsLetterTab[0xF0] = true; // ð , SMALL LETTER ETH - IsLetterTab[0xF1] = true; // ñ , SMALL LETTER N WITH TILDE - IsLetterTab[0xF2] = true; // ò , SMALL LETTER O WITH GRAVE ACCENT - IsLetterTab[0xF3] = true; // ó , SMALL LETTER O WITH ACUTE ACCENT - IsLetterTab[0xF4] = true; // ô , SMALL LETTER O WITH CIRCUMFLEX ACCENT - IsLetterTab[0xF5] = true; // õ , SMALL LETTER O WITH TILDE - IsLetterTab[0xF6] = true; // ö , SMALL LETTER O WITH DIAERESIS - IsLetterTab[0xF8] = true; // ø , SMALL LETTER O WITH OBLIQUE BAR - IsLetterTab[0xF9] = true; // ù , SMALL LETTER U WITH GRAVE ACCENT - IsLetterTab[0xFA] = true; // ú , SMALL LETTER U WITH ACUTE ACCENT - IsLetterTab[0xFB] = true; // û , SMALL LETTER U WITH CIRCUMFLEX ACCENT - IsLetterTab[0xFC] = true; // ü , SMALL LETTER U WITH DIAERESIS - IsLetterTab[0xFD] = true; // ý , SMALL LETTER Y WITH ACUTE ACCENT - IsLetterTab[0xFE] = true; // þ , SMALL LETTER THORN - IsLetterTab[0xFF] = true; // ÿ , SMALL LETTER Y WITH DIAERESIS -} - bool BasicCharClass::isLetter( sal_Unicode c ) { - return (c < 256 ? IsLetterTab[c] : isLetterUnicode( c )); + //All characters from C0 to FF are letters except D7 and F7 + return (c < 0xFF ? + ( (c >= 0xC0) && (c != 0xD7) && (c != 0xF7) ) : + BasicCharClass::isLetterUnicode( c )); } bool BasicCharClass::isLetterUnicode( sal_Unicode c ) @@ -109,12 +43,12 @@ bool BasicCharClass::isLetterUnicode( sal_Unicode c ) bool BasicCharClass::isAlpha( sal_Unicode c, bool bCompatible ) { return rtl::isAsciiAlpha(c) - || (bCompatible && isLetter( c )); + || (bCompatible && BasicCharClass::isLetter( c )); } bool BasicCharClass::isAlphaNumeric( sal_Unicode c, bool bCompatible ) { - return rtl::isAsciiDigit( c ) || isAlpha( c, bCompatible ); + return rtl::isAsciiDigit( c ) || BasicCharClass::isAlpha( c, bCompatible ); } bool BasicCharClass::isWhitespace( sal_Unicode c ) diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index ced5ac0de88f..fece800bc371 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -142,7 +142,7 @@ static SbxDataType GetSuffixType( sal_Unicode c ) void SbiScanner::scanAlphanumeric() { sal_Int32 n = nCol; - while(nCol < aLine.getLength() && (theBasicCharClass::get().isAlphaNumeric(aLine[nCol], bCompatible) || aLine[nCol] == '_')) + while(nCol < aLine.getLength() && (BasicCharClass::isAlphaNumeric(aLine[nCol], bCompatible) || aLine[nCol] == '_')) { ++pLine; ++nCol; @@ -248,7 +248,7 @@ bool SbiScanner::NextSym() } // copy character if symbol - if(nCol < aLine.getLength() && (theBasicCharClass::get().isAlpha(aLine[nCol], bCompatible) || aLine[nCol] == '_')) + if(nCol < aLine.getLength() && (BasicCharClass::isAlpha(aLine[nCol], bCompatible) || aLine[nCol] == '_')) { // if there's nothing behind '_' , it's the end of a line! if(nCol + 1 == aLine.getLength() && aLine[nCol] == '_') @@ -283,7 +283,7 @@ bool SbiScanner::NextSym() // don't test the exclamation mark // if there's a symbol behind it else if((nCol >= aLine.getLength() || aLine[nCol] != '!') || - (nCol + 1 >= aLine.getLength() || !theBasicCharClass::get().isAlpha(aLine[nCol + 1], bCompatible))) + (nCol + 1 >= aLine.getLength() || !BasicCharClass::isAlpha(aLine[nCol + 1], bCompatible))) { if(nCol < aLine.getLength()) { @@ -439,7 +439,7 @@ bool SbiScanner::NextSym() // e.g. -2,147,483,648 through 2,147,483,647 (signed) sal_uInt64 lu = 0; bool bOverflow = false; - while(nCol < aLine.getLength() && theBasicCharClass::get().isAlphaNumeric(aLine[nCol], false)) + while(nCol < aLine.getLength() && BasicCharClass::isAlphaNumeric(aLine[nCol], false)) { sal_Unicode ch = rtl::toAsciiUpperCase(aLine[nCol]); ++pLine; ++nCol; diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index eec2f4ea4a1c..e1b2026485c7 100644 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -426,7 +426,7 @@ SbiToken SbiTokenizer::Next() while( delta ); // Symbol? if not >= token sal_Unicode ch = aSym[0]; - if( !theBasicCharClass::get().isAlpha( ch, bCompatible ) && !bSymbol ) + if( !BasicCharClass::isAlpha( ch, bCompatible ) && !bSymbol ) { return eCurTok = (SbiToken) (ch & 0x00FF); } diff --git a/basic/source/inc/basiccharclass.hxx b/basic/source/inc/basiccharclass.hxx index d625ae312b37..fd3862d848e3 100644 --- a/basic/source/inc/basiccharclass.hxx +++ b/basic/source/inc/basiccharclass.hxx @@ -25,22 +25,15 @@ #include <vcl/svapp.hxx> -class BasicCharClass +namespace BasicCharClass { - bool IsLetterTab[256]; - -public: - BasicCharClass(); - bool isLetter( sal_Unicode c ); - static bool isLetterUnicode( sal_Unicode c ); + bool isLetterUnicode( sal_Unicode c ); bool isAlpha( sal_Unicode c, bool bCompatible ); bool isAlphaNumeric( sal_Unicode c, bool bCompatible ); - static bool isWhitespace( sal_Unicode c ); + bool isWhitespace( sal_Unicode c ); }; -class theBasicCharClass: public rtl::Static<BasicCharClass, theBasicCharClass> {}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |