summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-17 10:25:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-17 10:09:50 +0000
commit06f0d2d9f1ff0f6a8d1eddc693e4c4f65ec2b046 (patch)
treec2ab6a55156f972d721b3362dc4219bb4f639bba
parentdc003d59ea81d39bccc88f47b0a0d6c12f82357d (diff)
convert FormulaCompiler::SeparatorType to scoped enum
and drop unused COMMA_BASE enumerator Change-Id: I5f35ba7453d5ca613ebd65d0853c7caaa210f3de Reviewed-on: https://gerrit.libreoffice.org/34357 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rwxr-xr-xcompilerplugins/clang/unusedenumconstants.py2
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx33
-rw-r--r--include/formula/FormulaCompiler.hxx7
3 files changed, 14 insertions, 28 deletions
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index cb45db759554..4a0c49c5012f 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -145,6 +145,8 @@ for d in definitionSet:
"basic/source/inc/token.hxx", # SbiToken
"binaryurp/source/specialfunctionids.hxx", # binaryurp::SpecialFunctionIds
"connectivity/source/inc/odbc/OTools.hxx", # ODBC3SQLFunctionId
+ "include/formula/grammar.hxx", # FormulaGrammar::Grammar
+ "include/formula/opcode.hxx", # OpCode
# Windows or OSX only
"include/canvas/rendering/icolorbuffer.hxx",
"include/vcl/commandevent.hxx",
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index d837e2e3a398..8f86ce54af25 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -147,7 +147,7 @@ class OpCodeList
public:
OpCodeList( sal_uInt16, FormulaCompiler::NonConstOpCodeMapPtr,
- FormulaCompiler::SeparatorType = FormulaCompiler::SEMICOLON_BASE );
+ FormulaCompiler::SeparatorType = FormulaCompiler::SeparatorType::SEMICOLON_BASE );
private:
bool getOpCodeString( OUString& rStr, sal_uInt16 nOp );
@@ -165,7 +165,7 @@ OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr x
{
SvtSysLocale aSysLocale;
const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : aSysLocale.GetCharClassPtr());
- if (meSepType == FormulaCompiler::RESOURCE_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::RESOURCE_BASE)
{
for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
{
@@ -191,12 +191,7 @@ bool OpCodeList::getOpCodeString( OUString& rStr, sal_uInt16 nOp )
{
case SC_OPCODE_SEP:
{
- if (meSepType == FormulaCompiler::COMMA_BASE)
- {
- rStr = ",";
- return true;
- }
- else if (meSepType == FormulaCompiler::SEMICOLON_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::SEMICOLON_BASE)
{
rStr = ";";
return true;
@@ -205,12 +200,7 @@ bool OpCodeList::getOpCodeString( OUString& rStr, sal_uInt16 nOp )
break;
case SC_OPCODE_ARRAY_COL_SEP:
{
- if (meSepType == FormulaCompiler::COMMA_BASE)
- {
- rStr = ",";
- return true;
- }
- else if (meSepType == FormulaCompiler::SEMICOLON_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::SEMICOLON_BASE)
{
rStr = ";";
return true;
@@ -219,12 +209,7 @@ bool OpCodeList::getOpCodeString( OUString& rStr, sal_uInt16 nOp )
break;
case SC_OPCODE_ARRAY_ROW_SEP:
{
- if (meSepType == FormulaCompiler::COMMA_BASE)
- {
- rStr = ";";
- return true;
- }
- else if (meSepType == FormulaCompiler::SEMICOLON_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::SEMICOLON_BASE)
{
rStr = "|";
return true;
@@ -893,7 +878,7 @@ void FormulaCompiler::InitSymbolsPODF() const
static OpCodeMapData aMap;
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsPODF = aMap.mxSymbolMap;
}
@@ -903,7 +888,7 @@ void FormulaCompiler::InitSymbolsAPI() const
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
// XFunctionAccess API always used PODF grammar, keep it.
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_API, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_API, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsAPI = aMap.mxSymbolMap;
}
@@ -912,7 +897,7 @@ void FormulaCompiler::InitSymbolsODFF() const
static OpCodeMapData aMap;
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF, FormulaGrammar::GRAM_ODFF, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF, FormulaGrammar::GRAM_ODFF, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsODFF = aMap.mxSymbolMap;
}
@@ -937,7 +922,7 @@ void FormulaCompiler::InitSymbolsOOXML() const
static OpCodeMapData aMap;
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML, FormulaGrammar::GRAM_OOXML, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML, FormulaGrammar::GRAM_OOXML, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsOOXML = aMap.mxSymbolMap;
}
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 96d945f220b7..f9ab53a78352 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -266,11 +266,10 @@ public:
than RESOURCE_BASE may override the resource strings. Used by OpCodeList
implementation via loadSymbols().
*/
- enum SeparatorType
+ enum class SeparatorType
{
RESOURCE_BASE,
- SEMICOLON_BASE,
- COMMA_BASE
+ SEMICOLON_BASE
};
protected:
@@ -359,7 +358,7 @@ private:
void InitSymbolsOOXML() const; /// only SymbolsOOXML, on demand
void loadSymbols( sal_uInt16 nSymbols, FormulaGrammar::Grammar eGrammar, NonConstOpCodeMapPtr& rxMap,
- SeparatorType eSepType = SEMICOLON_BASE ) const;
+ SeparatorType eSepType = SeparatorType::SEMICOLON_BASE ) const;
/** Check pCurrentFactorToken for nParam's (0-based) ForceArray types and
set ForceArray at rCurr if so. Set nParam+1 as 1-based