From cdf176c9749ed1a0c2faceeae0c73bf735c5b00b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 23 Feb 2016 16:00:10 +0200 Subject: [PATCH] convert PropertyDescription::LocationType to scoped enum Change-Id: Ifcd6bf1728c632ed10301c4a426dae57dbf0912a --- .../property/propertycontainerhelper.cxx | 26 +++++++++---------- .../comphelper/propertycontainerhelper.hxx | 10 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index e0f0c4fd4086..9122ba0a7a74 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -83,7 +83,7 @@ void OPropertyContainerHelper::registerProperty(const OUString& _rName, sal_Int3 PropertyDescription aNewProp; aNewProp.aProperty = Property( _rName, _nHandle, _rMemberType, (sal_Int16)_nAttributes ); - aNewProp.eLocated = PropertyDescription::ltDerivedClassRealType; + aNewProp.eLocated = PropertyDescription::LocationType::DerivedClassRealType; aNewProp.aLocation.pDerivedClassMember = _pPointerToMember; implPushBackProperty(aNewProp); @@ -113,7 +113,7 @@ void OPropertyContainerHelper::registerMayBeVoidProperty(const OUString& _rName, PropertyDescription aNewProp; aNewProp.aProperty = Property( _rName, _nHandle, _rExpectedType, (sal_Int16)_nAttributes ); - aNewProp.eLocated = PropertyDescription::ltDerivedClassAnyType; + aNewProp.eLocated = PropertyDescription::LocationType::DerivedClassAnyType; aNewProp.aLocation.pDerivedClassMember = _pPointerToMember; implPushBackProperty(aNewProp); @@ -130,7 +130,7 @@ void OPropertyContainerHelper::registerPropertyNoMember(const OUString& _rName, PropertyDescription aNewProp; aNewProp.aProperty = Property( _rName, _nHandle, _rType, (sal_Int16)_nAttributes ); - aNewProp.eLocated = PropertyDescription::ltHoldMyself; + aNewProp.eLocated = PropertyDescription::LocationType::HoldMyself; aNewProp.aLocation.nOwnClassVectorIndex = m_aHoldProperties.size(); if (_pInitialValue) m_aHoldProperties.push_back(Any(_pInitialValue, _rType)); @@ -232,8 +232,8 @@ bool OPropertyContainerHelper::convertFastPropertyValue( switch (aPos->eLocated) { // similar handling for the two cases where the value is stored in an any - case PropertyDescription::ltHoldMyself: - case PropertyDescription::ltDerivedClassAnyType: + case PropertyDescription::LocationType::HoldMyself: + case PropertyDescription::LocationType::DerivedClassAnyType: { bool bMayBeVoid = ((aPos->aProperty.Attributes & PropertyAttribute::MAYBEVOID) != 0); @@ -275,7 +275,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue( // the pointer to the any which holds the property value, no matter if located in the derived class // or in out vector - if (PropertyDescription::ltHoldMyself == aPos->eLocated) + if (PropertyDescription::LocationType::HoldMyself == aPos->eLocated) { OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < (sal_Int32)m_aHoldProperties.size(), "OPropertyContainerHelper::convertFastPropertyValue: invalid position !"); @@ -303,7 +303,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue( } } break; - case PropertyDescription::ltDerivedClassRealType: + case PropertyDescription::LocationType::DerivedClassRealType: // let the UNO runtime library do any possible conversion // this may include a change of the type - for instance, if a LONG is required, // but a short is given, then this is valid, as it can be converted without any potential @@ -376,15 +376,15 @@ bool OPropertyContainerHelper::setFastPropertyValue(sal_Int32 _nHandle, const An switch (aPos->eLocated) { - case PropertyDescription::ltHoldMyself: + case PropertyDescription::LocationType::HoldMyself: m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex] = _rValue; break; - case PropertyDescription::ltDerivedClassAnyType: + case PropertyDescription::LocationType::DerivedClassAnyType: *static_cast< Any* >(aPos->aLocation.pDerivedClassMember) = _rValue; break; - case PropertyDescription::ltDerivedClassRealType: + case PropertyDescription::LocationType::DerivedClassRealType: // copy the data from the to-be-set value bSuccess = uno_type_assignData( aPos->aLocation.pDerivedClassMember, aPos->aProperty.Type.getTypeLibType(), @@ -416,15 +416,15 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa switch (aPos->eLocated) { - case PropertyDescription::ltHoldMyself: + case PropertyDescription::LocationType::HoldMyself: OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < (sal_Int32)m_aHoldProperties.size(), "OPropertyContainerHelper::convertFastPropertyValue: invalid position !"); _rValue = m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex]; break; - case PropertyDescription::ltDerivedClassAnyType: + case PropertyDescription::LocationType::DerivedClassAnyType: _rValue = *static_cast(aPos->aLocation.pDerivedClassMember); break; - case PropertyDescription::ltDerivedClassRealType: + case PropertyDescription::LocationType::DerivedClassRealType: _rValue.setValue(aPos->aLocation.pDerivedClassMember, aPos->aProperty.Type); break; } diff --git a/include/comphelper/propertycontainerhelper.hxx b/include/comphelper/propertycontainerhelper.hxx index 0fe37bbc0d51..39bdcbf9df56 100644 --- a/include/comphelper/propertycontainerhelper.hxx +++ b/include/comphelper/propertycontainerhelper.hxx @@ -35,11 +35,11 @@ namespace comphelper struct COMPHELPER_DLLPUBLIC PropertyDescription { // the possibilities where a property holding object may be located - enum LocationType + enum class LocationType { - ltDerivedClassRealType, // within the derived class, it's a "real" (non-Any) type - ltDerivedClassAnyType, // within the derived class, it's a com.sun.star.uno::Any - ltHoldMyself // within m_aHoldProperties + DerivedClassRealType, // within the derived class, it's a "real" (non-Any) type + DerivedClassAnyType, // within the derived class, it's a com.sun.star.uno::Any + HoldMyself // within m_aHoldProperties }; // the location of an object holding a property value : union LocationAccess @@ -54,7 +54,7 @@ struct COMPHELPER_DLLPUBLIC PropertyDescription PropertyDescription() :aProperty( OUString(), -1, css::uno::Type(), 0 ) - ,eLocated( ltHoldMyself ) + ,eLocated( LocationType::HoldMyself ) { aLocation.nOwnClassVectorIndex = -1; }