summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-23 13:32:21 +0200
committerNoel Grandin <noel@peralex.com>2016-02-24 11:48:38 +0200
commit0839f90394d96cf0fe414913527b3e3e5ba3c86a (patch)
treeb30ad360ae30797d9944453e6cface25db4c59c7 /include/comphelper
parenta9a04f11a6b3938aa2d8d0f8f21a866c65b761da (diff)
convert EConfigurationModes to scoped enum
Change-Id: I1e81c8d637e738f536f7efad8b67d0c9183e6483
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/configurationhelper.hxx44
-rw-r--r--include/comphelper/configurationlistener.hxx5
2 files changed, 27 insertions, 22 deletions
diff --git a/include/comphelper/configurationhelper.hxx b/include/comphelper/configurationhelper.hxx
index 51ea3e64e26b..c5cf9d4ed28b 100644
--- a/include/comphelper/configurationhelper.hxx
+++ b/include/comphelper/configurationhelper.hxx
@@ -29,37 +29,43 @@
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/comphelperdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
-// namespaces
-
-namespace comphelper{
-
-
-class COMPHELPER_DLLPUBLIC ConfigurationHelper
+namespace comphelper
{
- public:
-
-
/** specify all possible modes, which can be used to open a configuration access.
*
* @see openConfig()
* @see readDirectKey()
* @see writeDirectKey()
*/
- enum EConfigurationModes
+ enum class EConfigurationModes
{
/// opens configuration in read/write mode (without LAZY writing!)
- E_STANDARD = 0,
+ Standard = 0,
/// configuration will be opened readonly
- E_READONLY = 1,
+ ReadOnly = 1,
/// all localized nodes will be interpreted as XInterface instead of interpreting it as atomic value nodes
- E_ALL_LOCALES = 2,
+ AllLocales = 2,
/// enable lazy writing
- E_LAZY_WRITE = 4
+ LazyWrite = 4
};
+}
+
+namespace o3tl
+{
+ template<> struct typed_flags<comphelper::EConfigurationModes> : is_typed_flags<comphelper::EConfigurationModes, 0x7> {};
+}
+
+namespace comphelper
+{
+
+class COMPHELPER_DLLPUBLIC ConfigurationHelper
+{
+public:
/** returns access to the specified configuration package.
*
* This method should be used, if e.g. more than one request to the same
@@ -86,8 +92,8 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper
* E.g. css::uno::Exception if the configuration could not be opened.
*/
static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
- const OUString& sPackage,
- sal_Int32 eMode );
+ const OUString& sPackage,
+ EConfigurationModes eMode );
/** reads the value of an existing(!) configuration key,
@@ -211,7 +217,7 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper
const OUString& sPackage,
const OUString& sRelPath,
const OUString& sKey ,
- sal_Int32 eMode );
+ EConfigurationModes eMode );
/** does the same then openConfig() / writeRelativeKey() & flush() together.
@@ -227,8 +233,8 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper
const OUString& sPackage,
const OUString& sRelPath,
const OUString& sKey ,
- const css::uno::Any& aValue ,
- sal_Int32 eMode );
+ const css::uno::Any& aValue ,
+ EConfigurationModes eMode );
};
} // namespace comphelper
diff --git a/include/comphelper/configurationlistener.hxx b/include/comphelper/configurationlistener.hxx
index 6e598c1a0143..6d3091d1e7e4 100644
--- a/include/comphelper/configurationlistener.hxx
+++ b/include/comphelper/configurationlistener.hxx
@@ -70,9 +70,8 @@ public:
ConfigurationListener(const OUString &rPath,
css::uno::Reference< css::uno::XComponentContext >
const & xContext = comphelper::getProcessComponentContext())
- : mxConfig( ConfigurationHelper::openConfig( xContext, rPath,
- ConfigurationHelper::EConfigurationModes::E_READONLY ),
- css::uno::UNO_QUERY_THROW )
+ : mxConfig( ConfigurationHelper::openConfig( xContext, rPath, EConfigurationModes::ReadOnly ),
+ css::uno::UNO_QUERY_THROW )
{ }
virtual ~ConfigurationListener()