From 966d9757de471f2a5ea1ffa87cef019dcf1e0cb3 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 21 Jun 2022 09:05:15 +0200 Subject: [PATCH] clang-tidy modernize-pass-by-value in helpcompiler Change-Id: Ia074fb5be66486e56af2540a978e72c954485e42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136205 Tested-by: Jenkins Reviewed-by: Noel Grandin --- helpcompiler/inc/HelpCompiler.hxx | 25 +++++++++++++------------ helpcompiler/source/HelpCompiler.cxx | 19 ++++++++++--------- helpcompiler/source/HelpIndexer.cxx | 5 +++-- include/helpcompiler/HelpIndexer.hxx | 2 +- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx index 541f4bc078e5..c66e705ae222 100644 --- a/helpcompiler/inc/HelpCompiler.hxx +++ b/helpcompiler/inc/HelpCompiler.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -162,15 +163,15 @@ struct HelpProcessingException std::string m_aXMLParsingFile; int m_nXMLParsingLine; - HelpProcessingException( HelpProcessingErrorClass eErrorClass, const std::string& aErrorMsg ) + HelpProcessingException( HelpProcessingErrorClass eErrorClass, std::string aErrorMsg ) : m_eErrorClass( eErrorClass ) - , m_aErrorMsg( aErrorMsg ) + , m_aErrorMsg(std::move( aErrorMsg )) , m_nXMLParsingLine( 0 ) {} - HelpProcessingException( const std::string& aErrorMsg, const std::string& aXMLParsingFile, int nXMLParsingLine ) + HelpProcessingException( std::string aErrorMsg, std::string aXMLParsingFile, int nXMLParsingLine ) : m_eErrorClass( HelpProcessingErrorClass::XmlParsing ) - , m_aErrorMsg( aErrorMsg ) - , m_aXMLParsingFile( aXMLParsingFile ) + , m_aErrorMsg(std::move( aErrorMsg )) + , m_aXMLParsingFile(std::move( aXMLParsingFile )) , m_nXMLParsingLine( nXMLParsingLine ) {} }; @@ -179,13 +180,13 @@ class HelpCompiler { public: HelpCompiler(StreamTable &streamTable, - const fs::path &in_inputFile, - const fs::path &in_src, - const fs::path &in_zipdir, - const fs::path &in_resCompactStylesheet, - const fs::path &in_resEmbStylesheet, - const std::string &in_module, - const std::string &in_lang, + fs::path in_inputFile, + fs::path in_src, + fs::path in_zipdir, + fs::path in_resCompactStylesheet, + fs::path in_resEmbStylesheet, + std::string in_module, + std::string in_lang, bool in_bExtensionMode); /// @throws HelpProcessingException /// @throws BasicCodeTagger::TaggerException diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx index ee4a27461afa..b2329c0678f7 100644 --- a/helpcompiler/source/HelpCompiler.cxx +++ b/helpcompiler/source/HelpCompiler.cxx @@ -29,14 +29,15 @@ #include #include #include +#include -HelpCompiler::HelpCompiler(StreamTable &in_streamTable, const fs::path &in_inputFile, - const fs::path &in_src, const fs::path &in_zipdir, const fs::path &in_resCompactStylesheet, - const fs::path &in_resEmbStylesheet, const std::string &in_module, const std::string &in_lang, +HelpCompiler::HelpCompiler(StreamTable &in_streamTable, fs::path in_inputFile, + fs::path in_src, fs::path in_zipdir, fs::path in_resCompactStylesheet, + fs::path in_resEmbStylesheet, std::string in_module, std::string in_lang, bool in_bExtensionMode) - : streamTable(in_streamTable), inputFile(in_inputFile), - src(in_src), zipdir(in_zipdir), module(in_module), lang(in_lang), resCompactStylesheet(in_resCompactStylesheet), - resEmbStylesheet(in_resEmbStylesheet), bExtensionMode( in_bExtensionMode ) + : streamTable(in_streamTable), inputFile(std::move(in_inputFile)), + src(std::move(in_src)), zipdir(std::move(in_zipdir)), module(std::move(in_module)), lang(std::move(in_lang)), resCompactStylesheet(std::move(in_resCompactStylesheet)), + resEmbStylesheet(std::move(in_resEmbStylesheet)), bExtensionMode( in_bExtensionMode ) { xmlKeepBlanksDefaultValue = 0; char* os = getenv("OS"); @@ -239,9 +240,9 @@ public: private: std::vector extendedHelpText; public: - myparser(const std::string &indocumentId, const std::string &infileName, - const std::string &intitle) : documentId(indocumentId), fileName(infileName), - title(intitle) + myparser(std::string indocumentId, std::string infileName, + std::string intitle) : documentId(std::move(indocumentId)), fileName(std::move(infileName)), + title(std::move(intitle)) { hidlist.reset(new std::vector); keywords.reset(new Hashtable); diff --git a/helpcompiler/source/HelpIndexer.cxx b/helpcompiler/source/HelpIndexer.cxx index 38ddd06472bd..fc6da05f1d56 100644 --- a/helpcompiler/source/HelpIndexer.cxx +++ b/helpcompiler/source/HelpIndexer.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include "LuceneHelper.hxx" #include @@ -29,9 +30,9 @@ using namespace lucene::document; -HelpIndexer::HelpIndexer(OUString const &lang, OUString const &module, +HelpIndexer::HelpIndexer(OUString lang, OUString module, std::u16string_view srcDir, std::u16string_view outDir) - : d_lang(lang), d_module(module) + : d_lang(std::move(lang)), d_module(std::move(module)) { d_indexDir = outDir + OUStringChar('/') + module + ".idxl"; d_captionDir = OUString::Concat(srcDir) + "/caption"; diff --git a/include/helpcompiler/HelpIndexer.hxx b/include/helpcompiler/HelpIndexer.hxx index 2f8e7f32293a..d9e639f791e3 100644 --- a/include/helpcompiler/HelpIndexer.hxx +++ b/include/helpcompiler/HelpIndexer.hxx @@ -48,7 +48,7 @@ class L10N_DLLPUBLIC HelpIndexer { * @param srcDir The help directory to index * @param outDir The directory to write the "module".idxl directory to */ - HelpIndexer(OUString const &lang, OUString const &module, + HelpIndexer(OUString lang, OUString module, std::u16string_view srcDir, std::u16string_view outDir); /**