diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2015-12-19 15:18:01 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-07 12:18:40 +0000 |
commit | 5e0d36adc3f7f245edfc79230d0871017ba15d5d (patch) | |
tree | b26f52373a20adb65041a79da23803503abad030 /basic/source/basmgr/basmgr.cxx | |
parent | a8b10c2841bf38e0f4393594de9b61d9bd3cd842 (diff) |
BASIC : use std::vector instead of SbArray for Modules.
Change-Id: I9594efb13b3dccc637ccd61eea4b42255c2a775c
Reviewed-on: https://gerrit.libreoffice.org/20817
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'basic/source/basmgr/basmgr.cxx')
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 2742a2476e02..8ce26ae27e53 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -580,12 +580,8 @@ void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInf if ( !xLib.is() ) return; - sal_uInt16 nModCount = pBasic->GetModules()->Count(); - for ( sal_uInt16 nMod = 0 ; nMod < nModCount ; nMod++ ) + for ( const auto& pModule: pBasic->GetModules() ) { - SbModule* pModule = static_cast<SbModule*>(pBasic->GetModules()->Get( nMod )); - DBG_ASSERT( pModule, "Module not received!" ); - OUString aModName = pModule->GetName(); if( !xLib->hasByName( aModName ) ) { @@ -917,14 +913,10 @@ bool BasicManager::HasExeCode( const OUString& sLib ) StarBASIC* pLib = GetLib(sLib); if ( pLib ) { - SbxArray* pMods = pLib->GetModules(); - sal_uInt16 nMods = pMods ? pMods->Count() : 0; - for( sal_uInt16 i = 0; i < nMods; i++ ) + for (const auto& pModule: pLib->GetModules()) { - SbModule* p = static_cast<SbModule*>( pMods->Get( i ) ); - if ( p ) - if ( p->HasExeCode() ) - return true; + if (pModule->HasExeCode()) + return true; } } return false; @@ -1114,9 +1106,8 @@ void BasicManager::CheckModules( StarBASIC* pLib, bool bReference ) } bool bModified = pLib->IsModified(); - for ( sal_uInt16 nMod = 0; nMod < pLib->GetModules()->Count(); nMod++ ) + for ( const auto& pModule: pLib->GetModules() ) { - SbModule* pModule = static_cast<SbModule*>(pLib->GetModules()->Get( nMod )); DBG_ASSERT( pModule, "Module not received!" ); if ( !pModule->IsCompiled() && !StarBASIC::GetErrorCode() ) { @@ -1601,11 +1592,9 @@ namespace if( pLib ) { - sal_uInt16 nModCount = pLib->GetModules()->Count(); - for( sal_uInt16 nMod = 0; nMod < nModCount; ++nMod ) + for ( const auto& pMod: pLib->GetModules() ) { - SbModule* pMod = static_cast<SbModule*>(pLib->GetModules()->Get( nMod )); - if ( pMod && rTransliteration.isEqual( pMod->GetName(), sModule ) ) + if ( rTransliteration.isEqual( pMod->GetName(), sModule ) ) { SbMethod* pMethod = static_cast<SbMethod*>(pMod->Find( sMacro, SbxCLASS_METHOD )); if( pMethod ) @@ -1827,8 +1816,7 @@ uno::Type ModuleContainer_Impl::getElementType() sal_Bool ModuleContainer_Impl::hasElements() throw(uno::RuntimeException, std::exception) { - SbxArray* pMods = mpLib ? mpLib->GetModules() : nullptr; - return pMods && pMods->Count() > 0; + return mpLib && !mpLib->GetModules().empty(); } // Methods XNameAccess @@ -1848,14 +1836,12 @@ uno::Any ModuleContainer_Impl::getByName( const OUString& aName ) uno::Sequence< OUString > ModuleContainer_Impl::getElementNames() throw(uno::RuntimeException, std::exception) { - SbxArray* pMods = mpLib ? mpLib->GetModules() : nullptr; - sal_uInt16 nMods = pMods ? pMods->Count() : 0; + sal_uInt16 nMods = mpLib ? mpLib->GetModules().size() : 0; uno::Sequence< OUString > aRetSeq( nMods ); OUString* pRetSeq = aRetSeq.getArray(); for( sal_uInt16 i = 0 ; i < nMods ; i++ ) { - SbxVariable* pMod = pMods->Get( i ); - pRetSeq[i] = OUString( pMod->GetName() ); + pRetSeq[i] = mpLib->GetModules()[i]->GetName(); } return aRetSeq; } |