diff options
author | Eike Rathke <erack@redhat.com> | 2017-05-09 23:30:39 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-10 00:39:58 +0200 |
commit | 1cf44947161d8fff6e3edb3f7a1dd01c81963b42 (patch) | |
tree | f3b42e42f4d6a4b11e022cc57b0f775f5a607973 /formula | |
parent | 47023116d6bf89bb2e0b8b5293272f63db32fbc2 (diff) |
Hold ParamClass at FormulaByteToken instead of bool, tdf#107724 prep
* change IsInForceArray() to GetInForceArray()
* add IsInForceArray() to keep previous functionality
Change-Id: I64c891486e548a66539646846a4691a213c783ac
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 10 | ||||
-rw-r--r-- | formula/source/core/api/token.cxx | 30 |
2 files changed, 23 insertions, 17 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 039b41a0d3ea..60ad7927c327 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -2552,18 +2552,18 @@ void FormulaCompiler::ForceArrayOperator( FormulaTokenRef& rCurr ) if (!(rCurr->GetOpCode() != ocPush && (rCurr->GetType() == svByte || rCurr->GetType() == svJump))) return; - if (pCurrentFactorToken->IsInForceArray()) + formula::ParamClass eType = pCurrentFactorToken->GetInForceArray(); + if (eType == formula::ParamClass::ForceArray || eType == formula::ParamClass::ReferenceOrForceArray) { - rCurr->SetInForceArray( true); + rCurr->SetInForceArray( eType); return; } if (nCurrentFactorParam > 0) { - formula::ParamClass eType = GetForceArrayParameter( pCurrentFactorToken.get(), - static_cast<sal_uInt8>(nCurrentFactorParam - 1)); + eType = GetForceArrayParameter( pCurrentFactorToken.get(), static_cast<sal_uInt8>(nCurrentFactorParam - 1)); if (eType == ParamClass::ForceArray || eType == ParamClass::ReferenceOrForceArray) - rCurr->SetInForceArray( true); + rCurr->SetInForceArray( eType); } } diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 2ecec86c1b2e..cc5a93573fe5 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -158,6 +158,12 @@ bool FormulaToken::IsRef() const return false; } +bool FormulaToken::IsInForceArray() const +{ + ParamClass eParam = GetInForceArray(); + return eParam == ParamClass::ForceArray || eParam == ParamClass::ReferenceOrForceArray; +} + bool FormulaToken::operator==( const FormulaToken& rToken ) const { // don't compare reference count! @@ -178,13 +184,13 @@ void FormulaToken::SetByte( sal_uInt8 ) SAL_WARN( "formula.core", "FormulaToken::SetByte: virtual dummy called" ); } -bool FormulaToken::IsInForceArray() const +ParamClass FormulaToken::GetInForceArray() const { // ok to be called for any derived class - return false; + return ParamClass::Unknown; } -void FormulaToken::SetInForceArray( bool ) +void FormulaToken::SetInForceArray( ParamClass ) { SAL_WARN( "formula.core", "FormulaToken::SetInForceArray: virtual dummy called" ); } @@ -348,12 +354,12 @@ bool FormulaToken::TextEqual( const FormulaToken& rToken ) const sal_uInt8 FormulaByteToken::GetByte() const { return nByte; } void FormulaByteToken::SetByte( sal_uInt8 n ) { nByte = n; } -bool FormulaByteToken::IsInForceArray() const { return bIsInForceArray; } -void FormulaByteToken::SetInForceArray( bool b ) { bIsInForceArray = b; } +ParamClass FormulaByteToken::GetInForceArray() const { return eInForceArray; } +void FormulaByteToken::SetInForceArray( ParamClass c ) { eInForceArray = c; } bool FormulaByteToken::operator==( const FormulaToken& r ) const { return FormulaToken::operator==( r ) && nByte == r.GetByte() && - bIsInForceArray == r.IsInForceArray(); + eInForceArray == r.GetInForceArray(); } @@ -364,14 +370,14 @@ bool FormulaFAPToken::operator==( const FormulaToken& r ) const } -short* FormulaJumpToken::GetJump() const { return pJump.get(); } -bool FormulaJumpToken::IsInForceArray() const { return bIsInForceArray; } -void FormulaJumpToken::SetInForceArray( bool b ) { bIsInForceArray = b; } +short* FormulaJumpToken::GetJump() const { return pJump.get(); } +ParamClass FormulaJumpToken::GetInForceArray() const { return eInForceArray; } +void FormulaJumpToken::SetInForceArray( ParamClass c ) { eInForceArray = c; } bool FormulaJumpToken::operator==( const FormulaToken& r ) const { return FormulaToken::operator==( r ) && pJump[0] == r.GetJump()[0] && memcmp( pJump.get()+1, r.GetJump()+1, pJump[0] * sizeof(short) ) == 0 && - bIsInForceArray == r.IsInForceArray(); + eInForceArray == r.GetInForceArray(); } FormulaJumpToken::~FormulaJumpToken() { @@ -1620,7 +1626,7 @@ FormulaToken* FormulaTokenArray::AddOpCode( OpCode eOp ) } break; default: - pRet = new FormulaByteToken( eOp, 0, false ); + pRet = new FormulaByteToken( eOp, 0, ParamClass::Unknown ); break; } return Add( pRet ); @@ -1797,7 +1803,7 @@ bool FormulaStringToken::operator==( const FormulaToken& r ) const } FormulaStringOpToken::FormulaStringOpToken( OpCode e, const svl::SharedString& r ) : - FormulaByteToken( e, 0, svString, false ), maString( r ) {} + FormulaByteToken( e, 0, svString, ParamClass::Unknown ), maString( r ) {} FormulaStringOpToken::FormulaStringOpToken( const FormulaStringOpToken& r ) : FormulaByteToken( r ), maString( r.maString ) {} |