summaryrefslogtreecommitdiff
path: root/configmgr/source/nodemap.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-06-26 14:49:38 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-06-28 14:37:23 +0100
commit8bfdc161e6417a4f057f66af6c44299e22ad5a9c (patch)
treec8feea554731ac78f808c4f835b8ea1a722fca3d /configmgr/source/nodemap.cxx
parentff1d2ba5010821bb4f526dc7a51a99b9e6c4dd25 (diff)
configmgr: re-factor findNode and clone into NodeMap.
Change-Id: Ib170b3cec17402e38bf5555e21f83f44d70bb574
Diffstat (limited to 'configmgr/source/nodemap.cxx')
-rw-r--r--configmgr/source/nodemap.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/configmgr/source/nodemap.cxx b/configmgr/source/nodemap.cxx
index 683dc7019e0c..3c7c79ae10c4 100644
--- a/configmgr/source/nodemap.cxx
+++ b/configmgr/source/nodemap.cxx
@@ -29,13 +29,21 @@
namespace configmgr {
-void cloneNodeMap(NodeMap const & source, NodeMap * target) {
+void NodeMap::cloneInto(NodeMap * target) const
+{
assert(target != 0 && target->empty());
- NodeMap clone(source);
- for (NodeMap::iterator i(clone.begin()); i != clone.end(); ++i) {
+ NodeMapImpl clone(aImpl);
+ for (NodeMapImpl::iterator i(clone.begin()); i != clone.end(); ++i) {
i->second = i->second->clone(true);
}
- std::swap(clone, *target);
+ std::swap(clone, target->aImpl);
+}
+
+rtl::Reference< Node > NodeMap::findNode(int layer, OUString const & name) const
+{
+ const_iterator i(aImpl.find(name));
+ return i == end() || i->second->getLayer() > layer
+ ? rtl::Reference< Node >() : i->second;
}
}