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 (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_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 (std::u16string_view Text, sal_Int32 *nPos, sal_Int32 increment)
 Implementation of getCharacterType() for one single character. More...
 

Private Attributes

rtl::Reference< Transliteration_casemappingtransToUpper
 
rtl::Reference< Transliteration_casemappingtransToLower
 
rtl::Reference< Transliteration_casemappingtransToTitle
 
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 []
 

Detailed Description

Definition at line 64 of file cclass_unicode.hxx.

Member Enumeration Documentation

◆ ScanState

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

Definition at line 105 of file cclass_unicode.hxx.

Constructor & Destructor Documentation

◆ cclass_Unicode()

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.

◆ ~cclass_Unicode()

i18npool::cclass_Unicode::~cclass_Unicode ( )
overridevirtual

Definition at line 59 of file cclass_unicode.cxx.

References destroyParserTable().

Member Function Documentation

◆ destroyParserTable()

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().

◆ getCharacterDirection()

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

Definition at line 134 of file cclass_unicode.cxx.

References nPos, and Text.

◆ getCharacterType()

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

Definition at line 216 of file cclass_unicode.cxx.

References getCharType(), nPos, and Text.

◆ getCharType()

sal_Int32 i18npool::cclass_Unicode::getCharType ( std::u16string_view  Text,
sal_Int32 *  nPos,
sal_Int32  increment 
)
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().

◆ getContCharsFlags()

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().

◆ getFlags()

ParserFlags i18npool::cclass_Unicode::getFlags ( sal_uInt32  c,
const cclass_Unicode::ScanState  eState 
)
private

◆ getFlagsExtended()

ParserFlags i18npool::cclass_Unicode::getFlagsExtended ( sal_uInt32  c,
const cclass_Unicode::ScanState  eState 
) const
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().

◆ getImplementationName()

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

Definition at line 283 of file cclass_unicode.cxx.

◆ getParseTokensType()

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().

◆ getScript()

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

Definition at line 141 of file cclass_unicode.cxx.

References nPos, and Text.

◆ getStartCharsFlags()

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().

◆ getStringType()

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 223 of file cclass_unicode.cxx.

References getCharType(), nCount, nPos, result, and Text.

◆ getSupportedServiceNames()

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

Definition at line 293 of file cclass_unicode.cxx.

◆ getType()

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

Definition at line 128 of file cclass_unicode.cxx.

References nPos, and Text.

◆ initParserTable()

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().

◆ parseAnyToken()

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 239 of file cclass_unicode.cxx.

References nPos, parseText(), setupParserTable(), and Text.

◆ parsePredefinedToken()

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 261 of file cclass_unicode.cxx.

References nPos, parseText(), setupParserTable(), and Text.

◆ parseText()

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, 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().

◆ setupInternational()

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().

◆ setupParserTable()

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().

◆ StrChr()

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().

◆ supportsService()

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

Definition at line 288 of file cclass_unicode.cxx.

References cppu::supportsService().

◆ toLower()

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 77 of file cclass_unicode.cxx.

References nCount, nPos, Text, and transToLower.

◆ toTitle()

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 89 of file cclass_unicode.cxx.

References a, Exception, cppu::getCaughtException(), i, m_xContext, nCount, nPos, Text, and transToTitle.

◆ toUpper()

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 65 of file cclass_unicode.cxx.

References nCount, nPos, Text, and transToUpper.

Member Data Documentation

◆ aContChars

OUString i18npool::cclass_Unicode::aContChars
private

Definition at line 135 of file cclass_unicode.hxx.

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

◆ aParserLocale

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

used for parser only

Definition at line 131 of file cclass_unicode.hxx.

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

◆ aStartChars

OUString i18npool::cclass_Unicode::aStartChars
private

Definition at line 134 of file cclass_unicode.hxx.

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

◆ cDecimalSep

sal_Unicode i18npool::cclass_Unicode::cDecimalSep
private

Definition at line 142 of file cclass_unicode.hxx.

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

◆ cDecimalSepAlt

sal_Unicode i18npool::cclass_Unicode::cDecimalSepAlt
private

Definition at line 143 of file cclass_unicode.hxx.

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

◆ cGroupSep

sal_Unicode i18npool::cclass_Unicode::cGroupSep
private

Definition at line 141 of file cclass_unicode.hxx.

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

◆ m_xContext

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

Definition at line 128 of file cclass_unicode.hxx.

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

◆ mxLocaleData

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

Definition at line 132 of file cclass_unicode.hxx.

Referenced by initParserTable(), and setupInternational().

◆ nContTypes

sal_Int32 i18npool::cclass_Unicode::nContTypes
private

Definition at line 140 of file cclass_unicode.hxx.

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

◆ nDefCnt

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

Definition at line 120 of file cclass_unicode.hxx.

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

◆ nStartTypes

sal_Int32 i18npool::cclass_Unicode::nStartTypes
private

Definition at line 139 of file cclass_unicode.hxx.

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

◆ pCont

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

Definition at line 138 of file cclass_unicode.hxx.

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

◆ pDefaultParserTable

const ParserFlags i18npool::cclass_Unicode::pDefaultParserTable
staticprivate

Definition at line 121 of file cclass_unicode.hxx.

Referenced by initParserTable().

◆ pParseTokensType

const sal_Int32 i18npool::cclass_Unicode::pParseTokensType
staticprivate

Definition at line 122 of file cclass_unicode.hxx.

Referenced by getParseTokensType().

◆ pStart

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

Definition at line 137 of file cclass_unicode.hxx.

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

◆ pTable

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

◆ transToLower

rtl::Reference<Transliteration_casemapping> i18npool::cclass_Unicode::transToLower
private

Definition at line 100 of file cclass_unicode.hxx.

Referenced by cclass_Unicode(), and toLower().

◆ transToTitle

rtl::Reference<Transliteration_casemapping> i18npool::cclass_Unicode::transToTitle
private

Definition at line 101 of file cclass_unicode.hxx.

Referenced by cclass_Unicode(), and toTitle().

◆ transToUpper

rtl::Reference<Transliteration_casemapping> i18npool::cclass_Unicode::transToUpper
private

Definition at line 99 of file cclass_unicode.hxx.

Referenced by cclass_Unicode(), and toUpper().

◆ xNatNumSup

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

Definition at line 133 of file cclass_unicode.hxx.

Referenced by parseText().


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