summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-30 15:45:27 +0200
committerNoel Grandin <noel@peralex.com>2015-05-06 09:01:26 +0200
commit96471119f0157d85c1fb33b114919a94272744c6 (patch)
tree95efb613abd8d4653e271e230489d328891364b6
parentb35828ba7dc33af81d17c8c870ec981d18a57b08 (diff)
convert CVC_ flags to scoped enum
Change-Id: Iadc9b6240121e9fee91de299b94a9f8629656507
-rw-r--r--include/unotools/configvaluecontainer.hxx26
-rw-r--r--svx/source/form/fmsrccfg.cxx2
-rw-r--r--unotools/source/config/configvaluecontainer.cxx8
3 files changed, 22 insertions, 14 deletions
diff --git a/include/unotools/configvaluecontainer.hxx b/include/unotools/configvaluecontainer.hxx
index 7ec278cd8d26..1da4e77e3f8b 100644
--- a/include/unotools/configvaluecontainer.hxx
+++ b/include/unotools/configvaluecontainer.hxx
@@ -16,20 +16,28 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <unotools/unotoolsdllapi.h>
-
#ifndef INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX
#define INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX
+
+#include <unotools/unotoolsdllapi.h>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <osl/mutex.hxx>
+#include <o3tl/typed_flags_set.hxx>
-namespace utl
-{
-#define CVC_UPDATE_ACCESS 0x0001
+enum class CVCFlags
+{
+ LAZY_UPDATE = 0x0000,
+ UPDATE_ACCESS = 0x0001,
+ IMMEDIATE_UPDATE = 0x0002,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<CVCFlags> : is_typed_flags<CVCFlags, 0x03> {};
+}
-#define CVC_LAZY_UPDATE 0x0000
-#define CVC_IMMEDIATE_UPDATE 0x0002
+namespace utl
+{
struct OConfigurationValueContainerImpl;
struct NodeValueAccessor;
@@ -84,7 +92,7 @@ namespace utl
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB,
::osl::Mutex& _rAccessSafety,
const sal_Char* _pConfigLocation,
- const sal_uInt16 _nAccessFlags = CVC_UPDATE_ACCESS | CVC_LAZY_UPDATE,
+ const CVCFlags _nAccessFlags = CVCFlags::UPDATE_ACCESS | CVCFlags::LAZY_UPDATE,
const sal_Int32 _nLevels = -1
);
@@ -162,7 +170,7 @@ namespace utl
/// implements the ctors
void implConstruct(
const OUString& _rConfigLocation,
- const sal_uInt16 _nAccessFlags,
+ const CVCFlags _nAccessFlags,
const sal_Int32 _nLevels
);
diff --git a/svx/source/form/fmsrccfg.cxx b/svx/source/form/fmsrccfg.cxx
index 5c5288d5ba26..f644f2d6fce9 100644
--- a/svx/source/form/fmsrccfg.cxx
+++ b/svx/source/form/fmsrccfg.cxx
@@ -150,7 +150,7 @@ namespace svxform
#define TA( c ) &c, cppu::UnoType<decltype(c)>::get()
FmSearchConfigItem::FmSearchConfigItem()
- :OConfigurationValueContainer( ::comphelper::getProcessComponentContext(), m_aMutex, "/org.openoffice.Office.DataAccess/FormSearchOptions", CVC_UPDATE_ACCESS | CVC_LAZY_UPDATE, 2 )
+ :OConfigurationValueContainer( ::comphelper::getProcessComponentContext(), m_aMutex, "/org.openoffice.Office.DataAccess/FormSearchOptions", CVCFlags::UPDATE_ACCESS | CVCFlags::LAZY_UPDATE, 2 )
{
// register our members so the data exchange with the node values is done automatically
diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index ff046cd37e90..7121e066033a 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -212,7 +212,7 @@ namespace utl
OConfigurationValueContainer::OConfigurationValueContainer(
const Reference< XComponentContext >& _rxORB, ::osl::Mutex& _rAccessSafety,
- const sal_Char* _pConfigLocation, const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels )
+ const sal_Char* _pConfigLocation, const CVCFlags _nAccessFlags, const sal_Int32 _nLevels )
:m_pImpl( new OConfigurationValueContainerImpl( _rxORB, _rAccessSafety ) )
{
implConstruct( OUString::createFromAscii( _pConfigLocation ), _nAccessFlags, _nLevels );
@@ -224,7 +224,7 @@ namespace utl
}
void OConfigurationValueContainer::implConstruct( const OUString& _rConfigLocation,
- const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels )
+ const CVCFlags _nAccessFlags, const sal_Int32 _nLevels )
{
SAL_WARN_IF(m_pImpl->aConfigRoot.isValid(), "unotools.config", "OConfigurationValueContainer::implConstruct: already initialized!");
@@ -233,8 +233,8 @@ namespace utl
m_pImpl->xORB,
_rConfigLocation,
_nLevels,
- ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
- ( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) == 0
+ ( _nAccessFlags & CVCFlags::UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
+ !bool( _nAccessFlags & CVCFlags::IMMEDIATE_UPDATE )
);
SAL_WARN_IF(!m_pImpl->aConfigRoot.isValid(), "unotools.config",
"Could not access the configuration node located at " << _rConfigLocation);