diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-09-20 11:30:38 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-09-20 11:30:38 +0200 |
commit | 2bd18402f1de8401511e4199e3b2113d9149ebdb (patch) | |
tree | 67a8ef13e800913d306d13eeab3dfbbdaca5042d /include/registry | |
parent | f0f600751feb5615499010c31e5a577568a88e7f (diff) |
cid#1371306: Add move semantics
Change-Id: Id669a84742cc4ffa3bb9f225af7fa4d218999681
Diffstat (limited to 'include/registry')
-rw-r--r-- | include/registry/registry.hxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx index a9be21d41aaa..0aea6fd86ed7 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; |