summaryrefslogtreecommitdiff
path: root/basic/source/sbx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-05-21 16:22:07 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-23 11:49:32 +0000
commitf107d453819fe06e1e8d46ffb3cc866f119d74fd (patch)
treec736accea43af430d2f7ba6233840060df1cad19 /basic/source/sbx
parent833088b18015381dc8f90e4e868f96b7e882334f (diff)
Convert SbxClassType to scoped enum
Change-Id: I48afcdd9924d22b52a8db21aa253061e4d38c85b Reviewed-on: https://gerrit.libreoffice.org/25259 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic/source/sbx')
-rw-r--r--basic/source/sbx/sbxarray.cxx18
-rw-r--r--basic/source/sbx/sbxbase.cxx2
-rw-r--r--basic/source/sbx/sbxcoll.cxx10
-rw-r--r--basic/source/sbx/sbxexec.cxx4
-rw-r--r--basic/source/sbx/sbxobj.cxx86
-rw-r--r--basic/source/sbx/sbxvalue.cxx2
-rw-r--r--basic/source/sbx/sbxvar.cxx6
7 files changed, 64 insertions, 64 deletions
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index d3b09ecccc9b..b1cce09ea3e6 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -69,7 +69,7 @@ SbxArray& SbxArray::operator=( const SbxArray& rArray )
if( eType != SbxVARIANT )
{
// Convert no objects
- if( eType != SbxOBJECT || pSrc_->GetClass() != SbxCLASS_OBJECT )
+ if( eType != SbxOBJECT || pSrc_->GetClass() != SbxClassType::Object )
{
pSrc_->Convert(eType);
}
@@ -92,7 +92,7 @@ SbxDataType SbxArray::GetType() const
SbxClassType SbxArray::GetClass() const
{
- return SbxCLASS_ARRAY;
+ return SbxClassType::Array;
}
void SbxArray::Clear()
@@ -185,7 +185,7 @@ void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx )
if( pVar )
if( eType != SbxVARIANT )
// Convert no objects
- if( eType != SbxOBJECT || pVar->GetClass() != SbxCLASS_OBJECT )
+ if( eType != SbxOBJECT || pVar->GetClass() != SbxClassType::Object )
pVar->Convert( eType );
SbxVariableRef& rRef = GetRef32( nIdx );
if( static_cast<SbxVariable*>(rRef) != pVar )
@@ -205,7 +205,7 @@ void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx )
if( pVar )
if( eType != SbxVARIANT )
// Convert no objects
- if( eType != SbxOBJECT || pVar->GetClass() != SbxCLASS_OBJECT )
+ if( eType != SbxOBJECT || pVar->GetClass() != SbxClassType::Object )
pVar->Convert( eType );
SbxVariableRef& rRef = GetRef( nIdx );
if( static_cast<SbxVariable*>(rRef) != pVar )
@@ -379,7 +379,7 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )
{
switch (rEntry.mpVar->GetClass())
{
- case SbxCLASS_OBJECT:
+ case SbxClassType::Object:
{
// Objects are not allowed to scan their parent.
SbxFlagBits nOld = rEntry.mpVar->GetFlags();
@@ -388,7 +388,7 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )
rEntry.mpVar->SetFlags(nOld);
}
break;
- case SbxCLASS_ARRAY:
+ case SbxClassType::Array:
// Casting SbxVariable to SbxArray? Really?
p = reinterpret_cast<SbxArray&>(*rEntry.mpVar).FindUserData(nData);
break;
@@ -424,7 +424,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t )
// The very secure search works as well, if there is no hashcode!
sal_uInt16 nVarHash = rEntry.mpVar->GetHashCode();
if ( (!nVarHash || nVarHash == nHash)
- && (t == SbxCLASS_DONTCARE || rEntry.mpVar->GetClass() == t)
+ && (t == SbxClassType::DontCare || rEntry.mpVar->GetClass() == t)
&& (rEntry.mpVar->GetName().equalsIgnoreAsciiCase(rName)))
{
p = &rEntry.mpVar;
@@ -437,7 +437,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t )
{
switch (rEntry.mpVar->GetClass())
{
- case SbxCLASS_OBJECT:
+ case SbxClassType::Object:
{
// Objects are not allowed to scan their parent.
SbxFlagBits nOld = rEntry.mpVar->GetFlags();
@@ -446,7 +446,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t )
rEntry.mpVar->SetFlags(nOld);
}
break;
- case SbxCLASS_ARRAY:
+ case SbxClassType::Array:
// Casting SbxVariable to SbxArray? Really?
p = reinterpret_cast<SbxArray&>(*rEntry.mpVar).Find(rName, t);
break;
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index cc26051c7125..87696f8528bc 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -75,7 +75,7 @@ SbxDataType SbxBase::GetType() const
SbxClassType SbxBase::GetClass() const
{
- return SbxCLASS_DONTCARE;
+ return SbxClassType::DontCare;
}
void SbxBase::Clear()
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index 58d7dec9a8a8..0f4e3125a003 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -75,14 +75,14 @@ void SbxCollection::Initialize()
SetFlag( SbxFlagBits::Fixed );
ResetFlag( SbxFlagBits::Write );
SbxVariable* p;
- p = Make( pCount , SbxCLASS_PROPERTY, SbxINTEGER );
+ p = Make( pCount , SbxClassType::Property, SbxINTEGER );
p->ResetFlag( SbxFlagBits::Write );
p->SetFlag( SbxFlagBits::DontStore );
- p = Make( pAdd, SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( pAdd, SbxClassType::Method, SbxEMPTY );
p->SetFlag( SbxFlagBits::DontStore );
- p = Make( pItem , SbxCLASS_METHOD, SbxOBJECT );
+ p = Make( pItem , SbxClassType::Method, SbxOBJECT );
p->SetFlag( SbxFlagBits::DontStore );
- p = Make( pRemove, SbxCLASS_METHOD, SbxEMPTY );
+ p = Make( pRemove, SbxClassType::Method, SbxEMPTY );
p->SetFlag( SbxFlagBits::DontStore );
}
@@ -195,7 +195,7 @@ void SbxCollection::CollItem( SbxArray* pPar_ )
SbxVariable* p = pPar_->Get( 1 );
if( p->GetType() == SbxSTRING )
{
- pRes = Find( p->GetOUString(), SbxCLASS_OBJECT );
+ pRes = Find( p->GetOUString(), SbxClassType::Object );
}
else
{
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 99f4d9cbb4ca..2cd35bea412e 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -162,7 +162,7 @@ static SbxVariableRef Operand
}
else
{
- refVar = QualifiedName( pObj, pGbl, &p, SbxCLASS_DONTCARE );
+ refVar = QualifiedName( pObj, pGbl, &p, SbxClassType::DontCare );
}
*ppBuf = p;
return refVar;
@@ -241,7 +241,7 @@ static SbxVariableRef Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicod
if( *p == '=' )
{
// Assign only onto properties!
- if( refVar->GetClass() != SbxCLASS_PROPERTY )
+ if( refVar->GetClass() != SbxClassType::Property )
{
SbxBase::SetError( ERRCODE_SBX_BAD_ACTION );
refVar.Clear();
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index ce7f866058e6..12b09277dec6 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -113,7 +113,7 @@ SbxDataType SbxObject::GetType() const
SbxClassType SbxObject::GetClass() const
{
- return SbxCLASS_OBJECT;
+ return SbxClassType::Object;
}
void SbxObject::Clear()
@@ -122,9 +122,9 @@ void SbxObject::Clear()
pProps = new SbxArray;
pObjs = new SbxArray( SbxOBJECT );
SbxVariable* p;
- p = Make( pNameProp, SbxCLASS_PROPERTY, SbxSTRING );
+ p = Make( pNameProp, SbxClassType::Property, SbxSTRING );
p->SetFlag( SbxFlagBits::DontStore );
- p = Make( pParentProp, SbxCLASS_PROPERTY, SbxOBJECT );
+ p = Make( pParentProp, SbxClassType::Property, SbxOBJECT );
p->ResetFlag( SbxFlagBits::Write );
p->SetFlag( SbxFlagBits::DontStore );
pDfltProp = nullptr;
@@ -213,20 +213,20 @@ SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t )
SAL_INFO(
"basic.sbx",
"search" << std::setw(nLvl) << " "
- << (t >= SbxCLASS_DONTCARE && t <= SbxCLASS_OBJECT
- ? pCls[t - 1] : "Unknown class")
+ << (t >= SbxClassType::DontCare && t <= SbxClassType::Object
+ ? pCls[(int)t - 1] : "Unknown class")
<< " " << rName << " in " << SbxVariable::GetName());
++nLvl;
#endif
SbxVariable* pRes = nullptr;
pObjs->SetFlag( SbxFlagBits::ExtSearch );
- if( t == SbxCLASS_DONTCARE )
+ if( t == SbxClassType::DontCare )
{
- pRes = pMethods->Find( rName, SbxCLASS_METHOD );
+ pRes = pMethods->Find( rName, SbxClassType::Method );
if( !pRes )
{
- pRes = pProps->Find( rName, SbxCLASS_PROPERTY );
+ pRes = pProps->Find( rName, SbxClassType::Property );
}
if( !pRes )
{
@@ -238,10 +238,10 @@ SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t )
SbxArray* pArray = nullptr;
switch( t )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
+ case SbxClassType::Variable:
+ case SbxClassType::Property: pArray = pProps; break;
+ case SbxClassType::Method: pArray = pMethods; break;
+ case SbxClassType::Object: pArray = pObjs; break;
default: DBG_ASSERT( false, "Invalid SBX-Class" ); break;
}
if( pArray )
@@ -251,7 +251,7 @@ SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t )
}
// Extended Search in the Object-Array?
// For objects and DontCare the array of objects has already been searched
- if( !pRes && ( t == SbxCLASS_METHOD || t == SbxCLASS_PROPERTY ) )
+ if( !pRes && ( t == SbxClassType::Method || t == SbxClassType::Property ) )
pRes = pObjs->Find( rName, t );
// Search in the parents?
if( !pRes && IsSet( SbxFlagBits::GlobalSearch ) )
@@ -287,7 +287,7 @@ SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t )
bool SbxObject::Call( const OUString& rName, SbxArray* pParam )
{
- SbxVariable* pMeth = FindQualified( rName, SbxCLASS_DONTCARE);
+ SbxVariable* pMeth = FindQualified( rName, SbxClassType::DontCare);
if( pMeth && nullptr != dynamic_cast<const SbxMethod*>( pMeth) )
{
// FindQualified() might have struck already!
@@ -307,10 +307,10 @@ SbxProperty* SbxObject::GetDfltProperty()
{
if ( !pDfltProp && !aDfltPropName.isEmpty() )
{
- pDfltProp = static_cast<SbxProperty*>( Find( aDfltPropName, SbxCLASS_PROPERTY ) );
+ pDfltProp = static_cast<SbxProperty*>( Find( aDfltPropName, SbxClassType::Property ) );
if( !pDfltProp )
{
- pDfltProp = static_cast<SbxProperty*>( Make( aDfltPropName, SbxCLASS_PROPERTY, SbxVARIANT ) );
+ pDfltProp = static_cast<SbxProperty*>( Make( aDfltPropName, SbxClassType::Property, SbxVARIANT ) );
}
}
return pDfltProp;
@@ -334,10 +334,10 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
SbxArray* pArray = nullptr;
if( pVar ) switch( pVar->GetClass() )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
+ case SbxClassType::Variable:
+ case SbxClassType::Property: pArray = pProps; break;
+ case SbxClassType::Method: pArray = pMethods; break;
+ case SbxClassType::Object: pArray = pObjs; break;
default: DBG_ASSERT( false, "Invalid SBX-Class" ); break;
}
if( pArray )
@@ -370,10 +370,10 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp
SbxArray* pArray = nullptr;
switch( ct )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
+ case SbxClassType::Variable:
+ case SbxClassType::Property: pArray = pProps; break;
+ case SbxClassType::Method: pArray = pMethods; break;
+ case SbxClassType::Object: pArray = pObjs; break;
default: DBG_ASSERT( false, "Invalid SBX-Class" ); break;
}
if( !pArray )
@@ -381,7 +381,7 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp
return nullptr;
}
// Collections may contain objects of the same name
- if( !( ct == SbxCLASS_OBJECT && nullptr != dynamic_cast<const SbxCollection*>( this ) ) )
+ if( !( ct == SbxClassType::Object && nullptr != dynamic_cast<const SbxCollection*>( this ) ) )
{
SbxVariable* pRes = pArray->Find( rName, ct );
if( pRes )
@@ -392,14 +392,14 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp
SbxVariable* pVar = nullptr;
switch( ct )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY:
+ case SbxClassType::Variable:
+ case SbxClassType::Property:
pVar = new SbxProperty( rName, dt );
break;
- case SbxCLASS_METHOD:
+ case SbxClassType::Method:
pVar = new SbxMethod( rName, dt, bIsRuntimeFunction );
break;
- case SbxCLASS_OBJECT:
+ case SbxClassType::Object:
pVar = CreateObject( rName );
break;
default:
@@ -438,7 +438,7 @@ void SbxObject::Insert( SbxVariable* pVar )
return;
}
EndListening( pOld->GetBroadcaster(), true );
- if( pVar->GetClass() == SbxCLASS_PROPERTY )
+ if( pVar->GetClass() == SbxClassType::Property )
{
if( pOld == pDfltProp )
{
@@ -466,9 +466,9 @@ void SbxObject::Insert( SbxVariable* pVar )
SAL_INFO(
"basic.sbx",
"insert "
- << ((pVar->GetClass() >= SbxCLASS_DONTCARE
- && pVar->GetClass() <= SbxCLASS_OBJECT)
- ? pCls[pVar->GetClass() - 1] : "Unknown class")
+ << ((pVar->GetClass() >= SbxClassType::DontCare
+ && pVar->GetClass() <= SbxClassType::Object)
+ ? pCls[(int)pVar->GetClass() - 1] : "Unknown class")
<< " " << aVarName << " in " << SbxVariable::GetName());
#endif
}
@@ -483,10 +483,10 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
{
switch( pVar->GetClass() )
{
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
+ case SbxClassType::Variable:
+ case SbxClassType::Property: pArray = pProps; break;
+ case SbxClassType::Method: pArray = pMethods; break;
+ case SbxClassType::Object: pArray = pObjs; break;
default: DBG_ASSERT( false, "Invalid SBX-Class" ); break;
}
}
@@ -510,9 +510,9 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
SAL_INFO(
"basic.sbx",
"insert "
- << ((pVar->GetClass() >= SbxCLASS_DONTCARE
- && pVar->GetClass() <= SbxCLASS_OBJECT)
- ? pCls[pVar->GetClass() - 1] : "Unknown class")
+ << ((pVar->GetClass() >= SbxClassType::DontCare
+ && pVar->GetClass() <= SbxClassType::Object)
+ ? pCls[(int)pVar->GetClass() - 1] : "Unknown class")
<< " " << aVarName << " in " << SbxVariable::GetName());
#endif
}
@@ -621,7 +621,7 @@ bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer )
// Set properties
if( !aDfltProp.isEmpty() )
{
- pDfltProp = static_cast<SbxProperty*>( pProps->Find( aDfltProp, SbxCLASS_PROPERTY ) );
+ pDfltProp = static_cast<SbxProperty*>( pProps->Find( aDfltProp, SbxClassType::Property ) );
}
SetModified( false );
return true;
@@ -881,7 +881,7 @@ SbxMethod::~SbxMethod()
SbxClassType SbxMethod::GetClass() const
{
- return SbxCLASS_METHOD;
+ return SbxClassType::Method;
}
SbxProperty::SbxProperty( const OUString& r, SbxDataType t )
@@ -896,7 +896,7 @@ SbxProperty::~SbxProperty()
SbxClassType SbxProperty::GetClass() const
{
- return SbxCLASS_PROPERTY;
+ return SbxClassType::Property;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index c58e0b910ca2..7bf87723a353 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -754,7 +754,7 @@ bool SbxValue::ImpIsNumeric( bool bOnlyIntntl ) const
SbxClassType SbxValue::GetClass() const
{
- return SbxCLASS_VALUE;
+ return SbxClassType::Value;
}
SbxDataType SbxValue::GetType() const
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index bc5c8f2668f9..18d50540478a 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -227,7 +227,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
// Request parameter-information (not for objects)
const_cast<SbxVariable*>(this)->GetInfo();
// Append nothing, if it is a simple property (no empty brackets)
- if (!pInfo || (pInfo->m_Params.empty() && GetClass() == SbxCLASS_PROPERTY))
+ if (!pInfo || (pInfo->m_Params.empty() && GetClass() == SbxClassType::Property))
{
return maName;
}
@@ -387,7 +387,7 @@ SbxDataType SbxVariable::GetType() const
SbxClassType SbxVariable::GetClass() const
{
- return SbxCLASS_VARIABLE;
+ return SbxClassType::Variable;
}
void SbxVariable::SetModified( bool b )
@@ -497,7 +497,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
rStrm.ReadUInt32( nTemp );
nUserData = nTemp;
// correction: old methods have instead of SbxNULL now SbxEMPTY
- if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD )
+ if( nType == SbxNULL && GetClass() == SbxClassType::Method )
{
nType = SbxEMPTY;
}