summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-09 13:52:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-10 08:08:45 +0200
commit48d3f2505e0dfbd487a1041747f16f761e9c455e (patch)
treefd964bc4a3a418546056b6c1db44195c7e07e33d /unotools
parentf4a9ba4b484480ddacc62a47f68b02e449d72880 (diff)
convert LocationType to scoped enum
and drop unused ltAnyInstance enumerator Change-Id: Ic471470973542ebcd3c9d0123870e70b3de6b8bb
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/configvaluecontainer.cxx28
1 files changed, 9 insertions, 19 deletions
diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index 312751089213..60d0cfe081ea 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -34,18 +34,16 @@ namespace utl
//= NodeValueAccessor
- enum LocationType
+ enum class LocationType
{
- ltSimplyObjectInstance,
- ltAnyInstance,
-
- ltUnbound
+ SimplyObjectInstance,
+ Unbound
};
struct NodeValueAccessor
{
private:
- OUString sRelativePath; // the relative path of the node
+ OUString sRelativePath; // the relative path of the node
LocationType eLocationType; // the type of location where the value is stored
void* pLocation; // the pointer to the location
Type aDataType; // the type object pointed to by pLocation
@@ -55,7 +53,7 @@ namespace utl
void bind( void* _pLocation, const Type& _rType );
- bool isBound( ) const { return ( ltUnbound != eLocationType ) && ( nullptr != pLocation ); }
+ bool isBound( ) const { return ( LocationType::Unbound != eLocationType ) && ( nullptr != pLocation ); }
const OUString& getPath( ) const { return sRelativePath; }
LocationType getLocType( ) const { return eLocationType; }
void* getLocation( ) const { return pLocation; }
@@ -66,7 +64,7 @@ namespace utl
NodeValueAccessor::NodeValueAccessor( const OUString& _rNodePath )
:sRelativePath( _rNodePath )
- ,eLocationType( ltUnbound )
+ ,eLocationType( LocationType::Unbound )
,pLocation( nullptr )
{
}
@@ -82,7 +80,7 @@ namespace utl
{
SAL_WARN_IF(isBound(), "unotools.config", "NodeValueAccessor::bind: already bound!");
- eLocationType = ltSimplyObjectInstance;
+ eLocationType = LocationType::SimplyObjectInstance;
pLocation = _pLocation;
aDataType = _rType;
}
@@ -97,7 +95,7 @@ namespace utl
SAL_WARN_IF(!_rAccessor.isBound(), "unotools.config", "::utl::lcl_copyData: invalid accessor!");
switch ( _rAccessor.getLocType() )
{
- case ltSimplyObjectInstance:
+ case LocationType::SimplyObjectInstance:
{
if ( _rData.hasValue() )
{
@@ -115,10 +113,6 @@ namespace utl
}
}
break;
- case ltAnyInstance:
- // a simple assignment of an Any ...
- *static_cast< Any* >( _rAccessor.getLocation() ) = _rData;
- break;
default:
break;
}
@@ -134,15 +128,11 @@ namespace utl
SAL_WARN_IF(!_rAccessor.isBound(), "unotools.config", "::utl::lcl_copyData: invalid accessor!" );
switch ( _rAccessor.getLocType() )
{
- case ltSimplyObjectInstance:
+ case LocationType::SimplyObjectInstance:
// a simple setValue ....
_rData.setValue( _rAccessor.getLocation(), _rAccessor.getDataType() );
break;
- case ltAnyInstance:
- // a simple assignment of an Any ...
- _rData = *static_cast< Any* >( _rAccessor.getLocation() );
- break;
default:
break;
}