diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-28 14:12:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-29 08:53:22 +0200 |
commit | d3849255b76e92a42f653c266b88945708984c4f (patch) | |
tree | ff1eab21b9e5a1ea00e1573db4b4595ba51b0098 /basic | |
parent | f9b6bd6336b35de060f6f5bdd91517caf5e9a56e (diff) |
use more string_view in INetURLObject
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/basmgr/basicmanagerrepository.cxx | 5 | ||||
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 6 | ||||
-rw-r--r-- | basic/source/inc/namecont.hxx | 4 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 2 | ||||
-rw-r--r-- | basic/source/uno/namecont.cxx | 31 |
5 files changed, 25 insertions, 23 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 3a0405f472d0..0b34621bfcb8 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> #include <com/sun/star/frame/Desktop.hpp> +#include <o3tl/string_view.hxx> #include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> #include <unotools/pathoptions.hxx> @@ -284,7 +285,7 @@ namespace basic // The first dir in the path as destination: OUString aFileName( aAppBasic.getName() ); - aAppBasic = INetURLObject( aAppBasicDir.getToken(1, ';') ); + aAppBasic = INetURLObject( o3tl::getToken(aAppBasicDir, 1, ';') ); DBG_ASSERT(aAppBasic.GetProtocol() != INetProtocol::NotValid, OString("Invalid URL: \"" + OUStringToOString(aAppBasicDir, osl_getThreadTextEncoding()) + @@ -430,7 +431,7 @@ namespace basic // Storage and BaseURL are only needed by binary documents! tools::SvRef<SotStorage> xDummyStor = new SotStorage( OUString() ); - _out_rpBasicManager.reset(new BasicManager( *xDummyStor, OUString() /* TODO/LATER: xStorage */, + _out_rpBasicManager.reset(new BasicManager( *xDummyStor, u"" /* TODO/LATER: xStorage */, pAppBasic, &aAppBasicDir, true )); if ( !_out_rpBasicManager->GetErrors().empty() ) diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 013c5eec851f..fec7e5eaa496 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -421,7 +421,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream ) return pInfo; } -BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib, OUString const * pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr ) +BasicManager::BasicManager( SotStorage& rStorage, std::u16string_view rBaseURL, StarBASIC* pParentFromStdLib, OUString const * pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr ) { if( pLibPath ) { @@ -630,7 +630,7 @@ void BasicManager::ImpCreateStdLib( StarBASIC* pParentFromStdLib ) pStdLib->SetFlag( SbxFlagBits::DontStore | SbxFlagBits::ExtSearch ); } -void BasicManager::LoadBasicManager( SotStorage& rStorage, const OUString& rBaseURL ) +void BasicManager::LoadBasicManager( SotStorage& rStorage, std::u16string_view rBaseURL ) { tools::SvRef<SotStorageStream> xManagerStream = rStorage.OpenSotStream( szManagerStream, eStreamReadMode ); @@ -648,7 +648,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const OUString& rBase OUString aRealStorageName = maStorageName; // for relative paths, can be modified through BaseURL - if ( !rBaseURL.isEmpty() ) + if ( !rBaseURL.empty() ) { INetURLObject aObj( rBaseURL ); if ( aObj.GetProtocol() == INetProtocol::File ) diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 5be51b159e95..56f660e52c30 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -224,7 +224,7 @@ protected: void implStoreLibrary( SfxLibrary* pLib, std::u16string_view rName, const css::uno::Reference< css::embed::XStorage >& rStorage, - const OUString& rTargetURL, + std::u16string_view rTargetURL, const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& rToUseSFI, const css::uno::Reference< css::task::XInteractionHandler >& rHandler ); @@ -234,7 +234,7 @@ protected: // New variant for library export void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib, const css::uno::Reference< css::embed::XStorage >& xStorage, - const OUString& aTargetURL, + std::u16string_view aTargetURL, const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& rToUseSFI ); bool implLoadLibraryIndexFile( SfxLibrary* pLib, diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 17b6092a3278..972038744dae 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2582,7 +2582,7 @@ static bool implCheckWildcard(std::u16string_view rName, SbiRTLData const& rRTLD } -static bool isRootDir( const OUString& aDirURLStr ) +static bool isRootDir( std::u16string_view aDirURLStr ) { INetURLObject aDirURLObj( aDirURLStr ); bool bRoot = false; diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index f7eae5d4ef08..d9a479b7bb99 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/ucb/ContentCreationException.hpp> #include <com/sun/star/xml/sax/SAXException.hpp> #include <vcl/svapp.hxx> +#include <o3tl/string_view.hxx> #include <osl/mutex.hxx> #include <vcl/errinf.hxx> #include <rtl/ustring.hxx> @@ -733,11 +734,11 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, { if( nPass == 1 ) { - pLibInfoInetObj.reset(new INetURLObject( maLibraryPath.getToken(0, ';') )); + pLibInfoInetObj.reset(new INetURLObject( o3tl::getToken(maLibraryPath, 0, ';') )); } else { - pLibInfoInetObj.reset(new INetURLObject( maLibraryPath.getToken(1, ';') )); + pLibInfoInetObj.reset(new INetURLObject( o3tl::getToken(maLibraryPath, 1, ';') )); } pLibInfoInetObj->insertName( maInfoFileName, false, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); pLibInfoInetObj->setExtension( u"xlc" ); @@ -757,7 +758,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, // Old variant? if( !xInput.is() && nPass == 0 ) { - INetURLObject aLibInfoInetObj( maLibraryPath.getToken(1, ';') ); + INetURLObject aLibInfoInetObj( o3tl::getToken(maLibraryPath, 1, ';') ); aLibInfoInetObj.insertName( maOldInfoFileName, false, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); aLibInfoInetObj.setExtension( u"xli" ); aFileName = aLibInfoInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); @@ -830,7 +831,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, else if( rLib.bLink ) { // Check "share" path - INetURLObject aShareInetObj( maLibraryPath.getToken(0, ';') ); + INetURLObject aShareInetObj( o3tl::getToken(maLibraryPath, 0, ';') ); aShareInetObj.insertName( rLib.aName, true, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); OUString aShareLibDirPath = aShareInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); @@ -972,7 +973,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, if( meInitMode != DEFAULT ) return; - INetURLObject aUserBasicInetObj( maLibraryPath.getToken(1, ';') ); + INetURLObject aUserBasicInetObj( o3tl::getToken(maLibraryPath, 1, ';') ); OUString aStandardStr("Standard"); INetURLObject aPrevUserBasicInetObj_1( aUserBasicInetObj ); @@ -1320,7 +1321,7 @@ OUString SfxLibraryContainer::createAppLibraryFolder( SfxLibrary* pLib, std::u16 OUString aLibDirPath = pLib->maStorageURL; if( aLibDirPath.isEmpty() ) { - INetURLObject aInetObj( maLibraryPath.getToken(1, ';') ); + INetURLObject aInetObj( o3tl::getToken(maLibraryPath, 1, ';') ); aInetObj.insertName( aName, true, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); checkStorageURL( aInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), pLib->maLibInfoFileURL, pLib->maStorageURL, pLib->maUnexpandedStorageURL ); @@ -1347,14 +1348,14 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib, { Reference< XSimpleFileAccess3 > xDummySFA; Reference< XInteractionHandler > xDummyHandler; - implStoreLibrary( pLib, aName, xStorage, OUString(), xDummySFA, xDummyHandler ); + implStoreLibrary( pLib, aName, xStorage, u"", xDummySFA, xDummyHandler ); } // New variant for library export void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib, std::u16string_view aName, const uno::Reference< embed::XStorage >& xStorage, - const OUString& aTargetURL, + std::u16string_view aTargetURL, const Reference< XSimpleFileAccess3 >& rToUseSFI, const Reference< XInteractionHandler >& xHandler ) { @@ -1415,7 +1416,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib, else { // Export? - bool bExport = !aTargetURL.isEmpty(); + bool bExport = !aTargetURL.empty(); try { Reference< XSimpleFileAccess3 > xSFI = mxSFI; @@ -1499,14 +1500,14 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib, const uno::Reference< embed::XStorage >& xStorage ) { Reference< XSimpleFileAccess3 > xDummySFA; - implStoreLibraryIndexFile( pLib, rLib, xStorage, OUString(), xDummySFA ); + implStoreLibraryIndexFile( pLib, rLib, xStorage, u"", xDummySFA ); } // New variant for library export void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage, - const OUString& aTargetURL, + std::u16string_view aTargetURL, const Reference< XSimpleFileAccess3 >& rToUseSFI ) { // Create sax writer @@ -1548,7 +1549,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib, else { // Export? - bool bExport = !aTargetURL.isEmpty(); + bool bExport = !aTargetURL.empty(); Reference< XSimpleFileAccess3 > xSFI = mxSFI; if( rToUseSFI.is() ) { @@ -2053,7 +2054,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto else { // Create Output stream - INetURLObject aLibInfoInetObj( maLibraryPath.getToken(1, ';') ); + INetURLObject aLibInfoInetObj( o3tl::getToken(maLibraryPath, 1, ';') ); aLibInfoInetObj.insertName( maInfoFileName, false, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); aLibInfoInetObj.setExtension( u"xlc" ); OUString aLibInfoPath( aLibInfoInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); @@ -2244,7 +2245,7 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name ) catch(const Exception& ) {} // Delete folder if empty - INetURLObject aInetObj( maLibraryPath.getToken(1, ';') ); + INetURLObject aInetObj( o3tl::getToken(maLibraryPath, 1, ';') ); aInetObj.insertName( Name, true, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); OUString aLibDirPath = aInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); @@ -2501,7 +2502,7 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU OUString aLibDirPath = pImplLib->maStorageURL; - INetURLObject aDestInetObj( maLibraryPath.getToken(1, ';')); + INetURLObject aDestInetObj( o3tl::getToken(maLibraryPath, 1, ';')); aDestInetObj.insertName( NewName, true, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); OUString aDestDirPath = aDestInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); |