summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-10-29 23:06:05 +0100
committerJulien Nabet <serval2412@yahoo.fr>2017-10-30 07:14:23 +0100
commitcf839137d61ab93b4166fe9ad43a8510836de710 (patch)
tree1fb266918674832223599d8a5023cee4a2bb6fba /desktop/source
parentf06ca1f2af9c789d77e62d25c3030128dc1ba925 (diff)
Replace some lists by vectors in desktop
Change-Id: Ib1cd2278d1af651b96f07c8831382bba7f51aed6 Reviewed-on: https://gerrit.libreoffice.org/44037 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/deployment/inc/dp_ucb.h3
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx24
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.hxx6
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx10
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx2
5 files changed, 20 insertions, 25 deletions
diff --git a/desktop/source/deployment/inc/dp_ucb.h b/desktop/source/deployment/inc/dp_ucb.h
index 3c97fc6a1e89..85d6b358c46f 100644
--- a/desktop/source/deployment/inc/dp_ucb.h
+++ b/desktop/source/deployment/inc/dp_ucb.h
@@ -20,7 +20,6 @@
#ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UCB_H
#define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UCB_H
-#include <list>
#include <vector>
#include <rtl/byteseq.hxx>
#include <rtl/instance.hxx>
@@ -89,7 +88,7 @@ bool readLine( OUString * res, OUString const & startingWith,
::ucbhelper::Content & ucb_content, rtl_TextEncoding textenc );
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
-bool readProperties( std::list< std::pair< OUString, OUString> > & out_result,
+bool readProperties( std::vector< std::pair< OUString, OUString> > & out_result,
::ucbhelper::Content & ucb_content);
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index fad019f45cd7..b7b27575df95 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -58,7 +58,7 @@
#include "dp_commandenvironments.hxx"
#include "dp_properties.hxx"
-#include <list>
+#include <vector>
#include <algorithm>
#include <set>
@@ -239,13 +239,12 @@ void ExtensionManager::addExtensionsToMap(
{
//Determine the index in the vector where these extensions are to be
//added.
- std::list<OUString>::const_iterator citNames =
- m_repositoryNames.begin();
int index = 0;
- for (;citNames != m_repositoryNames.end(); ++citNames, ++index)
+ for (auto const& repositoryName : m_repositoryNames)
{
- if (*citNames == repository)
+ if (repositoryName == repository)
break;
+ ++index;
}
for (int i = 0; i < seqExt.getLength(); ++i)
@@ -278,12 +277,12 @@ void ExtensionManager::addExtensionsToMap(
The number of elements is always three, unless the number of repository
changes.
*/
-std::list<Reference<css::deployment::XPackage> >
+std::vector<Reference<css::deployment::XPackage> >
ExtensionManager::getExtensionsWithSameId(
OUString const & identifier, OUString const & fileName)
{
- std::list<Reference<css::deployment::XPackage> > extensionList;
+ std::vector<Reference<css::deployment::XPackage> > extensionList;
Reference<css::deployment::XPackageManager> lRepos[] = {
getUserRepository(), getSharedRepository(), getBundledRepository() };
for (int i(0); i != SAL_N_ELEMENTS(lRepos); ++i)
@@ -312,14 +311,13 @@ ExtensionManager::getExtensionsWithSameIdentifier(
{
try
{
- std::list<Reference<css::deployment::XPackage> > listExtensions =
+ std::vector<Reference<css::deployment::XPackage> > listExtensions =
getExtensionsWithSameId(identifier, fileName);
bool bHasExtension = false;
//throw an IllegalArgumentException if there is no extension at all.
- typedef std::list<Reference<css::deployment::XPackage> >::const_iterator CIT;
- for (CIT i = listExtensions.begin(); i != listExtensions.end(); ++i)
- bHasExtension |= i->is();
+ for (auto const& extension : listExtensions)
+ bHasExtension |= extension.is();
if (!bHasExtension)
throw lang::IllegalArgumentException(
"Could not find extension: " + identifier + ", " + fileName,
@@ -351,7 +349,7 @@ ExtensionManager::getExtensionsWithSameIdentifier(
bool ExtensionManager::isUserDisabled(
OUString const & identifier, OUString const & fileName)
{
- std::list<Reference<css::deployment::XPackage> > listExtensions;
+ std::vector<Reference<css::deployment::XPackage> > listExtensions;
try {
listExtensions = getExtensionsWithSameId(identifier, fileName);
@@ -404,7 +402,7 @@ void ExtensionManager::activateExtension(
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<ucb::XCommandEnvironment> const & xCmdEnv )
{
- std::list<Reference<css::deployment::XPackage> > listExtensions;
+ std::vector<Reference<css::deployment::XPackage> > listExtensions;
try {
listExtensions = getExtensionsWithSameId(identifier, fileName);
} catch (const lang::IllegalArgumentException &) {
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx
index b2315dd7d5fe..0e1778ed1c01 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.hxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx
@@ -31,7 +31,7 @@
#include <com/sun/star/deployment/XPackageRegistry.hpp>
#include <com/sun/star/deployment/XPackageManager.hpp>
#include <osl/mutex.hxx>
-#include <list>
+#include <vector>
#include <unordered_map>
namespace dp_manager {
@@ -148,7 +148,7 @@ private:
priority. That is, the first element is "user" followed by "shared" and
then "bundled"
*/
- std::list< OUString > m_repositoryNames;
+ std::vector< OUString > m_repositoryNames;
css::uno::Reference<css::deployment::XPackageManager> getUserRepository();
css::uno::Reference<css::deployment::XPackageManager> getSharedRepository();
@@ -175,7 +175,7 @@ private:
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
- std::list<css::uno::Reference<css::deployment::XPackage> >
+ std::vector<css::uno::Reference<css::deployment::XPackage> >
getExtensionsWithSameId(OUString const & identifier,
OUString const & fileName);
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
index fb8f4ddb1a09..3ba2e3e9e89f 100644
--- a/desktop/source/deployment/manager/dp_properties.cxx
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -22,7 +22,6 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <xmlscript/xml_helper.hxx>
#include <ucbhelper/content.hxx>
-#include <list>
#include <dp_ucb.h>
#include <rtl/ustrbuf.hxx>
@@ -49,18 +48,17 @@ ExtensionProperties::ExtensionProperties(
{
m_propFileUrl = urlExtension + "properties";
- std::list< std::pair< OUString, OUString> > props;
+ std::vector< std::pair< OUString, OUString> > props;
if (! dp_misc::create_ucb_content(nullptr, m_propFileUrl, nullptr, false))
return;
::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv, m_xContext);
dp_misc::readProperties(props, contentProps);
- typedef std::list< std::pair< OUString, OUString> >::const_iterator CI;
- for (CI i = props.begin(); i != props.end(); ++i)
+ for (auto const& prop : props)
{
- if (i->first == PROP_SUPPRESS_LICENSE)
- m_prop_suppress_license = i->second;
+ if (prop.first == PROP_SUPPRESS_LICENSE)
+ m_prop_suppress_license = prop.second;
}
}
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index 09de3711006f..c27adf7383a8 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -253,7 +253,7 @@ bool readLine( OUString * res, OUString const & startingWith,
return false;
}
-bool readProperties( std::list< std::pair< OUString, OUString> > & out_result,
+bool readProperties( std::vector< std::pair< OUString, OUString> > & out_result,
::ucbhelper::Content & ucb_content )
{
// read whole file: