diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-20 20:03:15 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-22 18:42:35 +0200 |
commit | 6ffdc88e79904882e319bdd0b901e7491abae0b3 (patch) | |
tree | 5cb0257a03987f962668655af536a05ad72f8882 /sot/source | |
parent | 803a6ccb774ff6dc67ca697459d6679e4bc9604f (diff) |
Simplify Sequence iterations in shell..svgio
Use range-based loops, STL and comphelper functions
Change-Id: I612d36abcc09a91c60f7212de6747a1a1bdcfc69
Reviewed-on: https://gerrit.libreoffice.org/76056
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'sot/source')
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 12 | ||||
-rw-r--r-- | sot/source/unoolestorage/xolesimplestorage.cxx | 8 |
2 files changed, 8 insertions, 12 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index a4c754610229..591a22805946 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1813,14 +1813,12 @@ sal_Int32 UCBStorage_Impl::GetObjectCount() static OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& rPath ) { bool bFound = false; - for ( sal_Int32 nSeqs=0; nSeqs<rSequence.getLength(); nSeqs++ ) + for ( const Sequence < PropertyValue >& rMyProps : rSequence ) { - const Sequence < PropertyValue >& rMyProps = rSequence[nSeqs]; OUString aType; - for ( sal_Int32 nProps=0; nProps<rMyProps.getLength(); nProps++ ) + for ( const PropertyValue& rAny : rMyProps ) { - const PropertyValue& rAny = rMyProps[nProps]; if ( rAny.Name == "FullPath" ) { OUString aTmp; @@ -1944,14 +1942,12 @@ bool UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent ) try { Sequence< ContentInfo > aInfo = pContent->queryCreatableContentsInfo(); - sal_Int32 nCount = aInfo.getLength(); - if ( nCount == 0 ) + if ( !aInfo.hasElements() ) return false; - for ( sal_Int32 i = 0; i < nCount; ++i ) + for ( const ContentInfo & rCurr : aInfo ) { // Simply look for the first KIND_FOLDER... - const ContentInfo & rCurr = aInfo[i]; if ( rCurr.Attributes & ContentInfoAttribute::KIND_FOLDER ) { // Make sure the only required bootstrap property is "Title", diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index 80f2d0605c10..09de314226ab 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -237,15 +237,15 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, co try { uno::Sequence< OUString > aElements = xNameAccess->getElementNames(); - for ( sal_Int32 nInd = 0; nInd < aElements.getLength(); nInd++ ) + for ( const auto& rElement : aElements ) { uno::Reference< io::XInputStream > xInputStream; uno::Reference< container::XNameAccess > xSubNameAccess; - uno::Any aAny = xNameAccess->getByName( aElements[nInd] ); + uno::Any aAny = xNameAccess->getByName( rElement ); if ( aAny >>= xInputStream ) - InsertInputStreamToStorage_Impl( pNewStorage.get(), aElements[nInd], xInputStream ); + InsertInputStreamToStorage_Impl( pNewStorage.get(), rElement, xInputStream ); else if ( aAny >>= xSubNameAccess ) - InsertNameAccessToStorage_Impl( pNewStorage.get(), aElements[nInd], xSubNameAccess ); + InsertNameAccessToStorage_Impl( pNewStorage.get(), rElement, xSubNameAccess ); } } catch( uno::Exception& ) |