LibreOffice Module i18npool (master) 1
|
#include <cclass_unicode.hxx>
Public Member Functions | |
cclass_Unicode (css::uno::Reference< css::uno::XComponentContext > xContext) | |
virtual | ~cclass_Unicode () override |
virtual OUString SAL_CALL | toUpper (const OUString &Text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override |
virtual OUString SAL_CALL | toLower (const OUString &Text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override |
virtual OUString SAL_CALL | toTitle (const OUString &Text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override |
virtual sal_Int16 SAL_CALL | getType (const OUString &Text, sal_Int32 nPos) override |
virtual sal_Int16 SAL_CALL | getCharacterDirection (const OUString &Text, sal_Int32 nPos) override |
virtual sal_Int16 SAL_CALL | getScript (const OUString &Text, sal_Int32 nPos) override |
virtual sal_Int32 SAL_CALL | getCharacterType (const OUString &text, sal_Int32 nPos, const css::lang::Locale &rLocale) override |
virtual sal_Int32 SAL_CALL | getStringType (const OUString &text, sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale &rLocale) override |
virtual css::i18n::ParseResult SAL_CALL | parseAnyToken (const OUString &Text, sal_Int32 nPos, const css::lang::Locale &rLocale, sal_Int32 nStartCharFlags, const OUString &userDefinedCharactersStart, sal_Int32 nContCharFlags, const OUString &userDefinedCharactersCont) override |
virtual css::i18n::ParseResult SAL_CALL | parsePredefinedToken (sal_Int32 nTokenType, const OUString &Text, sal_Int32 nPos, const css::lang::Locale &rLocale, sal_Int32 nStartCharFlags, const OUString &userDefinedCharactersStart, sal_Int32 nContCharFlags, const OUString &userDefinedCharactersCont) override |
virtual OUString SAL_CALL | getImplementationName () override |
virtual sal_Bool SAL_CALL | supportsService (const OUString &ServiceName) override |
virtual css::uno::Sequence< OUString > SAL_CALL | getSupportedServiceNames () override |
Private Types | |
enum | ScanState { ssGetChar , ssGetValue , ssGetWord , ssGetWordFirstChar , ssGetString , ssGetBool , ssRewindFromValue , ssIgnoreLeadingInRewind , ssStopBack , ssBounce , ssStop } |
Private Member Functions | |
ParserFlags | getFlags (sal_uInt32 c, ScanState eState) |
Access parser table flags. More... | |
ParserFlags | getFlagsExtended (sal_uInt32 c, ScanState eState) const |
Access parser flags via International and special definitions. More... | |
ParserFlags | getStartCharsFlags (sal_uInt32 c) |
Access parser table flags for user defined start characters. More... | |
ParserFlags | getContCharsFlags (sal_Unicode c) |
Access parser table flags for user defined continuation characters. More... | |
void | setupParserTable (const css::lang::Locale &rLocale, sal_Int32 startCharTokenType, const OUString &userDefinedCharactersStart, sal_Int32 contCharTokenType, const OUString &userDefinedCharactersCont) |
Setup parser table. Calls initParserTable() only if needed. More... | |
void | initParserTable (const css::lang::Locale &rLocale, sal_Int32 startCharTokenType, const OUString &userDefinedCharactersStart, sal_Int32 contCharTokenType, const OUString &userDefinedCharactersCont) |
Init parser table. More... | |
void | destroyParserTable () |
Destroy parser table. More... | |
void | parseText (css::i18n::ParseResult &r, const OUString &rText, sal_Int32 nPos, sal_Int32 nTokenType=0xffffffff) |
Parse a text. More... | |
void | setupInternational (const css::lang::Locale &rLocale) |
Setup International class, new'ed only if different from existing. More... | |
Static Private Member Functions | |
static const sal_Unicode * | StrChr (const sal_Unicode *pStr, sal_uInt32 c) |
If and where c occurs in pStr. More... | |
static sal_Int32 | getParseTokensType (sal_uInt32 c, bool isFirst) |
Get corresponding KParseTokens flag for a character. More... | |
static sal_Int32 | getCharType (std::u16string_view Text, sal_Int32 *nPos, sal_Int32 increment) |
Implementation of getCharacterType() for one single character. More... | |
Private Attributes | |
rtl::Reference< Transliteration_casemapping > | transToUpper |
rtl::Reference< Transliteration_casemapping > | transToLower |
rtl::Reference< Transliteration_casemapping > | transToTitle |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
css::lang::Locale | aParserLocale |
used for parser only More... | |
css::uno::Reference< css::i18n::XLocaleData5 > | mxLocaleData |
css::uno::Reference< css::i18n::XNativeNumberSupplier > | xNatNumSup |
OUString | aStartChars |
OUString | aContChars |
std::unique_ptr< ParserFlags[]> | pTable |
std::unique_ptr< ParserFlags[]> | pStart |
std::unique_ptr< ParserFlags[]> | pCont |
sal_Int32 | nStartTypes |
sal_Int32 | nContTypes |
sal_Unicode | cGroupSep |
sal_Unicode | cDecimalSep |
sal_Unicode | cDecimalSepAlt |
Static Private Attributes | |
static const sal_uInt8 | nDefCnt = 128 |
static const ParserFlags | pDefaultParserTable [] |
static const sal_Int32 | pParseTokensType [] |
Definition at line 64 of file cclass_unicode.hxx.
|
private |
Enumerator | |
---|---|
ssGetChar | |
ssGetValue | |
ssGetWord | |
ssGetWordFirstChar | |
ssGetString | |
ssGetBool | |
ssRewindFromValue | |
ssIgnoreLeadingInRewind | |
ssStopBack | |
ssBounce | |
ssStop |
Definition at line 105 of file cclass_unicode.hxx.
i18npool::cclass_Unicode::cclass_Unicode | ( | css::uno::Reference< css::uno::XComponentContext > | xContext | ) |
Definition at line 43 of file cclass_unicode.cxx.
References m_xContext, transToLower, transToTitle, and transToUpper.
|
overridevirtual |
Definition at line 59 of file cclass_unicode.cxx.
References destroyParserTable().
|
private |
Destroy parser table.
Definition at line 552 of file cclass_unicode_parser.cxx.
References pCont, pStart, and pTable.
Referenced by ~cclass_Unicode().
|
overridevirtual |
Definition at line 134 of file cclass_unicode.cxx.
|
overridevirtual |
Definition at line 216 of file cclass_unicode.cxx.
References getCharType(), nPos, and Text.
|
staticprivate |
Implementation of getCharacterType() for one single character.
Definition at line 151 of file cclass_unicode.cxx.
References ch, CONTROL, DIGIT, o3tl::iterateCodePoints(), nPos, PRINTABLE, Text, and TITLE_CASE.
Referenced by getCharacterType(), and getStringType().
|
private |
Access parser table flags for user defined continuation characters.
Definition at line 689 of file cclass_unicode_parser.cxx.
References aContChars, ILLEGAL, p, pCont, and StrChr().
Referenced by getFlags().
|
private |
Access parser table flags.
Definition at line 560 of file cclass_unicode_parser.cxx.
References CHAR_WORD, getContCharsFlags(), getFlagsExtended(), getStartCharsFlags(), nDefCnt, pTable, ssGetChar, ssGetValue, ssGetWord, ssGetWordFirstChar, ssIgnoreLeadingInRewind, ssRewindFromValue, and WORD.
Referenced by parseText().
|
private |
Access parser flags via International and special definitions.
all KParseTokens::UNI_... must be matched
Definition at line 596 of file cclass_unicode_parser.cxx.
References cDecimalSep, cDecimalSepAlt, cGroupSep, CHAR_DONTCARE, CHAR_VALUE, CHAR_WORD, ILLEGAL, nContTypes, nStartTypes, ssGetChar, ssGetWordFirstChar, ssIgnoreLeadingInRewind, ssRewindFromValue, TOKEN_DIGIT_FLAGS, VALUE, VALUE_SEP, WORD, and WORD_SEP.
Referenced by getFlags().
|
overridevirtual |
Definition at line 283 of file cclass_unicode.cxx.
|
staticprivate |
Get corresponding KParseTokens flag for a character.
all KParseTokens::UNI_... must be matched
Definition at line 337 of file cclass_unicode_parser.cxx.
References nDefCnt, and pParseTokensType.
Referenced by parseText().
|
overridevirtual |
Definition at line 141 of file cclass_unicode.cxx.
|
private |
Access parser table flags for user defined start characters.
Definition at line 676 of file cclass_unicode_parser.cxx.
References aStartChars, ILLEGAL, p, pStart, and StrChr().
Referenced by getFlags().
|
overridevirtual |
Definition at line 223 of file cclass_unicode.cxx.
References getCharType(), nCount, nPos, result, and Text.
|
overridevirtual |
Definition at line 293 of file cclass_unicode.cxx.
|
overridevirtual |
Definition at line 128 of file cclass_unicode.cxx.
|
private |
Init parser table.
TODO: theoretically separators may be a string, adjustment would have to be done here and in parsing and in ::rtl::math::stringToDouble()
Definition at line 408 of file cclass_unicode_parser.cxx.
References aContChars, aParserLocale, aStartChars, cDecimalSep, cDecimalSepAlt, cGroupSep, CHAR_VALUE, CHAR_WORD, i, mxLocaleData, nContTypes, nDefCnt, nStartTypes, p, pCont, pDefaultParserTable, pStart, pTable, setupInternational(), VALUE, and WORD.
Referenced by setupParserTable().
|
overridevirtual |
Definition at line 239 of file cclass_unicode.cxx.
References nPos, parseText(), setupParserTable(), and Text.
|
overridevirtual |
Definition at line 261 of file cclass_unicode.cxx.
References nPos, parseText(), setupParserTable(), and Text.
|
private |
Parse a text.
All the variables below (plus ParseResult) have to be reset on ssRewindFromValue!
All the variables above (plus ParseResult) have to be reset on ssRewindFromValue!
must be first, may fall back to ssGetWord via bMightBeWord
must be last
open quote
Definition at line 702 of file cclass_unicode_parser.cxx.
References aParserLocale, BOOL, cDecimalSep, cDecimalSepAlt, cGroupSep, CHAR, CHAR_BOOL, CHAR_DONTCARE, CHAR_STRING, CHAR_VALUE, CHAR_WORD, EXCLUDED, getFlags(), getParseTokensType(), index, m_xContext, NAME_SEP, nContTypes, nPos, nStartTypes, ssBounce, ssGetBool, ssGetChar, ssGetString, ssGetValue, ssGetWord, ssGetWordFirstChar, ssIgnoreLeadingInRewind, ssRewindFromValue, ssStop, ssStopBack, STRING_SEP, VALUE, VALUE_DIGIT, VALUE_EXP, VALUE_EXP_VALUE, VALUE_SEP, VALUE_SIGN, WORD, and xNatNumSup.
Referenced by parseAnyToken(), and parsePredefinedToken().
|
private |
Setup International class, new'ed only if different from existing.
Definition at line 373 of file cclass_unicode_parser.cxx.
References aParserLocale, m_xContext, and mxLocaleData.
Referenced by initParserTable().
|
private |
Setup parser table. Calls initParserTable() only if needed.
Definition at line 391 of file cclass_unicode_parser.cxx.
References aContChars, aParserLocale, aStartChars, initParserTable(), nContTypes, nStartTypes, and pTable.
Referenced by parseAnyToken(), and parsePredefinedToken().
|
staticprivate |
If and where c occurs in pStr.
Definition at line 321 of file cclass_unicode_parser.cxx.
References n.
Referenced by getContCharsFlags(), and getStartCharsFlags().
|
overridevirtual |
Definition at line 288 of file cclass_unicode.cxx.
References cppu::supportsService().
|
overridevirtual |
Definition at line 77 of file cclass_unicode.cxx.
References nCount, nPos, Text, and transToLower.
|
overridevirtual |
Definition at line 89 of file cclass_unicode.cxx.
References a, Exception, cppu::getCaughtException(), i, m_xContext, nCount, nPos, Text, and transToTitle.
|
overridevirtual |
Definition at line 65 of file cclass_unicode.cxx.
References nCount, nPos, Text, and transToUpper.
|
private |
Definition at line 135 of file cclass_unicode.hxx.
Referenced by getContCharsFlags(), initParserTable(), and setupParserTable().
|
private |
used for parser only
Definition at line 131 of file cclass_unicode.hxx.
Referenced by initParserTable(), parseText(), setupInternational(), and setupParserTable().
|
private |
Definition at line 134 of file cclass_unicode.hxx.
Referenced by getStartCharsFlags(), initParserTable(), and setupParserTable().
|
private |
Definition at line 142 of file cclass_unicode.hxx.
Referenced by getFlagsExtended(), initParserTable(), and parseText().
|
private |
Definition at line 143 of file cclass_unicode.hxx.
Referenced by getFlagsExtended(), initParserTable(), and parseText().
|
private |
Definition at line 141 of file cclass_unicode.hxx.
Referenced by getFlagsExtended(), initParserTable(), and parseText().
|
private |
Definition at line 128 of file cclass_unicode.hxx.
Referenced by parseText(), setupInternational(), and toTitle().
|
private |
Definition at line 132 of file cclass_unicode.hxx.
Referenced by initParserTable(), and setupInternational().
|
private |
Definition at line 140 of file cclass_unicode.hxx.
Referenced by getFlagsExtended(), initParserTable(), parseText(), and setupParserTable().
|
staticprivate |
Definition at line 120 of file cclass_unicode.hxx.
Referenced by getFlags(), getParseTokensType(), and initParserTable().
|
private |
Definition at line 139 of file cclass_unicode.hxx.
Referenced by getFlagsExtended(), initParserTable(), parseText(), and setupParserTable().
|
private |
Definition at line 138 of file cclass_unicode.hxx.
Referenced by destroyParserTable(), getContCharsFlags(), and initParserTable().
|
staticprivate |
Definition at line 121 of file cclass_unicode.hxx.
Referenced by initParserTable().
|
staticprivate |
Definition at line 122 of file cclass_unicode.hxx.
Referenced by getParseTokensType().
|
private |
Definition at line 137 of file cclass_unicode.hxx.
Referenced by destroyParserTable(), getStartCharsFlags(), and initParserTable().
|
private |
Definition at line 136 of file cclass_unicode.hxx.
Referenced by destroyParserTable(), getFlags(), initParserTable(), and setupParserTable().
|
private |
Definition at line 100 of file cclass_unicode.hxx.
Referenced by cclass_Unicode(), and toLower().
|
private |
Definition at line 101 of file cclass_unicode.hxx.
Referenced by cclass_Unicode(), and toTitle().
|
private |
Definition at line 99 of file cclass_unicode.hxx.
Referenced by cclass_Unicode(), and toUpper().
|
private |
Definition at line 133 of file cclass_unicode.hxx.
Referenced by parseText().