[Libreoffice-commits] core.git: include/sfx2

Stephan Bergmann sbergman at redhat.com
Thu Mar 9 13:24:43 UTC 2017


 include/sfx2/bindings.hxx |   26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

New commits:
commit d3816ab9dbd44237aa518c2e6176532ffc46a84c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 9 14:24:03 2017 +0100

    Use o3tl::typed_flags
    
    Change-Id: I02b88e60a03441c3c4df6ed32616bb618089539c

diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx
index 9597f54..20f65d3 100644
--- a/include/sfx2/bindings.hxx
+++ b/include/sfx2/bindings.hxx
@@ -23,6 +23,7 @@
 
 #include <memory>
 
+#include <o3tl/typed_flags_set.hxx>
 #include <sfx2/dllapi.h>
 #include <sal/types.h>
 #include <rtl/strbuf.hxx>
@@ -61,30 +62,9 @@ enum class SfxCallMode : sal_uInt16
     API       = 0x08,    // API call (silent)
     MODAL     = 0x10     // despite ModalMode
 };
-// make combining these type-safe
-inline SfxCallMode operator| (SfxCallMode lhs, SfxCallMode rhs)
-{
-    return static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) | static_cast<sal_uInt16>(rhs));
-}
-inline SfxCallMode operator& (SfxCallMode lhs, SfxCallMode rhs)
-{
-    return static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) & static_cast<sal_uInt16>(rhs));
-}
-inline SfxCallMode operator~ (SfxCallMode rhs)
-{
-    return static_cast<SfxCallMode>(0x1f & ~(static_cast<sal_uInt16>(rhs)));
-}
-inline SfxCallMode& operator|= (SfxCallMode& lhs, SfxCallMode rhs)
-{
-    lhs = static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) | static_cast<sal_uInt16>(rhs));
-    return lhs;
-}
-inline SfxCallMode& operator&= (SfxCallMode& lhs, SfxCallMode rhs)
-{
-    lhs = static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) & static_cast<sal_uInt16>(rhs));
-    return lhs;
-}
 
+template<> struct o3tl::typed_flags<SfxCallMode>:
+    o3tl::is_typed_flags<SfxCallMode, 0x1F> {};
 
 class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster
 


More information about the Libreoffice-commits mailing list