diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-03 10:38:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-03 11:23:35 +0000 |
commit | 11a1b70da2f8d788f18cd0c4b8a4c5d0386aa72e (patch) | |
tree | bd8369ce895b3a49a1992aef9e18e6d62ef9d574 | |
parent | 6a866f99ecf21f6ebdbb7f00d3c72677a1361e74 (diff) |
coverity#1371313 Missing move assignment operator
Change-Id: I07a9d7fe837c18e66b4a2a57186f1f9b0d44daee
-rw-r--r-- | include/unotools/confignode.hxx | 3 | ||||
-rw-r--r-- | unotools/source/config/confignode.cxx | 46 |
2 files changed, 42 insertions, 7 deletions
diff --git a/include/unotools/confignode.hxx b/include/unotools/confignode.hxx index cae0bd9b8b92..83f3ee51affe 100644 --- a/include/unotools/confignode.hxx +++ b/include/unotools/confignode.hxx @@ -74,9 +74,12 @@ namespace utl OConfigurationNode() :m_bEscapeNames(false) { } /// copy ctor OConfigurationNode(const OConfigurationNode& _rSource); + /// move ctor + OConfigurationNode(OConfigurationNode&& _rSource); /// assigment OConfigurationNode& operator=(const OConfigurationNode& _rSource); + OConfigurationNode& operator=(OConfigurationNode&& _rSource); /// dtor virtual ~OConfigurationNode() override {} diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 4d0eec963c11..93426589c73d 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -78,13 +78,27 @@ namespace utl } OConfigurationNode::OConfigurationNode(const OConfigurationNode& _rSource) - :OEventListenerAdapter() - ,m_xHierarchyAccess(_rSource.m_xHierarchyAccess) - ,m_xDirectAccess(_rSource.m_xDirectAccess) - ,m_xReplaceAccess(_rSource.m_xReplaceAccess) - ,m_xContainerAccess(_rSource.m_xContainerAccess) - ,m_bEscapeNames(_rSource.m_bEscapeNames) - ,m_sCompletePath(_rSource.m_sCompletePath) + : OEventListenerAdapter() + , m_xHierarchyAccess(_rSource.m_xHierarchyAccess) + , m_xDirectAccess(_rSource.m_xDirectAccess) + , m_xReplaceAccess(_rSource.m_xReplaceAccess) + , m_xContainerAccess(_rSource.m_xContainerAccess) + , m_bEscapeNames(_rSource.m_bEscapeNames) + , m_sCompletePath(_rSource.m_sCompletePath) + { + Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY); + if (xConfigNodeComp.is()) + startComponentListening(xConfigNodeComp); + } + + OConfigurationNode::OConfigurationNode(OConfigurationNode&& _rSource) + : OEventListenerAdapter() + , m_xHierarchyAccess(std::move(_rSource.m_xHierarchyAccess)) + , m_xDirectAccess(std::move(_rSource.m_xDirectAccess)) + , m_xReplaceAccess(std::move(_rSource.m_xReplaceAccess)) + , m_xContainerAccess(std::move(_rSource.m_xContainerAccess)) + , m_bEscapeNames(std::move(_rSource.m_bEscapeNames)) + , m_sCompletePath(std::move(_rSource.m_sCompletePath)) { Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY); if (xConfigNodeComp.is()) @@ -109,6 +123,24 @@ namespace utl return *this; } + OConfigurationNode& OConfigurationNode::operator=(OConfigurationNode&& _rSource) + { + stopAllComponentListening(); + + m_xHierarchyAccess = std::move(_rSource.m_xHierarchyAccess); + m_xDirectAccess = std::move(_rSource.m_xDirectAccess); + m_xContainerAccess = std::move(_rSource.m_xContainerAccess); + m_xReplaceAccess = std::move(_rSource.m_xReplaceAccess); + m_bEscapeNames = std::move(_rSource.m_bEscapeNames); + m_sCompletePath = std::move(_rSource.m_sCompletePath); + + Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY); + if (xConfigNodeComp.is()) + startComponentListening(xConfigNodeComp); + + return *this; + } + void OConfigurationNode::_disposing( const EventObject& _rSource ) { Reference< XComponent > xDisposingSource(_rSource.Source, UNO_QUERY); |