diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-22 09:09:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-23 08:54:00 +0200 |
commit | 6cac364376785bfc82fabf7f9ae82c94d3b2825f (patch) | |
tree | 9582a98995be51c3ca5fd4fb95046b532092acd9 /l10ntools | |
parent | 154cffd87ee4a21b5c0c291f84c95d74cde2a143 (diff) |
clang-tidy modernize-pass-by-value in l10ntools
Change-Id: Icf07a0f3784f0f39fa6b141a24aa25fddab71901
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136272
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/inc/cfgmerge.hxx | 9 | ||||
-rw-r--r-- | l10ntools/inc/export.hxx | 4 | ||||
-rw-r--r-- | l10ntools/inc/helpmerge.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/lngmerge.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/propmerge.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/treemerge.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/xmlparse.hxx | 25 | ||||
-rw-r--r-- | l10ntools/inc/xrmmerge.hxx | 4 | ||||
-rw-r--r-- | l10ntools/source/cfgmerge.cxx | 10 | ||||
-rw-r--r-- | l10ntools/source/helpmerge.cxx | 5 | ||||
-rw-r--r-- | l10ntools/source/lngmerge.cxx | 5 | ||||
-rw-r--r-- | l10ntools/source/merge.cxx | 11 | ||||
-rw-r--r-- | l10ntools/source/propmerge.cxx | 7 | ||||
-rw-r--r-- | l10ntools/source/treemerge.cxx | 5 | ||||
-rw-r--r-- | l10ntools/source/xmlparse.cxx | 9 | ||||
-rw-r--r-- | l10ntools/source/xrmmerge.cxx | 9 |
16 files changed, 60 insertions, 51 deletions
diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx index 12e5cace11f2..a2f59e1e6e8f 100644 --- a/l10ntools/inc/cfgmerge.hxx +++ b/l10ntools/inc/cfgmerge.hxx @@ -25,6 +25,7 @@ #include <fstream> #include <unordered_map> #include <memory> +#include <utility> #include <vector> #include "po.hxx" #include "export.hxx" @@ -50,8 +51,8 @@ private: OStringHashMap sText; public: - CfgStackData(const OString &rTag, const OString &rId) - : sTagType( rTag ), sIdentifier( rId ) + CfgStackData(OString _sTag, OString _sId) + : sTagType(std::move( _sTag )), sIdentifier(std::move( _sId )) {} const OString &GetTagType() const { return sTagType; } @@ -145,7 +146,7 @@ protected: public: CfgExport( const OString &rOutputFile, - const OString &rFilePath + OString sFilePath ); virtual ~CfgExport() override; }; @@ -172,7 +173,7 @@ protected: public: CfgMerge( const OString &rMergeSource, const OString &rOutputFile, - const OString &rFilename, const OString &rLanguage ); + OString sFilename, const OString &rLanguage ); virtual ~CfgMerge() override; }; diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 3f46c552f575..251d059ac2c6 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -54,8 +54,8 @@ typedef std::unordered_map<OString, bool> class ResData { public: - ResData( const OString &rGId ); - ResData( const OString &rGId , const OString &rFilename ); + ResData( OString rGId ); + ResData( OString sGId , OString sFilename ); OString sResTyp; OString sId; diff --git a/l10ntools/inc/helpmerge.hxx b/l10ntools/inc/helpmerge.hxx index 9420f2356b2f..9da891e6b0f2 100644 --- a/l10ntools/inc/helpmerge.hxx +++ b/l10ntools/inc/helpmerge.hxx @@ -44,7 +44,7 @@ private: #endif public: - HelpParser( const OString &rHelpFile ); + HelpParser( OString sHelpFile ); /// Method append a PO file with the content of a parsed XML file /// @PRECOND rHelpFile is valid diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx index 7b60e4ff231b..430fdd13936f 100644 --- a/l10ntools/inc/lngmerge.hxx +++ b/l10ntools/inc/lngmerge.hxx @@ -50,7 +50,7 @@ private: static void WritePO(PoOfstream &aPOStream, OStringHashMap &rText_inout, const OString &rActFileName, const OString &rID); public: - LngParser(const OString &rLngFile); + LngParser(OString sLngFile); ~LngParser(); void CreatePO( const OString &rPOFile ); diff --git a/l10ntools/inc/propmerge.hxx b/l10ntools/inc/propmerge.hxx index 7e9eb594da2a..cc9764cccb06 100644 --- a/l10ntools/inc/propmerge.hxx +++ b/l10ntools/inc/propmerge.hxx @@ -30,7 +30,7 @@ private: public: PropParser( - const OString& rInputFile, const OString& rLang, + OString sInputFile, OString sLang, const bool bMergeMode ); ~PropParser(); diff --git a/l10ntools/inc/treemerge.hxx b/l10ntools/inc/treemerge.hxx index 8e87188d8b69..7f1a72fc7fe3 100644 --- a/l10ntools/inc/treemerge.hxx +++ b/l10ntools/inc/treemerge.hxx @@ -29,7 +29,7 @@ private: public: /// Parse tree file - TreeParser( const OString& rInputFile, const OString& rLang ); + TreeParser( const OString& rInputFile, OString sLang ); ~TreeParser(); bool isInitialized() const { return m_bIsInitialized; } diff --git a/l10ntools/inc/xmlparse.hxx b/l10ntools/inc/xmlparse.hxx index 9a8b1e673213..a1fc321c05ec 100644 --- a/l10ntools/inc/xmlparse.hxx +++ b/l10ntools/inc/xmlparse.hxx @@ -24,6 +24,8 @@ #include <cstddef> #include <memory> +#include <utility> +#include <utility> #include <vector> #include <expat.h> @@ -54,10 +56,10 @@ private: public: /// creates an attribute XMLAttribute( - const OString &rName, // attributes name - const OString &rValue // attributes data + OString _sName, // attributes name + OString _sValue // attributes data ) - : m_sName( rName ), m_sValue( rValue ) {} + : m_sName( std::move(_sName) ), m_sValue( std::move(_sValue) ) {} const OString& GetName() const { return m_sName; } const OString& GetValue() const { return m_sValue; } @@ -147,7 +149,7 @@ class XMLFile final : public XMLParentNode { public: XMLFile( - const OString &rFileName // the file name, empty if created from memory stream + OString sFileName // the file name, empty if created from memory stream ); XMLFile( const XMLFile& rObj ) ; virtual ~XMLFile() override; @@ -208,7 +210,7 @@ protected: public: /// create an element node XMLElement( - const OString &rName, // the element name + OString sName, // the element name XMLParentNode *pParent // parent node of this element ); @@ -243,10 +245,9 @@ private: public: /// create a data node XMLData( - const OString &rData, // the initial data + OString _sData, // the initial data XMLParentNode *pParent // the parent node of this data, typically an element node - ) - : XMLChildNode( pParent ), m_sData( rData ) {} + ) : XMLChildNode( pParent ), m_sData( std::move(_sData) ) {} // Default copy constructor and copy operator work well. @@ -269,10 +270,10 @@ private: public: /// create a comment node XMLComment( - const OString &rComment, // the comment + OString _sComment, // the comment XMLParentNode *pParent // the parent node of this comment, typically an element node ) - : XMLChildNode( pParent ), m_sComment( rComment ) {} + : XMLChildNode( pParent ), m_sComment( std::move(_sComment) ) {} // Default copy constructor and copy operator work well. @@ -292,10 +293,10 @@ private: public: /// create a comment node XMLDefault( - const OString &rDefault, // the comment + OString _sDefault, // the comment XMLParentNode *pParent // the parent node of this comment, typically an element node ) - : XMLChildNode( pParent ), m_sDefault( rDefault ) {} + : XMLChildNode( pParent ), m_sDefault( std::move(_sDefault) ) {} // Default copy constructor and copy operator work well. diff --git a/l10ntools/inc/xrmmerge.hxx b/l10ntools/inc/xrmmerge.hxx index 4225f44d12b8..65b19f7b9251 100644 --- a/l10ntools/inc/xrmmerge.hxx +++ b/l10ntools/inc/xrmmerge.hxx @@ -99,7 +99,7 @@ private: public: XRMResExport( const OString &rOutputFile, - const OString &rFilePath + OString sFilePath ); virtual ~XRMResExport() override; }; @@ -132,7 +132,7 @@ public: XRMResMerge( const OString &rMergeSource, const OString &rOutputFile, - const OString &rFilename + OString sFilename ); virtual ~XRMResMerge() override; }; diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index 9d6689fe8251..1e43f3e99394 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -32,6 +32,7 @@ #include <helper.hxx> #include <export.hxx> #include <cfgmerge.hxx> +#include <utility> #include <tokens.h> namespace { @@ -327,9 +328,8 @@ void CfgParser::Execute( int nToken, char * pToken ) CfgExport::CfgExport( const OString &rOutputFile, - const OString &rFilePath ) - - : sPath( rFilePath ) + OString sFilePath ) + : sPath(std::move( sFilePath )) { pOutputStream.open( rOutputFile, PoOfstream::APP ); if (!pOutputStream.isOpen()) @@ -386,8 +386,8 @@ void CfgExport::WorkOnText( CfgMerge::CfgMerge( const OString &rMergeSource, const OString &rOutputFile, - const OString &rFilename, const OString &rLanguage ) - : sFilename( rFilename ), + OString _sFilename, const OString &rLanguage ) + : sFilename(std::move( _sFilename )), bEnglish( false ) { pOutputStream.open( diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index 42cdb6ce19ab..abdc47d1c1d4 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -26,6 +26,7 @@ #include <stdio.h> #include <stdlib.h> #include <helpmerge.hxx> +#include <utility> #include <vector> #ifdef _WIN32 @@ -66,8 +67,8 @@ void HelpParser::Dump(LangHashMap* rElem_in,const OString & sKey_in) } #endif -HelpParser::HelpParser( const OString &rHelpFile ) - : sHelpFile( rHelpFile ) +HelpParser::HelpParser( OString _sHelpFile ) + : sHelpFile(std::move( _sHelpFile )) {}; /*****************************************************************************/ diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index 33d928dbe539..176cf46b6285 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -29,6 +29,7 @@ #include <common.hxx> #include <po.hxx> #include <lngmerge.hxx> +#include <utility> namespace { @@ -57,8 +58,8 @@ void lcl_RemoveUTF8ByteOrderMarker( OString &rString ) -LngParser::LngParser(const OString &rLngFile) - : sSource( rLngFile ) +LngParser::LngParser(OString sLngFile) + : sSource(std::move( sLngFile )) { std::ifstream aStream(sSource.getStr()); if (!aStream.is_open()) diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 588cb73d8614..263e3d588121 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -25,6 +25,7 @@ #include <fstream> #include <iostream> #include <string> +#include <utility> #include <vector> #include <export.hxx> @@ -65,17 +66,17 @@ namespace -ResData::ResData( const OString &rGId ) +ResData::ResData( OString _sGId ) : - sGId( rGId ) + sGId(std::move( _sGId )) { sGId = sGId.replaceAll("\r", OString()); } -ResData::ResData( const OString &rGId, const OString &rFilename) +ResData::ResData( OString _sGId, OString _sFilename) : - sGId( rGId ), - sFilename( rFilename ) + sGId(std::move( _sGId )), + sFilename(std::move( _sFilename )) { sGId = sGId.replaceAll("\r", OString()); } diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx index 7b74ab4d3cf8..c17519364443 100644 --- a/l10ntools/source/propmerge.cxx +++ b/l10ntools/source/propmerge.cxx @@ -20,6 +20,7 @@ #include <export.hxx> #include <common.hxx> #include <propmerge.hxx> +#include <utility> namespace { @@ -88,10 +89,10 @@ namespace //Open source file and store its lines PropParser::PropParser( - const OString& rInputFile, const OString& rLang, + OString _sInputFile, OString _sLang, const bool bMergeMode ) - : m_sSource( rInputFile ) - , m_sLang( rLang ) + : m_sSource(std::move( _sInputFile )) + , m_sLang(std::move( _sLang )) , m_bIsInitialized( false ) { std::ifstream aIfstream( m_sSource.getStr() ); diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx index 8e577f3dadbc..ff48aeda6b74 100644 --- a/l10ntools/source/treemerge.cxx +++ b/l10ntools/source/treemerge.cxx @@ -20,6 +20,7 @@ #include <common.hxx> #include <po.hxx> #include <treemerge.hxx> +#include <utility> namespace @@ -197,9 +198,9 @@ namespace } TreeParser::TreeParser( - const OString& rInputFile, const OString& rLang ) + const OString& rInputFile, OString _sLang ) : m_pSource( nullptr ) - , m_sLang( rLang ) + , m_sLang(std::move( _sLang )) , m_bIsInitialized( false ) { m_pSource = xmlParseFile( rInputFile.getStr() ); diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index 7e067f7f039b..b32ed4f5037a 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -23,6 +23,7 @@ #include <string_view> #include <helper.hxx> +#include <utility> #include <xmlparse.hxx> #include <fstream> #include <iostream> @@ -300,9 +301,9 @@ XMLFile::~XMLFile() } } -XMLFile::XMLFile( const OString &rFileName ) // the file name, empty if created from memory stream +XMLFile::XMLFile( OString _sFileName ) // the file name, empty if created from memory stream : XMLParentNode( nullptr ) - , m_sFileName( rFileName ) + , m_sFileName(std::move( _sFileName )) { m_aNodes_localize.emplace( OString("bookmark") , true ); m_aNodes_localize.emplace( OString("variable") , true ); @@ -531,11 +532,11 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur ) } XMLElement::XMLElement( - const OString &rName, // the element name + OString _sName, // the element name XMLParentNode *pParent // parent node of this element ) : XMLParentNode( pParent ) - , m_sElementName( rName ) + , m_sElementName(std::move( _sName )) { } diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index b7a7e0042c01..e48348bdb5b7 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -24,6 +24,7 @@ #include <common.hxx> #include <export.hxx> #include <po.hxx> +#include <utility> #include <xrmlex.hxx> #include <xrmmerge.hxx> #include <tokens.h> @@ -275,8 +276,8 @@ void XRMResParser::Error( const OString &rError ) XRMResExport::XRMResExport( - const OString &rOutputFile, const OString &rFilePath ) - : sPath( rFilePath ) + const OString &rOutputFile, OString _sFilePath ) + : sPath(std::move( _sFilePath )) { pOutputStream.open( rOutputFile, PoOfstream::APP ); if (!pOutputStream.isOpen()) @@ -346,8 +347,8 @@ void XRMResExport::EndOfText( XRMResMerge::XRMResMerge( const OString &rMergeSource, const OString &rOutputFile, - const OString &rFilename ) - : sFilename( rFilename ) + OString _sFilename ) + : sFilename(std::move( _sFilename )) { if (!rMergeSource.isEmpty() && sLanguage.equalsIgnoreAsciiCase("ALL")) { |