convert SbxDecimal::CmpResult to scoped enum

Change-Id: Id2d887c3ce4316a223497ef6790ca326983c4817
This commit is contained in:
Noel Grandin
2017-02-16 15:52:16 +02:00
parent 4ea27cf64f
commit dc21a49ea3
3 changed files with 9 additions and 8 deletions

View File

@@ -324,7 +324,7 @@ SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight
{ {
(void)rLeft; (void)rLeft;
(void)rRight; (void)rRight;
return (SbxDecimal::CmpResult)0; return SbxDecimal::CmpResult::LT;
} }
void SbxDecimal::setChar( sal_Unicode val ) { (void)val; } void SbxDecimal::setChar( sal_Unicode val ) { (void)val; }

View File

@@ -95,7 +95,8 @@ public:
bool isZero(); bool isZero();
enum CmpResult { LT, EQ, GT }; // must match the return values of the Microsoft VarDecCmp Automation function
enum class CmpResult { LT, EQ, GT };
friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight ); friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );
}; };

View File

@@ -1293,17 +1293,17 @@ bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
switch( eOp ) switch( eOp )
{ {
case SbxEQ: case SbxEQ:
bRes = ( eRes == SbxDecimal::EQ ); break; bRes = ( eRes == SbxDecimal::CmpResult::EQ ); break;
case SbxNE: case SbxNE:
bRes = ( eRes != SbxDecimal::EQ ); break; bRes = ( eRes != SbxDecimal::CmpResult::EQ ); break;
case SbxLT: case SbxLT:
bRes = ( eRes == SbxDecimal::LT ); break; bRes = ( eRes == SbxDecimal::CmpResult::LT ); break;
case SbxGT: case SbxGT:
bRes = ( eRes == SbxDecimal::GT ); break; bRes = ( eRes == SbxDecimal::CmpResult::GT ); break;
case SbxLE: case SbxLE:
bRes = ( eRes != SbxDecimal::GT ); break; bRes = ( eRes != SbxDecimal::CmpResult::GT ); break;
case SbxGE: case SbxGE:
bRes = ( eRes != SbxDecimal::LT ); break; bRes = ( eRes != SbxDecimal::CmpResult::LT ); break;
default: default:
SetError( ERRCODE_SBX_NOTIMP ); SetError( ERRCODE_SBX_NOTIMP );
} }