diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-19 09:14:59 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-19 09:33:29 +0200 |
commit | 2554efabb6d7cd2ad9f7cfdddd0712c25cdca1cd (patch) | |
tree | 1b8fd3940910ffcd328e16a53e208c099f67ab21 /svl | |
parent | f7b5f477bfd942e0a1d8880c372635000d724dd7 (diff) |
use comphelper::containerToSequence
in chart2, we remove a local equivalent of the method
Change-Id: I25129a3d1ea1dd724eb9cd38a57be37a78b3d100
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/passwordcontainer/passwordcontainer.cxx | 26 | ||||
-rw-r--r-- | svl/source/passwordcontainer/syscreds.cxx | 15 |
2 files changed, 6 insertions, 35 deletions
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index fde28a2195c7..d6c1d82887fd 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -24,6 +24,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/task/InteractionHandler.hpp> @@ -177,25 +178,6 @@ static ::rtl::ByteSequence getBufFromAsciiLine( const OUString& line ) } -static Sequence< OUString > copyVectorToSequence( const vector< OUString >& original ) -{ - Sequence< OUString > newOne ( original.size() ); - for( size_t i = 0; i < original.size() ; i++ ) - newOne[i] = original[i]; - - return newOne; -} - -static vector< OUString > copySequenceToVector( const Sequence< OUString >& original ) -{ - vector< OUString > newOne ( original.getLength() ); - for( int i = 0; i < original.getLength() ; i++ ) - newOne[i] = original[i]; - - return newOne; -} - - PassMap StorageItem::getInfo() { PassMap aResult; @@ -618,7 +600,7 @@ UserRecord PasswordContainer::CopyToUserRecord( const NamePassRecord& aRecord, b } } - return UserRecord( aRecord.GetUserName(), copyVectorToSequence( aPasswords ) ); + return UserRecord( aRecord.GetUserName(), comphelper::containerToSequence( aPasswords ) ); } @@ -658,7 +640,7 @@ void SAL_CALL PasswordContainer::addPersistent( const OUString& Url, const OUStr void PasswordContainer::PrivateAdd( const OUString& Url, const OUString& UserName, const Sequence< OUString >& Passwords, char Mode, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException, std::exception) { NamePassRecord aRecord( UserName ); - ::std::vector< OUString > aStorePass = copySequenceToVector( Passwords ); + ::std::vector< OUString > aStorePass = comphelper::sequenceToContainer< std::vector<OUString>, OUString>( Passwords ); if( Mode == PERSISTENT_RECORD ) aRecord.SetPersPasswords( EncodePasswords( aStorePass, GetMasterPassword( aHandler ) ) ); @@ -1035,7 +1017,7 @@ Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Refere { sal_Int32 oldLen = aUsers.getLength(); aUsers.realloc( oldLen + 1 ); - aUsers[ oldLen ] = UserRecord( aNPIter->GetUserName(), copyVectorToSequence( DecodePasswords( aNPIter->GetPersPasswords(), GetMasterPassword( xHandler ) ) ) ); + aUsers[ oldLen ] = UserRecord( aNPIter->GetUserName(), comphelper::containerToSequence( DecodePasswords( aNPIter->GetPersPasswords(), GetMasterPassword( xHandler ) ) ) ); } if( aUsers.getLength() ) diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx index bd1722a32e82..ca54b517ab78 100644 --- a/svl/source/passwordcontainer/syscreds.cxx +++ b/svl/source/passwordcontainer/syscreds.cxx @@ -20,6 +20,7 @@ #include "syscreds.hxx" #include <com/sun/star/beans/PropertyValue.hpp> #include <osl/diagnose.h> +#include <comphelper/sequence.hxx> using namespace com::sun::star; @@ -185,19 +186,7 @@ void SysCredentialsConfig::writeCfg() OSL_ENSURE( m_bCfgInited, "SysCredentialsConfig::writeCfg : not initialized!" ); - uno::Sequence< OUString > aURLs( m_aCfgContainer.size() ); - StringSet::const_iterator it = m_aCfgContainer.begin(); - const StringSet::const_iterator end = m_aCfgContainer.end(); - sal_Int32 n = 0; - - while ( it != end ) - { - aURLs[ n ] = *it; - ++it; - ++n; - } - - m_aConfigItem.setSystemCredentialsURLs( aURLs ); + m_aConfigItem.setSystemCredentialsURLs( comphelper::containerToSequence<OUString>(m_aCfgContainer) ); } OUString SysCredentialsConfig::find( OUString const & aURL ) |