diff options
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/components.cxx | 2 | ||||
-rw-r--r-- | configmgr/source/data.cxx | 10 | ||||
-rw-r--r-- | configmgr/source/data.hxx | 3 | ||||
-rw-r--r-- | configmgr/source/groupnode.cxx | 2 | ||||
-rw-r--r-- | configmgr/source/localizedpropertynode.cxx | 2 | ||||
-rw-r--r-- | configmgr/source/nodemap.cxx | 16 | ||||
-rw-r--r-- | configmgr/source/nodemap.hxx | 10 | ||||
-rw-r--r-- | configmgr/source/setnode.cxx | 2 | ||||
-rw-r--r-- | configmgr/source/writemodfile.cxx | 2 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 6 |
10 files changed, 28 insertions, 27 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index c9abceffdfd1..8dcf88dbab0b 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -357,7 +357,7 @@ void Components::removeExtensionXcuFile( rtl::Reference< Node > node; for (Path::const_iterator j(i->begin()); j != i->end(); ++j) { parent = node; - node = Data::findNode(Data::NO_LAYER, *map, *j); + node = map->findNode(Data::NO_LAYER, *j); if (!node.is()) { break; } diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index 7337a3f79d94..23839409ed68 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -179,14 +179,6 @@ bool Data::equalTemplateNames( } } -rtl::Reference< Node > Data::findNode( - int layer, NodeMap const & map, OUString const & name) -{ - NodeMap::const_iterator i(map.find(name)); - return i == map.end() || i->second->getLayer() > layer - ? rtl::Reference< Node >() : i->second; -} - Data::Data(): root_(new RootNode) {} rtl::Reference< Node > Data::resolvePathRepresentation( @@ -298,7 +290,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( rtl::Reference< Node > Data::getTemplate( int layer, OUString const & fullName) const { - return findNode(layer, templates, fullName); + return templates.findNode(layer, fullName); } NodeMap & Data::getComponents() const { diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index 1dd6f0ac96ac..2e564d953d1e 100644 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx @@ -67,9 +67,6 @@ struct Data: private boost::noncopyable { static bool equalTemplateNames( OUString const & shortName, OUString const & longName); - static rtl::Reference< Node > findNode( - int layer, NodeMap const & map, OUString const & name); - Data(); rtl::Reference< Node > resolvePathRepresentation( diff --git a/configmgr/source/groupnode.cxx b/configmgr/source/groupnode.cxx index a1d5b5864fd2..dabade56d87f 100644 --- a/configmgr/source/groupnode.cxx +++ b/configmgr/source/groupnode.cxx @@ -59,7 +59,7 @@ int GroupNode::getMandatory() const { GroupNode::GroupNode(GroupNode const & other, bool keepTemplateName): Node(other), extensible_(other.extensible_), mandatory_(other.mandatory_) { - cloneNodeMap(other.members_, &members_); + other.members_.cloneInto(&members_); if (keepTemplateName) { templateName_ = other.templateName_; } diff --git a/configmgr/source/localizedpropertynode.cxx b/configmgr/source/localizedpropertynode.cxx index ed861d14ce3f..3b55dcfada34 100644 --- a/configmgr/source/localizedpropertynode.cxx +++ b/configmgr/source/localizedpropertynode.cxx @@ -50,7 +50,7 @@ LocalizedPropertyNode::LocalizedPropertyNode( LocalizedPropertyNode const & other): Node(other), staticType_(other.staticType_), nillable_(other.nillable_) { - cloneNodeMap(other.members_, &members_); + other.members_.cloneInto(&members_); } LocalizedPropertyNode::~LocalizedPropertyNode() {} 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; } } diff --git a/configmgr/source/nodemap.hxx b/configmgr/source/nodemap.hxx index 7b8d126e63f1..3745b862face 100644 --- a/configmgr/source/nodemap.hxx +++ b/configmgr/source/nodemap.hxx @@ -31,6 +31,9 @@ typedef std::map< OUString, rtl::Reference< Node > > NodeMapImpl; class NodeMap { NodeMapImpl aImpl; + NodeMap(const NodeMap &rMap) : + aImpl(rMap.aImpl) {} + public: typedef NodeMapImpl::iterator iterator; typedef NodeMapImpl::const_iterator const_iterator; @@ -39,7 +42,7 @@ class NodeMap NodeMap() {} ~NodeMap() {} void clear() { aImpl.clear(); } - bool empty() { return aImpl.empty(); } + bool empty() const { return aImpl.empty(); } void erase(const iterator &it) { aImpl.erase(it); } void erase(const OUString &aStr) { aImpl.erase(aStr); } iterator find(const OUString &aStr) { return aImpl.find( aStr ); } @@ -52,9 +55,10 @@ class NodeMap iterator end() { return aImpl.end(); } const_iterator end() const { return aImpl.end(); } std::pair<iterator,bool> insert(const value_type &vt) { return aImpl.insert(vt); } -}; -void cloneNodeMap(NodeMap const & source, NodeMap * target); + rtl::Reference< Node > findNode(int layer, OUString const & name) const; + void cloneInto(NodeMap * target) const; +}; } diff --git a/configmgr/source/setnode.cxx b/configmgr/source/setnode.cxx index d00253b891d2..ad259cc9fd9d 100644 --- a/configmgr/source/setnode.cxx +++ b/configmgr/source/setnode.cxx @@ -95,7 +95,7 @@ SetNode::SetNode(SetNode const & other, bool keepTemplateName): additionalTemplateNames_(other.additionalTemplateNames_), mandatory_(other.mandatory_) { - cloneNodeMap(other.members_, &members_); + other.members_.cloneInto(&members_); if (keepTemplateName) { templateName_ = other.templateName_; } diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index 4ce07cbc1a1c..09b1d01f1d45 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -568,7 +568,7 @@ void writeModFile( { writeModifications( components, tmp.handle, "", rtl::Reference< Node >(), j->first, - Data::findNode(Data::NO_LAYER, data.getComponents(), j->first), + data.getComponents().findNode(Data::NO_LAYER, j->first), j->second); } writeData_(tmp.handle, RTL_CONSTASCII_STRINGPARAM("</oor:items>\n")); diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index ae3090ce0b42..abbae1697b7c 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -291,8 +291,8 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { } } rtl::Reference< Node > node( - Data::findNode( - valueParser_.getLayer(), data_.getComponents(), componentName_)); + data_.getComponents().findNode(valueParser_.getLayer(), + componentName_)); if (!node.is()) { SAL_WARN( "configmgr", @@ -788,7 +788,7 @@ void XcuParser::handleGroupNode( } } rtl::Reference< Node > child( - Data::findNode(valueParser_.getLayer(), group->getMembers(), name)); + group->getMembers().findNode(valueParser_.getLayer(), name)); if (!child.is()) { SAL_WARN( "configmgr", |