[Libreoffice-commits] core.git: include/o3tl include/xmloff o3tl/qa

Noel Grandin noel at peralex.com
Wed Jul 15 16:40:47 PDT 2015


 include/o3tl/typed_flags_set.hxx |    9 +++++++++
 include/xmloff/shapeexport.hxx   |    6 ++----
 include/xmloff/xmlerror.hxx      |    6 +-----
 include/xmloff/xmlexp.hxx        |    5 +----
 include/xmloff/xmlexppr.hxx      |    5 +----
 include/xmloff/xmlimp.hxx        |    5 +----
 o3tl/qa/test-typed_flags.cxx     |    5 +----
 7 files changed, 16 insertions(+), 25 deletions(-)

New commits:
commit e51fa143587d018b75db08e60cf27ff932b1cf8d
Author: Noel Grandin <noel at peralex.com>
Date:   Fri May 22 15:23:50 2015 +0200

    create a macro to tidy up the declaration sites of o3tl::typed_flags_set
    
    Change-Id: Ifb8fd4fd5128188420f1dfda6b6f695160d5e77a
    Reviewed-on: https://gerrit.libreoffice.org/15865
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
index 76cefc5..d997f6a 100644
--- a/include/o3tl/typed_flags_set.hxx
+++ b/include/o3tl/typed_flags_set.hxx
@@ -317,6 +317,15 @@ inline typename o3tl::typed_flags<E>::Self operator ^=(
     return lhs;
 }
 
+/*
+ * Make the declaration sites a little less verbose
+ */
+#define DECLARE_TYPED_FLAGS(T,V) \
+    namespace o3tl \
+    { \
+        template<> struct typed_flags<T> : is_typed_flags<T,V> {}; \
+    } \
+
 #endif /* INCLUDED_O3TL_TYPED_FLAGS_SET_HXX */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx
index 83aafd5..f068f71 100644
--- a/include/xmloff/shapeexport.hxx
+++ b/include/xmloff/shapeexport.hxx
@@ -61,10 +61,8 @@ enum class XMLShapeExportFlags {
 // When setting the flag below a callout shape is exported as office:annotation
      ANNOTATION = 0x0040,
 };
-namespace o3tl
-{
-    template<> struct typed_flags<XMLShapeExportFlags> : is_typed_flags<XMLShapeExportFlags, 0x7f> {};
-}
+DECLARE_TYPED_FLAGS(XMLShapeExportFlags, 0x007f)
+
 
 #define SEF_DEFAULT         XMLShapeExportFlags::POSITION|XMLShapeExportFlags::SIZE
 
diff --git a/include/xmloff/xmlerror.hxx b/include/xmloff/xmlerror.hxx
index 853af45..cb3c979 100644
--- a/include/xmloff/xmlerror.hxx
+++ b/include/xmloff/xmlerror.hxx
@@ -81,11 +81,7 @@ enum class SvXMLErrorFlags {
     ERROR_OCCURRED    = 0x0002,
     WARNING_OCCURRED  = 0x0004,
 };
-
-namespace o3tl
-{
-    template<> struct typed_flags<SvXMLErrorFlags> : is_typed_flags<SvXMLErrorFlags, 0x7> {};
-}
+DECLARE_TYPED_FLAGS(SvXMLErrorFlags, 0x0007)
 
 namespace com { namespace sun { namespace star {
     namespace uno { template<class X> class Sequence; }
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index ad738eb..4d7d933 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -102,10 +102,7 @@ enum class SvXMLExportFlags {
     OASIS                    = 0x8000,
     ALL                      = 0x0fff
 };
-namespace o3tl
-{
-    template<> struct typed_flags<SvXMLExportFlags> : is_typed_flags<SvXMLExportFlags, 0x8fff> {};
-}
+DECLARE_TYPED_FLAGS(SvXMLExportFlags, 0x8fff)
 
 class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6<
              ::com::sun::star::document::XFilter,
diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx
index 9a67145..7739a55 100644
--- a/include/xmloff/xmlexppr.hxx
+++ b/include/xmloff/xmlexppr.hxx
@@ -38,10 +38,7 @@ enum class SvXmlExportFlags {
                            // even if its empty
     IGN_WS      = 0x0008
 };
-namespace o3tl
-{
-    template<> struct typed_flags<SvXmlExportFlags> : is_typed_flags<SvXmlExportFlags, 0xf> {};
-}
+DECLARE_TYPED_FLAGS(SvXmlExportFlags, 0x000f)
 
 class SvXMLUnitConverter;
 class SvXMLAttributeList;
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index ceb6f782..2619d3e 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -97,10 +97,7 @@ enum class SvXMLImportFlags {
     EMBEDDED        = 0x0100,
     ALL             = 0xffff
 };
-namespace o3tl
-{
-    template<> struct typed_flags<SvXMLImportFlags> : is_typed_flags<SvXMLImportFlags, 0xffff> {};
-}
+DECLARE_TYPED_FLAGS(SvXMLImportFlags, 0xffff)
 
 
 class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper7<
diff --git a/o3tl/qa/test-typed_flags.cxx b/o3tl/qa/test-typed_flags.cxx
index d2a4154..c8bc27b 100644
--- a/o3tl/qa/test-typed_flags.cxx
+++ b/o3tl/qa/test-typed_flags.cxx
@@ -18,10 +18,7 @@ using namespace ::o3tl;
 
 enum class ConfigurationChangedHint { NONE, ONE, TWO };
 
-namespace o3tl
-{
-    template<> struct typed_flags< ConfigurationChangedHint> : is_typed_flags< ConfigurationChangedHint, 0xFF> {};
-}
+DECLARE_TYPED_FLAGS(ConfigurationChangedHint, 0xff)
 
 class typed_flags_test : public CppUnit::TestFixture
 {


More information about the Libreoffice-commits mailing list