Kaydet (Commit) 96471119 authored tarafından Noel Grandin's avatar Noel Grandin

convert CVC_ flags to scoped enum

Change-Id: Iadc9b6240121e9fee91de299b94a9f8629656507
üst b35828ba
...@@ -16,20 +16,28 @@ ...@@ -16,20 +16,28 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <unotools/unotoolsdllapi.h>
#ifndef INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX #ifndef INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX
#define INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX #define INCLUDED_UNOTOOLS_CONFIGVALUECONTAINER_HXX
#include <unotools/unotoolsdllapi.h>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <osl/mutex.hxx> #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 namespace utl
#define CVC_IMMEDIATE_UPDATE 0x0002 {
struct OConfigurationValueContainerImpl; struct OConfigurationValueContainerImpl;
struct NodeValueAccessor; struct NodeValueAccessor;
...@@ -84,7 +92,7 @@ namespace utl ...@@ -84,7 +92,7 @@ namespace utl
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB,
::osl::Mutex& _rAccessSafety, ::osl::Mutex& _rAccessSafety,
const sal_Char* _pConfigLocation, 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 const sal_Int32 _nLevels = -1
); );
...@@ -162,7 +170,7 @@ namespace utl ...@@ -162,7 +170,7 @@ namespace utl
/// implements the ctors /// implements the ctors
void implConstruct( void implConstruct(
const OUString& _rConfigLocation, const OUString& _rConfigLocation,
const sal_uInt16 _nAccessFlags, const CVCFlags _nAccessFlags,
const sal_Int32 _nLevels const sal_Int32 _nLevels
); );
......
...@@ -150,7 +150,7 @@ namespace svxform ...@@ -150,7 +150,7 @@ namespace svxform
#define TA( c ) &c, cppu::UnoType<decltype(c)>::get() #define TA( c ) &c, cppu::UnoType<decltype(c)>::get()
FmSearchConfigItem::FmSearchConfigItem() 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 // register our members so the data exchange with the node values is done automatically
......
...@@ -212,7 +212,7 @@ namespace utl ...@@ -212,7 +212,7 @@ namespace utl
OConfigurationValueContainer::OConfigurationValueContainer( OConfigurationValueContainer::OConfigurationValueContainer(
const Reference< XComponentContext >& _rxORB, ::osl::Mutex& _rAccessSafety, 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 ) ) :m_pImpl( new OConfigurationValueContainerImpl( _rxORB, _rAccessSafety ) )
{ {
implConstruct( OUString::createFromAscii( _pConfigLocation ), _nAccessFlags, _nLevels ); implConstruct( OUString::createFromAscii( _pConfigLocation ), _nAccessFlags, _nLevels );
...@@ -224,7 +224,7 @@ namespace utl ...@@ -224,7 +224,7 @@ namespace utl
} }
void OConfigurationValueContainer::implConstruct( const OUString& _rConfigLocation, 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!"); SAL_WARN_IF(m_pImpl->aConfigRoot.isValid(), "unotools.config", "OConfigurationValueContainer::implConstruct: already initialized!");
...@@ -233,8 +233,8 @@ namespace utl ...@@ -233,8 +233,8 @@ namespace utl
m_pImpl->xORB, m_pImpl->xORB,
_rConfigLocation, _rConfigLocation,
_nLevels, _nLevels,
( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY, ( _nAccessFlags & CVCFlags::UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) == 0 !bool( _nAccessFlags & CVCFlags::IMMEDIATE_UPDATE )
); );
SAL_WARN_IF(!m_pImpl->aConfigRoot.isValid(), "unotools.config", SAL_WARN_IF(!m_pImpl->aConfigRoot.isValid(), "unotools.config",
"Could not access the configuration node located at " << _rConfigLocation); "Could not access the configuration node located at " << _rConfigLocation);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment