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

Replace lists by vectors (stoc)

Change-Id: Ifb5dc253186b7cc8f37d843e600addcc579c77e6
Reviewed-on: https://gerrit.libreoffice.org/44299Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
Tested-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 3b2e9a7c
......@@ -39,7 +39,7 @@
#include "lrucache.hxx"
#ifdef TEST_LIST_CLASSES
#include <list>
#include <vector>
#include <algorithm>
#endif
#include <unordered_map>
......@@ -59,8 +59,8 @@ namespace stoc_corefl
{
#ifdef TEST_LIST_CLASSES
typedef std::list< OUString > ClassNameList;
extern ClassNameList g_aClassNames;
typedef std::vector< OUString > ClassNameVector;
extern ClassNameVector g_aClassNames;
#endif
......
......@@ -29,7 +29,7 @@ namespace stoc_corefl
{
#ifdef TEST_LIST_CLASSES
ClassNameList g_aClassNames;
ClassNameVector g_aClassNames;
#endif
......@@ -65,9 +65,9 @@ IdlClassImpl::IdlClassImpl( IdlReflectionServiceImpl * pReflection,
}
#ifdef TEST_LIST_CLASSES
ClassNameList::const_iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
ClassNameVector::const_iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
OSL_ENSURE( iFind == g_aClassNames.end(), "### idl class already exists!" );
g_aClassNames.push_front( _aName );
g_aClassNames.insert(g_aClassNames.begin(), _aName);
#endif
}
......@@ -78,7 +78,7 @@ IdlClassImpl::~IdlClassImpl()
m_xReflection.clear();
#ifdef TEST_LIST_CLASSES
ClassNameList::iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
ClassNameVector::iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
OSL_ENSURE( iFind != g_aClassNames.end(), "### idl class does not exist!" );
g_aClassNames.erase( iFind );
#endif
......
......@@ -114,11 +114,9 @@ void IdlReflectionServiceImpl::dispose()
_aElements.clear();
#ifdef TEST_LIST_CLASSES
OSL_ENSURE( g_aClassNames.empty(), "### idl classes still alive!" );
ClassNameList::const_iterator iPos( g_aClassNames.begin() );
while (iPos != g_aClassNames.end())
for (auto const& className : g_aClassNames)
{
OUString aName( *iPos );
++iPos;
OUString aName(className);
}
#endif
}
......
......@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <list>
#include <vector>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/weak.hxx>
......@@ -661,7 +661,7 @@ void prepareUserKeys(const Reference < XSimpleRegistry >& xDest,
void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg,
const Reference < XRegistryKey >& xSource,
const OUString& locationUrl,
std::list<OUString> & implNames)
std::vector<OUString> & implNames)
// throw (InvalidRegistryException, RuntimeException)
{
Sequence < Reference < XRegistryKey > > subKeys = xSource->openKeys();
......@@ -747,7 +747,7 @@ void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg,
void delete_all_singleton_entries(
Reference < registry::XRegistryKey > const & xSingletons_section,
::std::list< OUString > const & impl_names )
::std::vector< OUString > const & impl_names )
// throw (InvalidRegistryException, RuntimeException)
{
Sequence< Reference< registry::XRegistryKey > > singletons( xSingletons_section->openKeys() );
......@@ -774,11 +774,9 @@ void delete_all_singleton_entries(
{
OUString const & registered_implname = p[ n ];
::std::list< OUString >::const_iterator iPos( impl_names.begin() );
::std::list< OUString >::const_iterator const iEnd( impl_names.end() );
for ( ; iPos != iEnd; ++iPos )
for (auto const& impl_name : impl_names)
{
if (*iPos == registered_implname)
if (impl_name == registered_implname)
{
registered_implnames[ n ] = p[ nNewLength -1 ];
--nNewLength;
......@@ -1134,7 +1132,7 @@ void prepareRegistry(
void findImplementations( const Reference < XRegistryKey > & xSource,
std::list <OUString>& implNames)
std::vector<OUString>& implNames)
{
bool isImplKey = false;
......@@ -1563,7 +1561,7 @@ Sequence< OUString > ImplementationRegistration::getImplementations(
}
if (xAct->writeRegistryInfo(xImpl, implementationLoaderUrl, locationUrl))
{
std::list <OUString> implNames;
std::vector<OUString> implNames;
findImplementations(xImpl, implNames);
......@@ -1610,7 +1608,7 @@ void ImplementationRegistration::doRevoke(
{
if( xDest.is() )
{
std::list<OUString> aNames;
std::vector<OUString> aNames;
const StringPool &pool = spool();
Reference < XRegistryKey > xRootKey( xDest->getRootKey() );
......@@ -1625,12 +1623,9 @@ void ImplementationRegistration::doRevoke(
xKey = xRootKey->openKey( pool.slash_SERVICES );
if (xKey.is())
{
std::list<OUString>::const_iterator iter = aNames.begin();
while (iter != aNames.end())
for (auto const& name : aNames)
{
deleteAllServiceEntries(xDest, xKey, *iter);
++iter;
deleteAllServiceEntries(xDest, xKey, name);
}
}
......
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