tdf#96099 fix trival typedefs, Path to std::vector<OUString>

Change-Id: I23fca48becbfdfd92db02a11b739a668fc1cd8c4
Reviewed-on: https://gerrit.libreoffice.org/23007
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Jakub Trzebiatowski 2016-03-07 19:48:23 +01:00 committed by Noel Grandin
parent 869262bcc9
commit 89e0663c55
19 changed files with 50 additions and 101 deletions

View file

@ -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<OUString> 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<OUString> 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<OUString> 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<OUString> abs(getAbsolutePath());
for (auto j(abs.begin()); j != abs.end(); ++j) {
OUString name1;
bool setElement1;
OUString templateName1;

View file

@ -62,7 +62,6 @@
#include <sal/types.h>
#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<OUString> getAbsolutePath() = 0;
virtual std::vector<OUString> 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<OUString> * services) = 0;
virtual void initDisposeBroadcaster(Broadcaster * broadcaster);
virtual void clearListeners() throw ();

View file

@ -23,12 +23,11 @@
#include <sal/config.h>
#include <list>
#include "path.hxx"
#include <vector>
namespace configmgr {
typedef std::list< Path > Additions;
// Additions is a list of configuration node paths
typedef std::list< std::vector<OUString> > Additions;
}

View file

@ -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<OUString> ChildAccess::getAbsolutePath() {
rtl::Reference< Access > parent(getParentAccess());
assert(parent.is());
Path path(parent->getAbsolutePath());
std::vector<OUString> path(parent->getAbsolutePath());
path.push_back(name_);
return path;
}
Path ChildAccess::getRelativePath() {
Path path;
std::vector<OUString> ChildAccess::getRelativePath() {
std::vector<OUString> 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<OUString> 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<OUString> * services)
{
assert(services != nullptr);
services->push_back(

View file

@ -35,7 +35,6 @@
#include <sal/types.h>
#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<OUString> getAbsolutePath() override;
virtual std::vector<OUString> 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<OUString> * services) override;
virtual css::uno::Any SAL_CALL queryInterface(
css::uno::Type const & aType)

View file

@ -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<OUString> * 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<OUString> 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<OUString> 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()) {

View file

@ -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<OUString> * 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<OUString> const & path);
void writeModifications();

View file

@ -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<OUString> * path, int * finalizedLayer)
const
{
if (pathRepresentation.isEmpty() || pathRepresentation[0] != '/') {

View file

@ -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<OUString> * path, int * finalizedLayer)
const;
rtl::Reference< Node > getTemplate(

View file

@ -24,7 +24,6 @@
#include <rtl/ustring.hxx>
#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<OUString> 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<OUString> 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<OUString> parent(path);
parent.pop_back();
remove(parent);
}

View file

@ -26,8 +26,6 @@
#include <config_dconf.h>
#include "path.hxx"
namespace configmgr {
class Modifications {
@ -42,9 +40,9 @@ public:
~Modifications();
void add(Path const & path);
void add(std::vector<OUString> const & path);
void remove(Path const & path);
void remove(std::vector<OUString> const & path);
#if ENABLE_DCONF
void clear() { root_.children.clear(); }

View file

@ -109,7 +109,7 @@ Partial::Partial(
Partial::~Partial() {}
Partial::Containment Partial::contains(Path const & path) const {
Partial::Containment Partial::contains(std::vector<OUString> 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;

View file

@ -25,7 +25,6 @@
#include <set>
#include <boost/unordered_map.hpp>
#include "path.hxx"
#include <rtl/ustring.hxx>
namespace configmgr {
@ -40,7 +39,7 @@ public:
~Partial();
Containment contains(Path const & path) const;
Containment contains(std::vector<OUString> const & path) const;
private:
Partial(const Partial&) = delete;

View file

@ -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 <sal/config.h>
#include <vector>
namespace configmgr {
typedef std::vector< OUString > Path;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -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<OUString> RootAccess::getAbsolutePath() {
getNode();
return path_;
}
@ -205,8 +204,8 @@ RootAccess::~RootAccess()
getComponents().removeRootAccess(this);
}
Path RootAccess::getRelativePath() {
return Path();
std::vector<OUString> RootAccess::getRelativePath() {
return std::vector<OUString>();
}
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<OUString> * services)
{
assert(services != nullptr);
services->push_back("com.sun.star.configuration.AccessRootElement");

View file

@ -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<OUString> 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<OUString> getRelativePath() override;
virtual OUString getRelativePathRepresentation() override;
@ -122,7 +121,7 @@ private:
const override;
virtual void addSupportedServiceNames(
std::vector< OUString > * services) override;
std::vector<OUString> * services) override;
virtual void initDisposeBroadcaster(Broadcaster * broadcaster) override;
@ -143,7 +142,7 @@ private:
OUString pathRepresentation_;
OUString locale_;
Path path_;
std::vector<OUString> path_;
rtl::Reference< Node > node_;
OUString name_;
ChangesListeners changesListeners_;

View file

@ -50,7 +50,7 @@ public:
OUString const & getDefaultTemplateName() const { return defaultTemplateName_;}
std::vector< OUString > & getAdditionalTemplateNames() { return additionalTemplateNames_;}
std::vector<OUString> & 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<OUString> additionalTemplateNames_;
NodeMap members_;
OUString templateName_;
// non-empty if this node is a template, free node, or set member

View file

@ -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"

View file

@ -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<OUString> path_;
};
}