LibreOffice Module i18npool (master)  1
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
i18npool::cclass_Unicode Class Referencefinal

#include <cclass_unicode.hxx>

Inheritance diagram for i18npool::cclass_Unicode:
[legend]
Collaboration diagram for i18npool::cclass_Unicode:
[legend]

Public Member Functions

 cclass_Unicode (const css::uno::Reference< css::uno::XComponentContext > &rxContext)
 
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)
 Access parser table flags. More...
 
ParserFlags getFlagsExtended (sal_uInt32 c)
 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_UnicodeStrChr (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 (const OUString &Text, sal_Int32 *nPos, sal_Int32 increment)
 Implementation of getCharacterType() for one single character. More...
 

Private Attributes

std::unique_ptr< Transliteration_casemappingtrans
 
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
 
ScanState eState
 
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 []
 

Detailed Description

Definition at line 64 of file cclass_unicode.hxx.

Member Enumeration Documentation

Enumerator
ssGetChar 
ssGetValue 
ssGetWord 
ssGetWordFirstChar 
ssGetString 
ssGetBool 
ssRewindFromValue 
ssIgnoreLeadingInRewind 
ssStopBack 
ssBounce 
ssStop 

Definition at line 101 of file cclass_unicode.hxx.

Constructor & Destructor Documentation

i18npool::cclass_Unicode::cclass_Unicode ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext)

Definition at line 41 of file cclass_unicode.cxx.

References m_xContext.

i18npool::cclass_Unicode::~cclass_Unicode ( )
overridevirtual

Definition at line 53 of file cclass_unicode.cxx.

References destroyParserTable().

Member Function Documentation

void i18npool::cclass_Unicode::destroyParserTable ( )
private

Destroy parser table.

Definition at line 552 of file cclass_unicode_parser.cxx.

References pCont, pStart, and pTable.

Referenced by ~cclass_Unicode().

sal_Int16 SAL_CALL i18npool::cclass_Unicode::getCharacterDirection ( const OUString &  Text,
sal_Int32  nPos 
)
overridevirtual

Definition at line 128 of file cclass_unicode.cxx.

sal_Int32 SAL_CALL i18npool::cclass_Unicode::getCharacterType ( const OUString &  text,
sal_Int32  nPos,
const css::lang::Locale &  rLocale 
)
overridevirtual

Definition at line 210 of file cclass_unicode.cxx.

References getCharType().

sal_Int32 i18npool::cclass_Unicode::getCharType ( const OUString &  Text,
sal_Int32 *  nPos,
sal_Int32  increment 
)
staticprivate

Implementation of getCharacterType() for one single character.

Definition at line 145 of file cclass_unicode.cxx.

References CONTROL, DIGIT, PRINTABLE, and TITLE_CASE.

Referenced by getCharacterType(), and getStringType().

ParserFlags i18npool::cclass_Unicode::getContCharsFlags ( sal_Unicode  c)
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().

ParserFlags i18npool::cclass_Unicode::getFlags ( sal_uInt32  c)
private
ParserFlags i18npool::cclass_Unicode::getFlagsExtended ( sal_uInt32  c)
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, eState, ILLEGAL, nContTypes, nStartTypes, ssGetChar, ssGetWordFirstChar, ssIgnoreLeadingInRewind, ssRewindFromValue, TOKEN_DIGIT_FLAGS, VALUE, VALUE_SEP, WORD, and WORD_SEP.

Referenced by getFlags().

OUString SAL_CALL i18npool::cclass_Unicode::getImplementationName ( )
overridevirtual

Definition at line 277 of file cclass_unicode.cxx.

sal_Int32 i18npool::cclass_Unicode::getParseTokensType ( sal_uInt32  c,
bool  isFirst 
)
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().

sal_Int16 SAL_CALL i18npool::cclass_Unicode::getScript ( const OUString &  Text,
sal_Int32  nPos 
)
overridevirtual

Definition at line 135 of file cclass_unicode.cxx.

ParserFlags i18npool::cclass_Unicode::getStartCharsFlags ( sal_uInt32  c)
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().

sal_Int32 SAL_CALL i18npool::cclass_Unicode::getStringType ( const OUString &  text,
sal_Int32  nPos,
sal_Int32  nCount,
const css::lang::Locale &  rLocale 
)
overridevirtual

Definition at line 217 of file cclass_unicode.cxx.

References getCharType(), and result.

Sequence< OUString > SAL_CALL i18npool::cclass_Unicode::getSupportedServiceNames ( )
overridevirtual

Definition at line 287 of file cclass_unicode.cxx.

sal_Int16 SAL_CALL i18npool::cclass_Unicode::getType ( const OUString &  Text,
sal_Int32  nPos 
)
overridevirtual

Definition at line 122 of file cclass_unicode.cxx.

void i18npool::cclass_Unicode::initParserTable ( const css::lang::Locale &  rLocale,
sal_Int32  startCharTokenType,
const OUString &  userDefinedCharactersStart,
sal_Int32  contCharTokenType,
const OUString &  userDefinedCharactersCont 
)
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().

ParseResult SAL_CALL i18npool::cclass_Unicode::parseAnyToken ( const OUString &  Text,
sal_Int32  nPos,
const css::lang::Locale &  rLocale,
sal_Int32  nStartCharFlags,
const OUString &  userDefinedCharactersStart,
sal_Int32  nContCharFlags,
const OUString &  userDefinedCharactersCont 
)
overridevirtual

Definition at line 233 of file cclass_unicode.cxx.

References parseText(), and setupParserTable().

ParseResult SAL_CALL i18npool::cclass_Unicode::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 
)
overridevirtual

Definition at line 255 of file cclass_unicode.cxx.

References parseText(), and setupParserTable().

void i18npool::cclass_Unicode::parseText ( css::i18n::ParseResult &  r,
const OUString &  rText,
sal_Int32  nPos,
sal_Int32  nTokenType = 0xffffffff 
)
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, assert(), BOOL, cDecimalSep, cDecimalSepAlt, cGroupSep, CHAR, CHAR_BOOL, CHAR_DONTCARE, CHAR_STRING, CHAR_VALUE, CHAR_WORD, eState, EXCLUDED, getFlags(), getParseTokensType(), index, m_xContext, NAME_SEP, nContTypes, 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().

void i18npool::cclass_Unicode::setupInternational ( const css::lang::Locale &  rLocale)
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().

void i18npool::cclass_Unicode::setupParserTable ( const css::lang::Locale &  rLocale,
sal_Int32  startCharTokenType,
const OUString &  userDefinedCharactersStart,
sal_Int32  contCharTokenType,
const OUString &  userDefinedCharactersCont 
)
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().

const sal_Unicode * i18npool::cclass_Unicode::StrChr ( const sal_Unicode pStr,
sal_uInt32  c 
)
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().

sal_Bool SAL_CALL i18npool::cclass_Unicode::supportsService ( const OUString &  ServiceName)
overridevirtual

Definition at line 282 of file cclass_unicode.cxx.

References cppu::supportsService().

OUString SAL_CALL i18npool::cclass_Unicode::toLower ( const OUString &  Text,
sal_Int32  nPos,
sal_Int32  nCount,
const css::lang::Locale &  rLocale 
)
overridevirtual

Definition at line 71 of file cclass_unicode.cxx.

References trans.

OUString SAL_CALL i18npool::cclass_Unicode::toTitle ( const OUString &  Text,
sal_Int32  nPos,
sal_Int32  nCount,
const css::lang::Locale &  rLocale 
)
overridevirtual

Definition at line 83 of file cclass_unicode.cxx.

References a, Exception, cppu::getCaughtException(), i, m_xContext, and trans.

OUString SAL_CALL i18npool::cclass_Unicode::toUpper ( const OUString &  Text,
sal_Int32  nPos,
sal_Int32  nCount,
const css::lang::Locale &  rLocale 
)
overridevirtual

Definition at line 59 of file cclass_unicode.cxx.

References trans.

Member Data Documentation

OUString i18npool::cclass_Unicode::aContChars
private

Definition at line 131 of file cclass_unicode.hxx.

Referenced by getContCharsFlags(), initParserTable(), and setupParserTable().

css::lang::Locale i18npool::cclass_Unicode::aParserLocale
private

used for parser only

Definition at line 127 of file cclass_unicode.hxx.

Referenced by initParserTable(), parseText(), setupInternational(), and setupParserTable().

OUString i18npool::cclass_Unicode::aStartChars
private

Definition at line 130 of file cclass_unicode.hxx.

Referenced by getStartCharsFlags(), initParserTable(), and setupParserTable().

sal_Unicode i18npool::cclass_Unicode::cDecimalSep
private

Definition at line 139 of file cclass_unicode.hxx.

Referenced by getFlagsExtended(), initParserTable(), and parseText().

sal_Unicode i18npool::cclass_Unicode::cDecimalSepAlt
private

Definition at line 140 of file cclass_unicode.hxx.

Referenced by getFlagsExtended(), initParserTable(), and parseText().

sal_Unicode i18npool::cclass_Unicode::cGroupSep
private

Definition at line 138 of file cclass_unicode.hxx.

Referenced by getFlagsExtended(), initParserTable(), and parseText().

ScanState i18npool::cclass_Unicode::eState
private

Definition at line 137 of file cclass_unicode.hxx.

Referenced by getFlags(), getFlagsExtended(), and parseText().

css::uno::Reference< css::uno::XComponentContext > i18npool::cclass_Unicode::m_xContext
private

Definition at line 124 of file cclass_unicode.hxx.

Referenced by parseText(), setupInternational(), and toTitle().

css::uno::Reference< css::i18n::XLocaleData5 > i18npool::cclass_Unicode::mxLocaleData
private

Definition at line 128 of file cclass_unicode.hxx.

Referenced by initParserTable(), and setupInternational().

sal_Int32 i18npool::cclass_Unicode::nContTypes
private

Definition at line 136 of file cclass_unicode.hxx.

Referenced by getFlagsExtended(), initParserTable(), parseText(), and setupParserTable().

const sal_uInt8 i18npool::cclass_Unicode::nDefCnt = 128
staticprivate

Definition at line 116 of file cclass_unicode.hxx.

Referenced by getFlags(), getParseTokensType(), and initParserTable().

sal_Int32 i18npool::cclass_Unicode::nStartTypes
private

Definition at line 135 of file cclass_unicode.hxx.

Referenced by getFlagsExtended(), initParserTable(), parseText(), and setupParserTable().

std::unique_ptr<ParserFlags[]> i18npool::cclass_Unicode::pCont
private

Definition at line 134 of file cclass_unicode.hxx.

Referenced by destroyParserTable(), getContCharsFlags(), and initParserTable().

const ParserFlags i18npool::cclass_Unicode::pDefaultParserTable
staticprivate

Definition at line 117 of file cclass_unicode.hxx.

Referenced by initParserTable().

const sal_Int32 i18npool::cclass_Unicode::pParseTokensType
staticprivate

Definition at line 118 of file cclass_unicode.hxx.

Referenced by getParseTokensType().

std::unique_ptr<ParserFlags[]> i18npool::cclass_Unicode::pStart
private

Definition at line 133 of file cclass_unicode.hxx.

Referenced by destroyParserTable(), getStartCharsFlags(), and initParserTable().

std::unique_ptr<ParserFlags[]> i18npool::cclass_Unicode::pTable
private
std::unique_ptr<Transliteration_casemapping> i18npool::cclass_Unicode::trans
private

Definition at line 97 of file cclass_unicode.hxx.

Referenced by toLower(), toTitle(), and toUpper().

css::uno::Reference< css::i18n::XNativeNumberSupplier > i18npool::cclass_Unicode::xNatNumSup
private

Definition at line 129 of file cclass_unicode.hxx.

Referenced by parseText().


The documentation for this class was generated from the following files: