diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-14 14:39:56 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-14 23:53:51 -0500 |
commit | d9a914fe5b221f879c6fb7873c7e7011dc655421 (patch) | |
tree | b3c5a683480e054bd600511df111a11cc35832ee | |
parent | 6a4b377c1a5794efee4cbdc93289bc9ce5ead730 (diff) |
Identify methods that don't modify internal state and mark them const.
Change-Id: Ie63d93d51640bfb80dc02bb226d742c2f9be96d8
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 20 | ||||
-rw-r--r-- | include/formula/FormulaCompiler.hxx | 20 | ||||
-rw-r--r-- | sc/inc/compiler.hxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 20 |
4 files changed, 36 insertions, 36 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index c42ee0609f67..f65d0b324fb9 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -963,7 +963,7 @@ sal_uInt16 FormulaCompiler::GetErrorConstant( const OUString& rName ) const } -void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError ) +void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError ) const { OpCode eOp; switch (nError) @@ -1875,7 +1875,7 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuffer, F } -void FormulaCompiler::AppendDouble( OUStringBuffer& rBuffer, double fVal ) +void FormulaCompiler::AppendDouble( OUStringBuffer& rBuffer, double fVal ) const { if ( mxSymbols->isEnglish() ) { @@ -1894,12 +1894,12 @@ void FormulaCompiler::AppendDouble( OUStringBuffer& rBuffer, double fVal ) } } -void FormulaCompiler::AppendBoolean( OUStringBuffer& rBuffer, bool bVal ) +void FormulaCompiler::AppendBoolean( OUStringBuffer& rBuffer, bool bVal ) const { rBuffer.append( mxSymbols->getSymbol( static_cast<OpCode>(bVal ? ocTrue : ocFalse)) ); } -void FormulaCompiler::AppendString( OUStringBuffer& rBuffer, const OUString & rStr ) +void FormulaCompiler::AppendString( OUStringBuffer& rBuffer, const OUString & rStr ) const { rBuffer.append( '"'); if ( lcl_UnicodeStrChr( rStr.getStr(), '"' ) == NULL ) @@ -2074,27 +2074,27 @@ bool FormulaCompiler::HandleDbData() return true; } -void FormulaCompiler::CreateStringFromSingleRef( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) +void FormulaCompiler::CreateStringFromSingleRef( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) const { } -void FormulaCompiler::CreateStringFromDoubleRef( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) +void FormulaCompiler::CreateStringFromDoubleRef( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) const { } -void FormulaCompiler::CreateStringFromIndex( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) +void FormulaCompiler::CreateStringFromIndex( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) const { } -void FormulaCompiler::CreateStringFromMatrix( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) +void FormulaCompiler::CreateStringFromMatrix( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) const { } -void FormulaCompiler::CreateStringFromExternal( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) +void FormulaCompiler::CreateStringFromExternal( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) const { } -void FormulaCompiler::LocalizeString( OUString& /*rName*/ ) +void FormulaCompiler::LocalizeString( OUString& /*rName*/ ) const { } diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index ff2ebf35b9ad..e851fcfc521e 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -245,9 +245,9 @@ public: FormulaToken* CreateStringFromToken( OUStringBuffer& rBuffer, FormulaToken* pToken, bool bAllowArrAdvance = false ); - void AppendBoolean( OUStringBuffer& rBuffer, bool bVal ); - void AppendDouble( OUStringBuffer& rBuffer, double fVal ); - void AppendString( OUStringBuffer& rBuffer, const OUString & rStr ); + void AppendBoolean( OUStringBuffer& rBuffer, bool bVal ) const; + void AppendDouble( OUStringBuffer& rBuffer, double fVal ) const; + void AppendString( OUStringBuffer& rBuffer, const OUString & rStr ) const; /** Set symbol map corresponding to one of predefined formula::FormulaGrammar::Grammar, including an address reference convention. */ @@ -282,14 +282,14 @@ protected: virtual bool HandleSingleRef(); virtual bool HandleDbData(); - virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP); - virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void CreateStringFromMatrix(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void LocalizeString(OUString& rName ); // modify rName - input: exact name + virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP) const; + virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP) const; + virtual void CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP) const; + virtual void CreateStringFromMatrix(OUStringBuffer& rBuffer,FormulaToken* pTokenP) const; + virtual void CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* pTokenP) const; + virtual void LocalizeString( OUString& rName ) const; // modify rName - input: exact name - void AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError ); + void AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError ) const; bool GetToken(); OpCode NextToken(); diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 3b366c04d6b7..4cd31a3ab6b0 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -472,12 +472,12 @@ private: virtual bool HandleDbData(); virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef ); - virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, formula::FormulaToken* pTokenP); - virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP); - virtual void CreateStringFromDoubleRef(OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP); - virtual void CreateStringFromMatrix( OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP); - virtual void CreateStringFromIndex(OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP); - virtual void LocalizeString( OUString& rName ); // modify rName - input: exact name + virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, formula::FormulaToken* pTokenP) const; + virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP) const; + virtual void CreateStringFromDoubleRef(OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP) const; + virtual void CreateStringFromMatrix( OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP) const; + virtual void CreateStringFromIndex(OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP) const; + virtual void LocalizeString( OUString& rName ) const; // modify rName - input: exact name /// Access the CharTable flags inline sal_uLong GetCharTableFlags( sal_Unicode c, sal_Unicode cLast ) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index b297f66ac096..664145199586 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4122,7 +4122,7 @@ bool ScCompiler::IsCharFlagAllConventions( return false; } -void ScCompiler::CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP) +void ScCompiler::CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP) const { FormulaToken* t = pTokenP; ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); @@ -4150,8 +4150,8 @@ void ScCompiler::CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* } } -void ScCompiler::CreateStringFromMatrix( OUStringBuffer& rBuffer, - FormulaToken* pTokenP) +void ScCompiler::CreateStringFromMatrix( + OUStringBuffer& rBuffer, FormulaToken* pTokenP) const { const ScMatrix* pMatrix = static_cast<ScToken*>(pTokenP)->GetMatrix(); SCSIZE nC, nMaxC, nR, nMaxR; @@ -4195,10 +4195,10 @@ void ScCompiler::CreateStringFromMatrix( OUStringBuffer& rBuffer, rBuffer.append( mxSymbols->getSymbol(ocArrayClose) ); } -void ScCompiler::CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) +void ScCompiler::CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) const { const OpCode eOp = _pTokenP->GetOpCode(); - ScSingleRefData& rRef = static_cast<ScToken*>(_pTokenP)->GetSingleRef(); + const ScSingleRefData& rRef = static_cast<const ScToken*>(_pTokenP)->GetSingleRef(); ScComplexRefData aRef; aRef.Ref1 = aRef.Ref2 = rRef; if ( eOp == ocColRowName ) @@ -4220,12 +4220,12 @@ void ScCompiler::CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* pConv->MakeRefStr( rBuffer, *this, aRef, true ); } -void ScCompiler::CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) +void ScCompiler::CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) const { pConv->MakeRefStr( rBuffer, *this, static_cast<ScToken*>(_pTokenP)->GetDoubleRef(), false ); } -void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) +void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pTokenP) const { const OpCode eOp = _pTokenP->GetOpCode(); OUStringBuffer aBuffer; @@ -4233,14 +4233,14 @@ void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pT { case ocName: { - ScRangeData* pData = GetRangeData( *_pTokenP); + const ScRangeData* pData = GetRangeData( *_pTokenP); if (pData) aBuffer.append(pData->GetName()); } break; case ocDBArea: { - ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByIndex(_pTokenP->GetIndex()); + const ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByIndex(_pTokenP->GetIndex()); if (pDBData) aBuffer.append(pDBData->GetName()); } @@ -4254,7 +4254,7 @@ void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pT rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF)); } -void ScCompiler::LocalizeString( OUString& rName ) +void ScCompiler::LocalizeString( OUString& rName ) const { ScGlobal::GetAddInCollection()->LocalizeString( rName ); } |