diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-13 13:54:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-13 16:11:27 +0200 |
commit | 74957c7d2f3697fbf2b6f4d6a31c61d5d7df039b (patch) | |
tree | 97e7ac347319d09d6555afb97b0b7166436720b7 /l10ntools | |
parent | e8c2ae74ea433d9d75baf7ff8a349a0c86ace657 (diff) |
use more string_view in l10ntools
Change-Id: I93958e8e2dc1e172413ff697d6b6be975cff064d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132956
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/inc/export.hxx | 6 | ||||
-rw-r--r-- | l10ntools/inc/po.hxx | 2 | ||||
-rw-r--r-- | l10ntools/source/helpex.cxx | 2 | ||||
-rw-r--r-- | l10ntools/source/localize.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/merge.cxx | 16 | ||||
-rw-r--r-- | l10ntools/source/po.cxx | 6 |
6 files changed, 20 insertions, 20 deletions
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 64091d6cc5b8..3f46c552f575 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -120,11 +120,11 @@ class MergeDataFile void InsertEntry(std::string_view rTYP, std::string_view rGID, std::string_view rLID, const OString &nLang, const OString &rTEXT, const OString &rQHTEXT, - const OString &rTITLE, const OString &sFilename, + const OString &rTITLE, std::string_view sFilename, bool bFirstLang, bool bCaseSensitive); public: explicit MergeDataFile( - const OString &rFileName, const OString& rFile, + const OString &rFileName, std::string_view rFile, bool bCaseSensitive, bool bWithQtz = true ); ~MergeDataFile(); @@ -135,7 +135,7 @@ class MergeDataFile MergeEntrys *GetMergeEntrysCaseSensitive( ResData *pResData ); static OString CreateKey(std::string_view rTYP, std::string_view rGID, - std::string_view rLID, const OString& rFilename, bool bCaseSensitive); + std::string_view rLID, std::string_view rFilename, bool bCaseSensitive); }; diff --git a/l10ntools/inc/po.hxx b/l10ntools/inc/po.hxx index 8267525133b7..9b33d2b7788e 100644 --- a/l10ntools/inc/po.hxx +++ b/l10ntools/inc/po.hxx @@ -46,7 +46,7 @@ public: enum Exception { NOSOURCFILE, NORESTYPE, NOGROUPID, NOSTRING, WRONGHELPTEXT }; PoEntry(); - PoEntry( const OString& rSourceFile, std::string_view rResType, std::string_view rGroupId, + PoEntry( std::string_view rSourceFile, std::string_view rResType, std::string_view rGroupId, std::string_view rLocalId, std::string_view rHelpText, const OString& rText, const TYPE eType ); ~PoEntry(); diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx index e9f744a95bbc..97e574fc7dde 100644 --- a/l10ntools/source/helpex.cxx +++ b/l10ntools/source/helpex.cxx @@ -81,7 +81,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) std::unique_ptr<MergeDataFile> pMergeDataFile; if( aArgs.m_sLanguage != "qtz") { - pMergeDataFile.reset(new MergeDataFile(aArgs.m_sMergeSrc, OString(), false, false )); + pMergeDataFile.reset(new MergeDataFile(aArgs.m_sMergeSrc, "", false, false )); } std::string sTemp; aInput >> sTemp; diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index d89f89150d04..2ec0123616f4 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -116,7 +116,7 @@ void handleCommand( } void InitPoFile( - std::string_view rProject, const OString& rInPath, + std::string_view rProject, std::string_view rInPath, std::string_view rPotDir, const OString& rOutPath ) { //Create directory for po file @@ -150,9 +150,9 @@ void InitPoFile( throw false; //TODO } - const sal_Int32 nProjectInd = rInPath.indexOf(rProject); - const OString relativPath = - rInPath.copy(nProjectInd, rInPath.lastIndexOf('/')- nProjectInd); + const size_t nProjectInd = rInPath.find(rProject); + const std::string_view relativPath = + rInPath.substr(nProjectInd, rInPath.rfind('/')- nProjectInd); PoHeader aTmp(relativPath); aPoOutPut.writeHeader(aTmp); diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 78334c70c8fe..8a6964c61fa4 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -32,12 +32,12 @@ namespace { - OString lcl_NormalizeFilename(const OString& rFilename) + OString lcl_NormalizeFilename(std::string_view rFilename) { - return rFilename.copy( + return OString(rFilename.substr( std::max( - rFilename.lastIndexOf( '\\' ), - rFilename.lastIndexOf( '/' ))+1); + rFilename.rfind( '\\' ), + rFilename.rfind( '/' ))+1)); }; bool lcl_ReadPoChecked( @@ -111,7 +111,7 @@ OString MergeEntrys::GetQTZText(const ResData& rResData, std::string_view rOrigT MergeDataFile::MergeDataFile( - const OString &rFileName, const OString &rFile, + const OString &rFileName, std::string_view rFile, bool bCaseSensitive, bool bWithQtz ) { auto const env = getenv("ENABLE_RELEASE_BUILD"); @@ -281,7 +281,7 @@ void MergeDataFile::InsertEntry( std::string_view rTYP, std::string_view rGID, std::string_view rLID, const OString &nLANG, const OString &rTEXT, const OString &rQHTEXT, - const OString &rTITLE, const OString &rInFilename, + const OString &rTITLE, std::string_view rInFilename, bool bFirstLang, bool bCaseSensitive ) { MergeEntrys *pMergeEntrys = nullptr; @@ -311,7 +311,7 @@ void MergeDataFile::InsertEntry( // insert the cur string if( nLANG =="qtz" ) { - const OString sTemp = rInFilename + rGID + rLID + rTYP; + const OString sTemp = OString::Concat(rInFilename) + rGID + rLID + rTYP; pMergeEntrys->InsertEntry( nLANG, rTEXT.isEmpty()? rTEXT : PoEntry::genKeyId(sTemp + rTEXT) + GetDoubleBars() + rTEXT, @@ -325,7 +325,7 @@ void MergeDataFile::InsertEntry( } OString MergeDataFile::CreateKey(std::string_view rTYP, std::string_view rGID, - std::string_view rLID, const OString& rFilename, bool bCaseSensitive) + std::string_view rLID, std::string_view rFilename, bool bCaseSensitive) { static const char sStroke[] = "-"; OString sKey = OString::Concat(rTYP) + sStroke + rGID + sStroke + rLID + sStroke + diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx index 2bf522d4b05e..b93126838c99 100644 --- a/l10ntools/source/po.cxx +++ b/l10ntools/source/po.cxx @@ -240,12 +240,12 @@ PoEntry::PoEntry() } PoEntry::PoEntry( - const OString& rSourceFile, std::string_view rResType, std::string_view rGroupId, + std::string_view rSourceFile, std::string_view rResType, std::string_view rGroupId, std::string_view rLocalId, std::string_view rHelpText, const OString& rText, const TYPE eType ) : m_bIsInitialized( false ) { - if( rSourceFile.isEmpty() ) + if( rSourceFile.empty() ) throw NOSOURCFILE; else if ( rResType.empty() ) throw NORESTYPE; @@ -257,7 +257,7 @@ PoEntry::PoEntry( throw WRONGHELPTEXT; m_pGenPo.reset( new GenPoEntry() ); - OString sReference = rSourceFile.copy(rSourceFile.lastIndexOf('/')+1); + OString sReference(rSourceFile.substr(rSourceFile.rfind('/')+1)); m_pGenPo->setReference(sReference); OString sMsgCtxt = |