Kaydet (Commit) cf839137 authored tarafından Julien Nabet's avatar Julien Nabet

Replace some lists by vectors in desktop

Change-Id: Ib1cd2278d1af651b96f07c8831382bba7f51aed6
Reviewed-on: https://gerrit.libreoffice.org/44037Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst f06ca1f2
......@@ -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);
......
......@@ -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 &) {
......
......@@ -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);
......
......@@ -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;
}
}
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment