diff options
author | Noel Grandin <noel@peralex.com> | 2013-09-13 13:20:26 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-09-17 09:02:18 +0200 |
commit | 8f23a3b0e2484fea4a85f4d5b961a718c71877a9 (patch) | |
tree | 72957d4969ce8aab5a84fd811ae4e0be6dacf560 /include/formula | |
parent | 12d44973d96f5cad4b99386c8a281f8427d304e4 (diff) |
convert formula::FormulaCompiler::OpCodeMap from String to OUString
..and add some convenience methods
sal_Unicode getSymbolChar
sal_Unicode GetNativeSymbolChar
since most call sites are only interested in the first char of
the symbol.
Change-Id: I6aeb43b055b849e71cb1f62c3efe79d6a4cc10bd
Diffstat (limited to 'include/formula')
-rw-r--r-- | include/formula/FormulaCompiler.hxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index 0328e39f4048..641107e2f489 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -87,11 +87,11 @@ public: class FORMULA_DLLPUBLIC OpCodeMap { OpCodeHashMap * mpHashMap; /// Hash map of symbols, String -> OpCode - String * mpTable; /// Array of symbols, OpCode -> String, offset==OpCode + OUString * mpTable; /// Array of symbols, OpCode -> String, offset==OpCode ExternalHashMap * mpExternalHashMap; /// Hash map of ocExternal, Filter String -> AddIn String ExternalHashMap * mpReverseExternalHashMap; /// Hash map of ocExternal, AddIn String -> Filter String FormulaGrammar::Grammar meGrammar; /// Grammar, language and reference convention - sal_uInt16 mnSymbols; /// Count of OpCode symbols + sal_uInt16 mnSymbols; /// Count of OpCode symbols bool mbCore : 1; /// If mapping was setup by core, not filters bool mbEnglish : 1; /// If English symbols and external names @@ -103,7 +103,7 @@ public: OpCodeMap(sal_uInt16 nSymbols, bool bCore, FormulaGrammar::Grammar eGrammar ) : mpHashMap( new OpCodeHashMap( nSymbols)), - mpTable( new String[ nSymbols ]), + mpTable( new OUString[ nSymbols ]), mpExternalHashMap( new ExternalHashMap), mpReverseExternalHashMap( new ExternalHashMap), meGrammar( eGrammar), @@ -133,15 +133,18 @@ public: inline const ExternalHashMap* getReverseExternalHashMap() const { return mpReverseExternalHashMap; } /// Get the symbol string matching an OpCode. - inline const String& getSymbol( const OpCode eOp ) const + inline const OUString& getSymbol( const OpCode eOp ) const { DBG_ASSERT( sal_uInt16(eOp) < mnSymbols, "OpCodeMap::getSymbol: OpCode out of range"); if (sal_uInt16(eOp) < mnSymbols) return mpTable[ eOp ]; - static String s_sEmpty; + static OUString s_sEmpty; return s_sEmpty; } + /// Get the first character of the symbol string matching an OpCode. + inline sal_Unicode getSymbolChar( const OpCode eOp ) const { return getSymbol(eOp)[0]; }; + /// Get the grammar. inline FormulaGrammar::Grammar getGrammar() const { return meGrammar; } @@ -237,7 +240,8 @@ public: static bool DeQuote( String& rStr ); - static const String& GetNativeSymbol( OpCode eOp ); + static const OUString& GetNativeSymbol( OpCode eOp ); + static sal_Unicode GetNativeSymbolChar( OpCode eOp ); static bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix short GetNumFormatType() const { return nNumFmt; } |