diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-10-22 15:56:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-10-23 09:30:08 +0200 |
commit | 7281580ef0cdfa1ba0858f1f918a6735108d124f (patch) | |
tree | f8c1511961df69a8b55a96e88264efa9745c61ca | |
parent | 6a7649f6a7e37d7427254cd34042e480c3a0e6f7 (diff) |
Turn virtual ScToken::Dump into a single free function DumpToken
Change-Id: I2c81f24a27ede9922ed8ff16cf0ea4af824e9e59
-rw-r--r-- | sc/inc/token.hxx | 10 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 36 |
2 files changed, 18 insertions, 28 deletions
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index 300183319ac7..54c5dc7f1427 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -89,11 +89,11 @@ public: virtual ScJumpMatrix* GetJumpMatrix() const; virtual const ScRefList* GetRefList() const; virtual ScRefList* GetRefList(); +}; #if DEBUG_FORMULA_COMPILER - virtual void Dump() const; +void DumpToken(ScToken const & rToken); #endif -}; /** If rTok1 and rTok2 both are SingleRef or DoubleRef tokens, extend/merge ranges as needed for ocRange. @@ -134,9 +134,6 @@ public: virtual bool operator==( const formula::FormulaToken& rToken ) const SAL_OVERRIDE; virtual FormulaToken* Clone() const SAL_OVERRIDE { return new ScSingleRefToken(*this); } -#if DEBUG_FORMULA_COMPILER - virtual void Dump() const SAL_OVERRIDE; -#endif DECL_FIXEDMEMPOOL_NEWDEL( ScSingleRefToken ); }; @@ -165,9 +162,6 @@ public: virtual bool operator==( const formula::FormulaToken& rToken ) const SAL_OVERRIDE; virtual FormulaToken* Clone() const SAL_OVERRIDE { return new ScDoubleRefToken(*this); } -#if DEBUG_FORMULA_COMPILER - virtual void Dump() const SAL_OVERRIDE; -#endif DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRefToken ); }; diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index dba75fb7e96a..7673b09249cd 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -507,9 +507,21 @@ bool ScToken::checkTextEqual( const FormulaToken& _rToken ) const } #if DEBUG_FORMULA_COMPILER -void ScToken::Dump() const +void DumpToken(ScToken const & rToken) { - cout << "-- ScToken (base class)" << endl; + switch (rToken.GetType()) { + case svSingleRef: + cout << "-- ScSingleRefToken" << endl; + rToken.GetSingleRef().Dump(1); + break; + case svDoubleRef: + cout << "-- ScDoubleRefToken" << endl; + rToken.GetDoubleRef().Dump(1); + break; + default: + cout << "-- ScToken (base class)" << endl; + break; + } } #endif @@ -724,14 +736,6 @@ bool ScSingleRefToken::operator==( const FormulaToken& r ) const return FormulaToken::operator==( r ) && aSingleRef == static_cast<const ScToken&>(r).GetSingleRef(); } -#if DEBUG_FORMULA_COMPILER -void ScSingleRefToken::Dump() const -{ - cout << "-- ScSingleRefToken" << endl; - aSingleRef.Dump(1); -} -#endif - const ScSingleRefData& ScDoubleRefToken::GetSingleRef() const { return aDoubleRef.Ref1; } ScSingleRefData& ScDoubleRefToken::GetSingleRef() { return aDoubleRef.Ref1; } const ScComplexRefData& ScDoubleRefToken::GetDoubleRef() const { return aDoubleRef; } @@ -747,14 +751,6 @@ bool ScDoubleRefToken::operator==( const FormulaToken& r ) const return FormulaToken::operator==( r ) && aDoubleRef == static_cast<const ScToken&>(r).GetDoubleRef(); } -#if DEBUG_FORMULA_COMPILER -void ScDoubleRefToken::Dump() const -{ - cout << "-- ScDoubleRefToken" << endl; - aDoubleRef.Dump(1); -} -#endif - const ScRefList* ScRefListToken::GetRefList() const { return &aRefList; } ScRefList* ScRefListToken::GetRefList() { return &aRefList; } bool ScRefListToken::operator==( const FormulaToken& r ) const @@ -4091,7 +4087,7 @@ void ScTokenArray::Dump() const continue; } - p->Dump(); + DumpToken(*p); } cout << "+++ RPN Tokens +++" << endl; @@ -4105,7 +4101,7 @@ void ScTokenArray::Dump() const continue; } - p->Dump(); + DumpToken(*p); } } #endif |