diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-16 11:19:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-16 12:04:10 +0100 |
commit | 8512e5c2b3617a2c8d77381788c3864db594ce46 (patch) | |
tree | c7fde308b180a2bce971fc80958d8bd28aa123d0 /svtools | |
parent | c7f60050da130eaeab11a53142a65b61c92c34a1 (diff) |
reduce static_initialization_and_destruction chain
Change-Id: I962aeac0c7feeabb7963016d5afcfeca5a48ccfe
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/edit/syntaxhighlight.cxx | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index d4caa88c511f..2bf3d0204a7e 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -234,39 +234,32 @@ extern "C" int CDECL compare_strings( const void *arg1, const void *arg2 ) } -namespace { - -class LetterTable +namespace { - bool IsLetterTab[256]; - -public: - LetterTable( void ); - inline bool isLetter( sal_Unicode c ) + class LetterTable { - bool bRet = (c < 256) ? IsLetterTab[c] : isLetterUnicode( c ); - return bRet; - } - bool isLetterUnicode( sal_Unicode c ); -}; + bool IsLetterTab[256]; -} + public: + LetterTable( void ); -class BasicSimpleCharClass -{ - static LetterTable aLetterTable; + inline bool isLetter( sal_Unicode c ) + { + bool bRet = (c < 256) ? IsLetterTab[c] : isLetterUnicode( c ); + return bRet; + } + bool isLetterUnicode( sal_Unicode c ); + }; -public: - static sal_Bool isAlpha( sal_Unicode c ) + static bool isAlpha(sal_Unicode c) { - sal_Bool bRet = comphelper::string::isalphaAscii(c) || - aLetterTable.isLetter(c); - return bRet; + if (comphelper::string::isalphaAscii(c)) + return true; + static LetterTable aLetterTable; + return aLetterTable.isLetter(c); } -}; - -LetterTable BasicSimpleCharClass::aLetterTable; +} LetterTable::LetterTable( void ) { @@ -358,7 +351,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) : false; + ? isAlpha(c) : false; } return bRet; } @@ -469,7 +462,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, { // Naechstes Zeichen holen c = peekChar(); - bIdentifierChar = BasicSimpleCharClass::isAlpha(c); + bIdentifierChar = isAlpha(c); if( bIdentifierChar ) getChar(); } |