From 89e0663c55f7f1763536a345d63111115c71ef26 Mon Sep 17 00:00:00 2001 From: Jakub Trzebiatowski Date: Mon, 7 Mar 2016 19:48:23 +0100 Subject: [PATCH] tdf#96099 fix trival typedefs, Path to std::vector Change-Id: I23fca48becbfdfd92db02a11b739a668fc1cd8c4 Reviewed-on: https://gerrit.libreoffice.org/23007 Tested-by: Jenkins Reviewed-by: Noel Grandin --- configmgr/source/access.cxx | 11 +++++---- configmgr/source/access.hxx | 7 +++--- configmgr/source/additions.hxx | 7 +++--- configmgr/source/childaccess.cxx | 13 +++++------ configmgr/source/childaccess.hxx | 7 +++--- configmgr/source/components.cxx | 10 ++++----- configmgr/source/components.hxx | 5 ++--- configmgr/source/data.cxx | 2 +- configmgr/source/data.hxx | 3 +-- configmgr/source/modifications.cxx | 11 +++++---- configmgr/source/modifications.hxx | 6 ++--- configmgr/source/partial.cxx | 4 ++-- configmgr/source/partial.hxx | 3 +-- configmgr/source/path.hxx | 36 ------------------------------ configmgr/source/rootaccess.cxx | 9 ++++---- configmgr/source/rootaccess.hxx | 9 ++++---- configmgr/source/setnode.hxx | 4 ++-- configmgr/source/xcuparser.cxx | 1 - configmgr/source/xcuparser.hxx | 3 +-- 19 files changed, 50 insertions(+), 101 deletions(-) delete mode 100644 configmgr/source/path.hxx diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 97543bbda69d..3506beb7aeb4 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -96,7 +96,6 @@ #include "modifications.hxx" #include "node.hxx" #include "nodemap.hxx" -#include "path.hxx" #include "propertynode.hxx" #include "rootaccess.hxx" #include "setnode.hxx" @@ -253,7 +252,7 @@ css::uno::Sequence< OUString > Access::getSupportedServiceNames() assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); - std::vector< OUString > services; + std::vector services; services.push_back("com.sun.star.configuration.ConfigurationAccess"); if (getRootAccess()->isUpdate()) { services.push_back( @@ -424,7 +423,7 @@ css::uno::Sequence< OUString > Access::getElementNames() osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); std::vector< rtl::Reference< ChildAccess > > children(getAllChildren()); - std::vector< OUString > names; + std::vector names; for (std::vector< rtl::Reference< ChildAccess > >::iterator i( children.begin()); i != children.end(); ++i) @@ -1673,7 +1672,7 @@ void Access::commitChildChanges( } } if (childValid && i->second.directlyModified) { - Path path(getAbsolutePath()); + std::vector path(getAbsolutePath()); path.push_back(i->first); components_.addModification(path); globalModifications->add(path); @@ -2100,8 +2099,8 @@ rtl::Reference< ChildAccess > Access::getSubChild(OUString const & path) { if (!getRootAccess().is()) { return rtl::Reference< ChildAccess >(); } - Path abs(getAbsolutePath()); - for (Path::iterator j(abs.begin()); j != abs.end(); ++j) { + std::vector abs(getAbsolutePath()); + for (auto j(abs.begin()); j != abs.end(); ++j) { OUString name1; bool setElement1; OUString templateName1; diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx index 5a71adb6f569..63cba6907a5f 100644 --- a/configmgr/source/access.hxx +++ b/configmgr/source/access.hxx @@ -62,7 +62,6 @@ #include #include "modifications.hxx" -#include "path.hxx" #include "type.hxx" namespace com { namespace sun { namespace star { @@ -120,8 +119,8 @@ public: void markChildAsModified(rtl::Reference< ChildAccess > const & child); void releaseChild(OUString const & name); - virtual Path getAbsolutePath() = 0; - virtual Path getRelativePath() = 0; + virtual std::vector getAbsolutePath() = 0; + virtual std::vector getRelativePath() = 0; virtual OUString getRelativePathRepresentation() = 0; virtual rtl::Reference< Node > getNode() = 0; @@ -438,7 +437,7 @@ protected: const = 0; virtual void addSupportedServiceNames( - std::vector< OUString > * services) = 0; + std::vector * services) = 0; virtual void initDisposeBroadcaster(Broadcaster * broadcaster); virtual void clearListeners() throw (); diff --git a/configmgr/source/additions.hxx b/configmgr/source/additions.hxx index 399528dfa4b7..1bc779e2fcea 100644 --- a/configmgr/source/additions.hxx +++ b/configmgr/source/additions.hxx @@ -23,12 +23,11 @@ #include #include - -#include "path.hxx" +#include namespace configmgr { - -typedef std::list< Path > Additions; +// Additions is a list of configuration node paths +typedef std::list< std::vector > Additions; } diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index 576fbb308b23..2cde81159b4a 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -53,7 +53,6 @@ #include "lock.hxx" #include "modifications.hxx" #include "node.hxx" -#include "path.hxx" #include "propertynode.hxx" #include "rootaccess.hxx" #include "setnode.hxx" @@ -91,16 +90,16 @@ ChildAccess::ChildAccess( assert(root.is() && node.is()); } -Path ChildAccess::getAbsolutePath() { +std::vector ChildAccess::getAbsolutePath() { rtl::Reference< Access > parent(getParentAccess()); assert(parent.is()); - Path path(parent->getAbsolutePath()); + std::vector path(parent->getAbsolutePath()); path.push_back(name_); return path; } -Path ChildAccess::getRelativePath() { - Path path; +std::vector ChildAccess::getRelativePath() { + std::vector path; rtl::Reference< Access > parent(getParentAccess()); if (parent.is()) { path = parent->getRelativePath(); @@ -301,7 +300,7 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications) assert(globalModifications != nullptr); commitChildChanges(valid, globalModifications); if (valid && changedValue_.get() != nullptr) { - Path path(getAbsolutePath()); + std::vector path(getAbsolutePath()); getComponents().addModification(path); globalModifications->add(path); switch (node_->kind()) { @@ -335,7 +334,7 @@ void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const { } void ChildAccess::addSupportedServiceNames( - std::vector< OUString > * services) + std::vector * services) { assert(services != nullptr); services->push_back( diff --git a/configmgr/source/childaccess.hxx b/configmgr/source/childaccess.hxx index 703b28a21f0b..9a43d86e8c21 100644 --- a/configmgr/source/childaccess.hxx +++ b/configmgr/source/childaccess.hxx @@ -35,7 +35,6 @@ #include #include "access.hxx" -#include "path.hxx" namespace com { namespace sun { namespace star { namespace uno { class Any; @@ -66,8 +65,8 @@ public: Components & components, rtl::Reference< RootAccess > const & root, rtl::Reference< Node > const & node); - virtual Path getAbsolutePath() override; - virtual Path getRelativePath() override; + virtual std::vector getAbsolutePath() override; + virtual std::vector getRelativePath() override; virtual OUString getRelativePathRepresentation() override; virtual rtl::Reference< Node > getNode() override; @@ -125,7 +124,7 @@ private: std::vector< css::uno::Type > * types) const override; virtual void addSupportedServiceNames( - std::vector< OUString > * services) override; + std::vector * services) override; virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & aType) diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 3ba26407b4b3..294001b03299 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -217,7 +217,7 @@ bool Components::allLocales(OUString const & locale) { rtl::Reference< Node > Components::resolvePathRepresentation( OUString const & pathRepresentation, - OUString * canonicRepresentation, Path * path, int * finalizedLayer) + OUString * canonicRepresentation, std::vector * path, int * finalizedLayer) const { return data_.resolvePathRepresentation( @@ -251,9 +251,9 @@ void Components::initGlobalBroadcaster( (*i)->releaseNondeleting(); if (root.is()) { if (root != exclude) { - Path path(root->getAbsolutePath()); + std::vector path(root->getAbsolutePath()); Modifications::Node const * mods = &modifications.getRoot(); - for (Path::iterator j(path.begin()); j != path.end(); ++j) { + for (auto j(path.begin()); j != path.end(); ++j) { Modifications::Node::Children::const_iterator k( mods->children.find(*j)); if (k == mods->children.end()) { @@ -273,7 +273,7 @@ void Components::initGlobalBroadcaster( } } -void Components::addModification(Path const & path) { +void Components::addModification(std::vector const & path) { data_.modifications.add(path); } @@ -364,7 +364,7 @@ void Components::removeExtensionXcuFile( rtl::Reference< Node > parent; NodeMap const * map = &data_.getComponents(); rtl::Reference< Node > node; - for (Path::const_iterator j(i->begin()); j != i->end(); ++j) { + for (auto j(i->begin()); j != i->end(); ++j) { parent = node; node = map->findNode(Data::NO_LAYER, *j); if (!node.is()) { diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index 48ec3a8a397b..1ca24d638087 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -33,7 +33,6 @@ #include "additions.hxx" #include "data.hxx" #include "modifications.hxx" -#include "path.hxx" namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } @@ -59,7 +58,7 @@ public: rtl::Reference< Node > resolvePathRepresentation( OUString const & pathRepresentation, - OUString * canonicRepresenation, Path * path, int * finalizedLayer) + OUString * canonicRepresenation, std::vector * path, int * finalizedLayer) const; rtl::Reference< Node > getTemplate( @@ -74,7 +73,7 @@ public: rtl::Reference< RootAccess > const & exclude, Broadcaster * broadcaster); - void addModification(Path const & path); + void addModification(std::vector const & path); void writeModifications(); diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index ac3cff0e2f1e..70ce467b8805 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -183,7 +183,7 @@ Data::Data(): root_(new RootNode) {} rtl::Reference< Node > Data::resolvePathRepresentation( OUString const & pathRepresentation, - OUString * canonicRepresentation, Path * path, int * finalizedLayer) + OUString * canonicRepresentation, std::vector * path, int * finalizedLayer) const { if (pathRepresentation.isEmpty() || pathRepresentation[0] != '/') { diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index e0293b518390..315fe7b9bf47 100644 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx @@ -34,7 +34,6 @@ #include "additions.hxx" #include "modifications.hxx" #include "nodemap.hxx" -#include "path.hxx" namespace configmgr { @@ -70,7 +69,7 @@ struct Data { rtl::Reference< Node > resolvePathRepresentation( OUString const & pathRepresentation, - OUString * canonicRepresenation, Path * path, int * finalizedLayer) + OUString * canonicRepresenation, std::vector * path, int * finalizedLayer) const; rtl::Reference< Node > getTemplate( diff --git a/configmgr/source/modifications.cxx b/configmgr/source/modifications.cxx index 6b8cdf60aab3..630de8fbc8a6 100644 --- a/configmgr/source/modifications.cxx +++ b/configmgr/source/modifications.cxx @@ -24,7 +24,6 @@ #include #include "modifications.hxx" -#include "path.hxx" namespace configmgr { @@ -32,10 +31,10 @@ Modifications::Modifications() {} Modifications::~Modifications() {} -void Modifications::add(Path const & path) { +void Modifications::add(std::vector const & path) { Node * p = &root_; bool wasPresent = false; - for (Path::const_iterator i(path.begin()); i != path.end(); ++i) { + for (auto i(path.begin()); i != path.end(); ++i) { Node::Children::iterator j(p->children.find(*i)); if (j == p->children.end()) { if (wasPresent && p->children.empty()) { @@ -52,10 +51,10 @@ void Modifications::add(Path const & path) { p->children.clear(); } -void Modifications::remove(Path const & path) { +void Modifications::remove(std::vector const & path) { assert(!path.empty()); Node * p = &root_; - for (Path::const_iterator i(path.begin());;) { + for (auto i(path.begin());;) { Node::Children::iterator j(p->children.find(*i)); if (j == p->children.end()) { break; @@ -63,7 +62,7 @@ void Modifications::remove(Path const & path) { if (++i == path.end()) { p->children.erase(j); if (p->children.empty()) { - Path parent(path); + std::vector parent(path); parent.pop_back(); remove(parent); } diff --git a/configmgr/source/modifications.hxx b/configmgr/source/modifications.hxx index 5549e14a4d7c..7aa93bf53381 100644 --- a/configmgr/source/modifications.hxx +++ b/configmgr/source/modifications.hxx @@ -26,8 +26,6 @@ #include -#include "path.hxx" - namespace configmgr { class Modifications { @@ -42,9 +40,9 @@ public: ~Modifications(); - void add(Path const & path); + void add(std::vector const & path); - void remove(Path const & path); + void remove(std::vector const & path); #if ENABLE_DCONF void clear() { root_.children.clear(); } diff --git a/configmgr/source/partial.cxx b/configmgr/source/partial.cxx index 3b39b6edddba..d0ba41aba1ee 100644 --- a/configmgr/source/partial.cxx +++ b/configmgr/source/partial.cxx @@ -109,7 +109,7 @@ Partial::Partial( Partial::~Partial() {} -Partial::Containment Partial::contains(Path const & path) const { +Partial::Containment Partial::contains(std::vector const & path) const { //TODO: For set elements, the segment names recorded in the node tree need // not match the corresponding path segments, so this function can fail. @@ -121,7 +121,7 @@ Partial::Containment Partial::contains(Path const & path) const { // ** If there is no startInclude along its trace: => CONTAINS_SUBNODES Node const * p = &root_; bool bIncludes = false; - for (Path::const_iterator i(path.begin()); i != path.end(); ++i) { + for (auto i(path.begin()); i != path.end(); ++i) { Node::Children::const_iterator j(p->children.find(*i)); if (j == p->children.end()) { return p->startInclude ? CONTAINS_NODE : CONTAINS_NOT; diff --git a/configmgr/source/partial.hxx b/configmgr/source/partial.hxx index e7641e2c974b..bbb9a135ea4c 100644 --- a/configmgr/source/partial.hxx +++ b/configmgr/source/partial.hxx @@ -25,7 +25,6 @@ #include #include -#include "path.hxx" #include namespace configmgr { @@ -40,7 +39,7 @@ public: ~Partial(); - Containment contains(Path const & path) const; + Containment contains(std::vector const & path) const; private: Partial(const Partial&) = delete; diff --git a/configmgr/source/path.hxx b/configmgr/source/path.hxx deleted file mode 100644 index 9c5b54913ee2..000000000000 --- a/configmgr/source/path.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CONFIGMGR_SOURCE_PATH_HXX -#define INCLUDED_CONFIGMGR_SOURCE_PATH_HXX - -#include - -#include - - -namespace configmgr { - -typedef std::vector< OUString > Path; - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx index 09ccd98bbcef..a84898df0bbf 100644 --- a/configmgr/source/rootaccess.cxx +++ b/configmgr/source/rootaccess.cxx @@ -52,7 +52,6 @@ #include "lock.hxx" #include "modifications.hxx" #include "node.hxx" -#include "path.hxx" #include "rootaccess.hxx" namespace configmgr { @@ -67,7 +66,7 @@ RootAccess::RootAccess( { } -Path RootAccess::getAbsolutePath() { +std::vector RootAccess::getAbsolutePath() { getNode(); return path_; } @@ -205,8 +204,8 @@ RootAccess::~RootAccess() getComponents().removeRootAccess(this); } -Path RootAccess::getRelativePath() { - return Path(); +std::vector RootAccess::getRelativePath() { + return std::vector(); } OUString RootAccess::getRelativePathRepresentation() { @@ -263,7 +262,7 @@ void RootAccess::addTypes(std::vector< css::uno::Type > * types) const { } void RootAccess::addSupportedServiceNames( - std::vector< OUString > * services) + std::vector * services) { assert(services != nullptr); services->push_back("com.sun.star.configuration.AccessRootElement"); diff --git a/configmgr/source/rootaccess.hxx b/configmgr/source/rootaccess.hxx index abde6fc2771d..4c16a2932ea4 100644 --- a/configmgr/source/rootaccess.hxx +++ b/configmgr/source/rootaccess.hxx @@ -37,7 +37,6 @@ #include "access.hxx" #include "modifications.hxx" -#include "path.hxx" namespace com { namespace sun { namespace star { namespace uno { @@ -62,7 +61,7 @@ public: Components & components, OUString const & pathRepresenation, OUString const & locale, bool update); - virtual Path getAbsolutePath() override; + virtual std::vector getAbsolutePath() override; virtual void initBroadcaster( Modifications::Node const & modifications, Broadcaster * broadcaster) override; @@ -104,7 +103,7 @@ public: private: virtual ~RootAccess(); - virtual Path getRelativePath() override; + virtual std::vector getRelativePath() override; virtual OUString getRelativePathRepresentation() override; @@ -122,7 +121,7 @@ private: const override; virtual void addSupportedServiceNames( - std::vector< OUString > * services) override; + std::vector * services) override; virtual void initDisposeBroadcaster(Broadcaster * broadcaster) override; @@ -143,7 +142,7 @@ private: OUString pathRepresentation_; OUString locale_; - Path path_; + std::vector path_; rtl::Reference< Node > node_; OUString name_; ChangesListeners changesListeners_; diff --git a/configmgr/source/setnode.hxx b/configmgr/source/setnode.hxx index e0ce35f67a7d..1638eb622254 100644 --- a/configmgr/source/setnode.hxx +++ b/configmgr/source/setnode.hxx @@ -50,7 +50,7 @@ public: OUString const & getDefaultTemplateName() const { return defaultTemplateName_;} - std::vector< OUString > & getAdditionalTemplateNames() { return additionalTemplateNames_;} + std::vector & getAdditionalTemplateNames() { return additionalTemplateNames_;} bool isValidTemplate(OUString const & templateName) const; @@ -62,7 +62,7 @@ private: virtual Kind kind() const override; OUString defaultTemplateName_; - std::vector< OUString > additionalTemplateNames_; + std::vector additionalTemplateNames_; NodeMap members_; OUString templateName_; // non-empty if this node is a template, free node, or set member diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index 4d239ab4f1f9..ca811040ddcd 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -46,7 +46,6 @@ #include "nodemap.hxx" #include "parsemanager.hxx" #include "partial.hxx" -#include "path.hxx" #include "propertynode.hxx" #include "setnode.hxx" #include "xcuparser.hxx" diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx index 9628db292790..f7bc15839462 100644 --- a/configmgr/source/xcuparser.hxx +++ b/configmgr/source/xcuparser.hxx @@ -33,7 +33,6 @@ #include "node.hxx" #include "nodemap.hxx" #include "parser.hxx" -#include "path.hxx" #include "type.hxx" #include "valueparser.hxx" #include "xmldata.hxx" @@ -147,7 +146,7 @@ private: bool trackPath_; OUString componentName_; StateStack state_; - Path path_; + std::vector path_; }; }