LibreOffice Module formula (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
formula::FormulaCompiler::OpCodeMap Class Referencefinal

Mappings from strings to OpCodes and vice versa. More...

#include <FormulaCompiler.hxx>

Public Member Functions

 OpCodeMap (sal_uInt16 nSymbols, bool bCore, FormulaGrammar::Grammar eGrammar)
 
void copyFrom (const OpCodeMap &r)
 Copy mappings from r into this map, effectively replacing this map. More...
 
const OpCodeHashMapgetHashMap () const
 Get the symbol String -> OpCode hash map for finds. More...
 
const ExternalHashMapgetExternalHashMap () const
 Get the symbol String -> AddIn String hash map for finds. More...
 
const ExternalHashMapgetReverseExternalHashMap () const
 Get the AddIn String -> symbol String hash map for finds. More...
 
const OUString & getSymbol (const OpCode eOp) const
 Get the symbol string matching an OpCode. More...
 
sal_Unicode getSymbolChar (const OpCode eOp) const
 Get the first character of the symbol string matching an OpCode. More...
 
FormulaGrammar::Grammar getGrammar () const
 Get the grammar. More...
 
sal_uInt16 getSymbolCount () const
 Get the symbol count. More...
 
bool isEnglish () const
 Are these English symbols, as opposed to native language (which may be English as well)? More...
 
bool isEnglishLocale () const
 Are inline numbers parsed/formatted in en-US locale, as opposed to default locale? More...
 
bool isPODF () const
 Is it an ODF 1.1 compatibility mapping? More...
 
bool isODFF () const
 Is it an ODFF / ODF 1.2 mapping? More...
 
bool isOOXML () const
 Is it an OOXML mapping? More...
 
bool hasExternals () const
 Does it have external symbol/name mappings? More...
 
void putOpCode (const OUString &rStr, const OpCode eOp, const CharClass *pCharClass)
 Put entry of symbol String and OpCode pair. More...
 
void putExternal (const OUString &rSymbol, const OUString &rAddIn)
 Put entry of symbol String and AddIn international String pair. More...
 
void putExternalSoftly (const OUString &rSymbol, const OUString &rAddIn)
 Put entry of symbol String and AddIn international String pair, not warning just info as used for AddIn collection and setting up alias names. More...
 
css::uno::Sequence< css::sheet::FormulaToken > createSequenceOfFormulaTokens (const FormulaCompiler &_rCompiler, const css::uno::Sequence< OUString > &rNames) const
 Core implementation of XFormulaOpCodeMapper::getMappings() More...
 
css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry > createSequenceOfAvailableMappings (const FormulaCompiler &_rCompiler, const sal_Int32 nGroup) const
 Core implementation of XFormulaOpCodeMapper::getAvailableMappings() More...
 

Static Public Member Functions

static sal_Int32 getOpCodeUnknown ()
 The value used in createSequenceOfAvailableMappings() and thus in XFormulaOpCodeMapper::getMappings() for an unknown symbol. More...
 

Private Member Functions

 OpCodeMap (const OpCodeMap &)=delete
 If English locale for numbers. More...
 
OpCodeMapoperator= (const OpCodeMap &)=delete
 
void putCopyOpCode (const OUString &rSymbol, OpCode eOp)
 Conditionally put a mapping in copyFrom() context. More...
 

Private Attributes

OpCodeHashMap maHashMap
 
std::unique_ptr< OUString[]> mpTable
 Hash map of symbols, OUString -> OpCode. More...
 
ExternalHashMap maExternalHashMap
 Array of symbols, OpCode -> OUString, offset==OpCode. More...
 
ExternalHashMap maReverseExternalHashMap
 Hash map of ocExternal, Filter String -> AddIn String. More...
 
FormulaGrammar::Grammar meGrammar
 Hash map of ocExternal, AddIn String -> Filter String. More...
 
sal_uInt16 mnSymbols
 Grammar, language and reference convention. More...
 
bool mbCore: 1
 Count of OpCode symbols. More...
 
bool mbEnglish: 1
 If mapping was setup by core, not filters. More...
 
bool mbEnglishLocale: 1
 If English symbols and external names. More...
 

Detailed Description

Mappings from strings to OpCodes and vice versa.

Definition at line 82 of file FormulaCompiler.hxx.

Constructor & Destructor Documentation

◆ OpCodeMap() [1/2]

formula::FormulaCompiler::OpCodeMap::OpCodeMap ( const OpCodeMap )
privatedelete

If English locale for numbers.

◆ OpCodeMap() [2/2]

formula::FormulaCompiler::OpCodeMap::OpCodeMap ( sal_uInt16  nSymbols,
bool  bCore,
FormulaGrammar::Grammar  eGrammar 
)
inline

Definition at line 99 of file FormulaCompiler.hxx.

Member Function Documentation

◆ copyFrom()

void formula::FormulaCompiler::OpCodeMap::copyFrom ( const OpCodeMap r)

Copy mappings from r into this map, effectively replacing this map.

Override known legacy bad function names with correct ones if the conditions can be derived from the current maps.

Definition at line 1257 of file FormulaCompiler.cxx.

References formula::FormulaGrammar::extractFormulaLanguage(), getSymbolCount(), i, maExternalHashMap, maReverseExternalHashMap, mbCore, mbEnglish, meGrammar, formula::FormulaCompiler::meGrammar, mpTable, n, ocRRI, ocTableOp, and SAL_WARN_IF.

◆ createSequenceOfAvailableMappings()

uno::Sequence< sheet::FormulaOpCodeMapEntry > formula::FormulaCompiler::OpCodeMap::createSequenceOfAvailableMappings ( const FormulaCompiler _rCompiler,
const sal_Int32  nGroup 
) const

◆ createSequenceOfFormulaTokens()

uno::Sequence< sheet::FormulaToken > formula::FormulaCompiler::OpCodeMap::createSequenceOfFormulaTokens ( const FormulaCompiler _rCompiler,
const css::uno::Sequence< OUString > &  rNames 
) const

Core implementation of XFormulaOpCodeMapper::getMappings()

Definition at line 463 of file FormulaCompiler.cxx.

References formula::FormulaCompiler::FindAddInFunction(), ocExternal, and pName.

◆ getExternalHashMap()

const ExternalHashMap & formula::FormulaCompiler::OpCodeMap::getExternalHashMap ( ) const
inline

Get the symbol String -> AddIn String hash map for finds.

Definition at line 122 of file FormulaCompiler.hxx.

◆ getGrammar()

FormulaGrammar::Grammar formula::FormulaCompiler::OpCodeMap::getGrammar ( ) const
inline

Get the grammar.

Definition at line 141 of file FormulaCompiler.hxx.

◆ getHashMap()

const OpCodeHashMap & formula::FormulaCompiler::OpCodeMap::getHashMap ( ) const
inline

Get the symbol String -> OpCode hash map for finds.

Definition at line 119 of file FormulaCompiler.hxx.

◆ getOpCodeUnknown()

static sal_Int32 formula::FormulaCompiler::OpCodeMap::getOpCodeUnknown ( )
inlinestatic

The value used in createSequenceOfAvailableMappings() and thus in XFormulaOpCodeMapper::getMappings() for an unknown symbol.

Definition at line 190 of file FormulaCompiler.hxx.

Referenced by formula::FormulaOpCodeMapperObj::getOpCodeUnknown().

◆ getReverseExternalHashMap()

const ExternalHashMap & formula::FormulaCompiler::OpCodeMap::getReverseExternalHashMap ( ) const
inline

Get the AddIn String -> symbol String hash map for finds.

Definition at line 125 of file FormulaCompiler.hxx.

◆ getSymbol()

const OUString & formula::FormulaCompiler::OpCodeMap::getSymbol ( const OpCode  eOp) const
inline

Get the symbol string matching an OpCode.

Definition at line 128 of file FormulaCompiler.hxx.

References DBG_ASSERT.

◆ getSymbolChar()

sal_Unicode formula::FormulaCompiler::OpCodeMap::getSymbolChar ( const OpCode  eOp) const
inline

Get the first character of the symbol string matching an OpCode.

Definition at line 138 of file FormulaCompiler.hxx.

◆ getSymbolCount()

sal_uInt16 formula::FormulaCompiler::OpCodeMap::getSymbolCount ( ) const
inline

Get the symbol count.

Definition at line 144 of file FormulaCompiler.hxx.

Referenced by copyFrom().

◆ hasExternals()

bool formula::FormulaCompiler::OpCodeMap::hasExternals ( ) const
inline

Does it have external symbol/name mappings?

Definition at line 166 of file FormulaCompiler.hxx.

◆ isEnglish()

bool formula::FormulaCompiler::OpCodeMap::isEnglish ( ) const
inline

Are these English symbols, as opposed to native language (which may be English as well)?

Definition at line 148 of file FormulaCompiler.hxx.

◆ isEnglishLocale()

bool formula::FormulaCompiler::OpCodeMap::isEnglishLocale ( ) const
inline

Are inline numbers parsed/formatted in en-US locale, as opposed to default locale?

Definition at line 152 of file FormulaCompiler.hxx.

◆ isODFF()

bool formula::FormulaCompiler::OpCodeMap::isODFF ( ) const
inline

Is it an ODFF / ODF 1.2 mapping?

Definition at line 160 of file FormulaCompiler.hxx.

References formula::FormulaGrammar::isODFF().

◆ isOOXML()

bool formula::FormulaCompiler::OpCodeMap::isOOXML ( ) const
inline

Is it an OOXML mapping?

Definition at line 163 of file FormulaCompiler.hxx.

References formula::FormulaGrammar::isOOXML().

◆ isPODF()

bool formula::FormulaCompiler::OpCodeMap::isPODF ( ) const
inline

Is it an ODF 1.1 compatibility mapping?

Definition at line 155 of file FormulaCompiler.hxx.

References formula::FormulaGrammar::isPODF().

◆ operator=()

OpCodeMap & formula::FormulaCompiler::OpCodeMap::operator= ( const OpCodeMap )
privatedelete

◆ putCopyOpCode()

void formula::FormulaCompiler::OpCodeMap::putCopyOpCode ( const OUString &  rSymbol,
OpCode  eOp 
)
private

Conditionally put a mapping in copyFrom() context.

Does NOT check eOp range!

Definition at line 1243 of file FormulaCompiler.cxx.

References maHashMap, mpTable, and SAL_WARN_IF.

◆ putExternal()

void formula::FormulaCompiler::OpCodeMap::putExternal ( const OUString &  rSymbol,
const OUString &  rAddIn 
)

Put entry of symbol String and AddIn international String pair.

Definition at line 434 of file FormulaCompiler.cxx.

References SAL_INFO_IF, and SAL_WARN_IF.

◆ putExternalSoftly()

void formula::FormulaCompiler::OpCodeMap::putExternalSoftly ( const OUString &  rSymbol,
const OUString &  rAddIn 
)

Put entry of symbol String and AddIn international String pair, not warning just info as used for AddIn collection and setting up alias names.

Definition at line 451 of file FormulaCompiler.cxx.

References SAL_INFO, and SAL_INFO_IF.

◆ putOpCode()

void formula::FormulaCompiler::OpCodeMap::putOpCode ( const OUString &  rStr,
const OpCode  eOp,
const CharClass pCharClass 
)

Member Data Documentation

◆ maExternalHashMap

ExternalHashMap formula::FormulaCompiler::OpCodeMap::maExternalHashMap
private

Array of symbols, OpCode -> OUString, offset==OpCode.

Definition at line 86 of file FormulaCompiler.hxx.

Referenced by copyFrom().

◆ maHashMap

OpCodeHashMap formula::FormulaCompiler::OpCodeMap::maHashMap
private

Definition at line 84 of file FormulaCompiler.hxx.

Referenced by putCopyOpCode().

◆ maReverseExternalHashMap

ExternalHashMap formula::FormulaCompiler::OpCodeMap::maReverseExternalHashMap
private

Hash map of ocExternal, Filter String -> AddIn String.

Definition at line 87 of file FormulaCompiler.hxx.

Referenced by copyFrom().

◆ mbCore

bool formula::FormulaCompiler::OpCodeMap::mbCore
private

Count of OpCode symbols.

Definition at line 90 of file FormulaCompiler.hxx.

Referenced by copyFrom().

◆ mbEnglish

bool formula::FormulaCompiler::OpCodeMap::mbEnglish
private

If mapping was setup by core, not filters.

Definition at line 91 of file FormulaCompiler.hxx.

Referenced by copyFrom().

◆ mbEnglishLocale

bool formula::FormulaCompiler::OpCodeMap::mbEnglishLocale
private

If English symbols and external names.

Definition at line 92 of file FormulaCompiler.hxx.

◆ meGrammar

FormulaGrammar::Grammar formula::FormulaCompiler::OpCodeMap::meGrammar
private

Hash map of ocExternal, AddIn String -> Filter String.

Definition at line 88 of file FormulaCompiler.hxx.

Referenced by copyFrom().

◆ mnSymbols

sal_uInt16 formula::FormulaCompiler::OpCodeMap::mnSymbols
private

Grammar, language and reference convention.

Definition at line 89 of file FormulaCompiler.hxx.

◆ mpTable

std::unique_ptr<OUString[]> formula::FormulaCompiler::OpCodeMap::mpTable
private

Hash map of symbols, OUString -> OpCode.

Definition at line 85 of file FormulaCompiler.hxx.

Referenced by copyFrom(), and putCopyOpCode().


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