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

Stephan Bergmann sbergman at redhat.com
Tue Sep 20 09:32:40 UTC 2016


 include/registry/registry.hxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 2bd18402f1de8401511e4199e3b2113d9149ebdb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 20 11:30:38 2016 +0200

    cid#1371306: Add move semantics
    
    Change-Id: Id669a84742cc4ffa3bb9f225af7fa4d218999681

diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx
index a9be21d..0aea6fd 100644
--- a/include/registry/registry.hxx
+++ b/include/registry/registry.hxx
@@ -90,12 +90,24 @@ public:
     /// Copy constructor
     inline Registry(const Registry& toCopy);
 
+    Registry(Registry && other): m_pApi(other.m_pApi), m_hImpl(other.m_hImpl)
+    { other.m_hImpl = nullptr; }
+
     /// Destructor. The Destructor close the registry if it is open.
     inline ~Registry();
 
     /// Assign operator
     inline Registry& operator = (const Registry& toAssign);
 
+    Registry & operator =(Registry && other) {
+        if (m_hImpl != nullptr) {
+            m_pApi->release(m_hImpl);
+        }
+        m_hImpl = other.m_hImpl;
+        other.m_hImpl = nullptr;
+        return *this;
+    }
+
     /// checks if the registry points to a valid registry data file.
     inline bool isValid() const;
 


More information about the Libreoffice-commits mailing list