Patches
Yuriy Skalko
yuriy.skalko at gmail.com
Sun Nov 1 16:08:47 UTC 2020
And the last 10 refactoring patches from me.
Yuriy
-------------- next part --------------
From 064739fd7d368b9ba31e1b6cfbc3b482d2ea655f Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sat, 31 Oct 2020 17:13:52 +0200
Subject: [PATCH 01/10] Simplify with std::map::insert
---
src/Buffer.cpp | 4 +---
src/frontends/qt/GuiSymbols.cpp | 7 ++-----
src/output_latex.cpp | 3 +--
src/tex2lyx/Preamble.cpp | 3 +--
4 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index d25aa03fb8..940f30cd1c 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3773,9 +3773,7 @@ void Buffer::Impl::updateMacros(DocIterator & it, DocIterator & scope)
// register its position, but only when it is
// included first in the buffer
- if (children_positions.find(child) ==
- children_positions.end())
- children_positions[child] = it;
+ children_positions.insert({child, it});
// register child with its scope
position_to_children[it] = Impl::ScopeBuffer(scope, child);
diff --git a/src/frontends/qt/GuiSymbols.cpp b/src/frontends/qt/GuiSymbols.cpp
index 4a6b0d6178..050584a567 100644
--- a/src/frontends/qt/GuiSymbols.cpp
+++ b/src/frontends/qt/GuiSymbols.cpp
@@ -473,11 +473,8 @@ void GuiSymbols::updateSymbolList(bool update_combo)
++numItem;
if (show_all || (c >= range_start && c <= range_end))
s.append(c);
- if (update_combo) {
- QString block = getBlock(c);
- if (used_blocks.find(block) == used_blocks.end())
- used_blocks[block] = numItem;
- }
+ if (update_combo)
+ used_blocks.insert({getBlock(c), numItem});
}
model_->setSymbols(s, enc);
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index ea474dfa6e..97a5077bb5 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -600,8 +600,7 @@ void addArgInsets(Paragraph const & par, string const & prefix,
string const name = prefix.empty() ?
arg->name() : split(arg->name(), ':');
size_t const nr = convert<size_t>(name);
- if (ilist.find(nr) == ilist.end())
- ilist[nr] = arg;
+ ilist.insert({nr, arg});
Layout::LaTeXArgMap::const_iterator const lit =
latexargs.find(arg->name());
if (lit != latexargs.end()) {
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index b8cf6869a5..ebaa2f02b5 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -445,8 +445,7 @@ int Preamble::getSpecialTableColumnArguments(char c) const
void Preamble::add_package(string const & name, vector<string> & options)
{
// every package inherits the global options
- if (used_packages.find(name) == used_packages.end())
- used_packages[name] = split_options(h_options);
+ used_packages.insert({name, split_options(h_options)});
// Insert options passed via PassOptionsToPackage
for (auto const & p : extra_package_options_) {
--
2.28.0.windows.1
-------------- next part --------------
From 1625d5bee982579c2a5c36eab7689982b86c4048 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Fri, 30 Oct 2020 23:27:44 +0200
Subject: [PATCH 02/10] Use default member initialization in InsetLayout
---
src/insets/InsetLayout.cpp | 19 -----------
src/insets/InsetLayout.h | 70 +++++++++++++++++++-------------------
2 files changed, 35 insertions(+), 54 deletions(-)
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 9d39c94bf7..64f361dbdd 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -32,25 +32,6 @@ using namespace lyx::support;
namespace lyx {
-InsetLayout::InsetLayout() :
- name_(from_ascii("undefined")), lyxtype_(STANDARD),
- labelstring_(from_ascii("UNDEFINED")), contentaslabel_(false),
- decoration_(DEFAULT), latextype_(NOLATEXTYPE), font_(inherit_font),
- labelfont_(sane_font), bgcolor_(Color_error),
- fixedwidthpreambleencoding_(false), htmlforcecss_ (false),
- htmlisblock_(true), docbooksection_(false), multipar_(true),
- custompars_(true), forceplain_(false), passthru_(false),
- parbreakisnewline_(false), parbreakignored_(false), freespacing_(false),
- keepempty_(false), forceltr_(false), forceownlines_(false),
- needprotect_(false), needcprotect_(false), needmboxprotect_(false),
- intoc_(false), spellcheck_(true), resetsfont_(false), display_(true),
- forcelocalfontswitch_(false), add_to_toc_(false), is_toc_caption_(false),
- edit_external_(false)
-{
- labelfont_.setColor(Color_error);
-}
-
-
InsetLayout::InsetDecoration translateDecoration(std::string const & str)
{
if (compare_ascii_no_case(str, "classic") == 0)
diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h
index 27b6cc119f..2dea79078a 100644
--- a/src/insets/InsetLayout.h
+++ b/src/insets/InsetLayout.h
@@ -31,7 +31,7 @@ class TextClass;
class InsetLayout {
public:
///
- InsetLayout();
+ InsetLayout() { labelfont_.setColor(Color_error); }
///
enum InsetDecoration {
CLASSIC,
@@ -222,23 +222,23 @@ private:
///
void readArgument(Lexer &);
///
- docstring name_;
+ docstring name_ = from_ascii("undefined");
/**
* This is only used (at present) to decide where to put them on the menus.
* Values are 'charstyle', 'custom' (things that by default look like a
* footnote), 'standard'.
*/
- InsetLyXType lyxtype_;
+ InsetLyXType lyxtype_ = STANDARD;
///
- docstring labelstring_;
+ docstring labelstring_ = from_ascii("UNDEFINED");
///
docstring menustring_;
///
- bool contentaslabel_;
+ bool contentaslabel_ = false;
///
- InsetDecoration decoration_;
+ InsetDecoration decoration_ = DEFAULT;
///
- InsetLaTeXType latextype_;
+ InsetLaTeXType latextype_ = NOLATEXTYPE;
///
std::string latexname_;
///
@@ -248,11 +248,11 @@ private:
///
docstring rightdelim_;
///
- FontInfo font_;
+ FontInfo font_ = inherit_font;
///
- FontInfo labelfont_;
+ FontInfo labelfont_ = sane_font;
///
- ColorCode bgcolor_;
+ ColorCode bgcolor_ = Color_error;
///
docstring counter_;
///
@@ -262,7 +262,7 @@ private:
/// Language and babel dependent macro definitions needed for this inset
docstring babelpreamble_;
///
- bool fixedwidthpreambleencoding_;
+ bool fixedwidthpreambleencoding_ = false;
///
docstring refprefix_;
///
@@ -283,11 +283,11 @@ private:
mutable std::string defaultcssclass_;
/// Whether to force generation of default CSS even if some is given.
/// False by default.
- bool htmlforcecss_;
+ bool htmlforcecss_ = false;
///
docstring htmlpreamble_;
///
- bool htmlisblock_;
+ bool htmlisblock_ = true;
///
std::string docbooktag_;
///
@@ -295,7 +295,7 @@ private:
///
std::string docbookattr_;
///
- bool docbooksection_;
+ bool docbooksection_ = false;
///
std::string docbookwrappertag_;
///
@@ -305,45 +305,45 @@ private:
///
std::set<std::string> required_;
///
- bool multipar_;
+ bool multipar_ = true;
///
- bool custompars_;
+ bool custompars_ = true;
///
- bool forceplain_;
+ bool forceplain_ = false;
///
- bool passthru_;
+ bool passthru_ = false;
///
docstring passthru_chars_;
///
std::string newline_cmd_;
///
- bool parbreakisnewline_;
+ bool parbreakisnewline_ = false;
///
- bool parbreakignored_;
+ bool parbreakignored_ = false;
///
- bool freespacing_;
+ bool freespacing_ = false;
///
- bool keepempty_;
+ bool keepempty_ = false;
///
- bool forceltr_;
+ bool forceltr_ = false;
///
- bool forceownlines_;
+ bool forceownlines_ = false;
///
- bool needprotect_;
+ bool needprotect_ = false;
///
- bool needcprotect_;
+ bool needcprotect_ = false;
///
- bool needmboxprotect_;
+ bool needmboxprotect_ = false;
/// should the contents be written to TOC strings?
- bool intoc_;
+ bool intoc_ = false;
/// check spelling of this inset?
- bool spellcheck_;
+ bool spellcheck_ = true;
///
- bool resetsfont_;
+ bool resetsfont_ = false;
///
- bool display_;
+ bool display_ = true;
///
- bool forcelocalfontswitch_;
+ bool forcelocalfontswitch_ = false;
/** Name of an insetlayout that has replaced this insetlayout.
This is used to rename an insetlayout, while keeping backward
compatibility
@@ -354,13 +354,13 @@ private:
///
Layout::LaTeXArgMap postcommandargs_;
///
- bool add_to_toc_;
+ bool add_to_toc_ = false;
///
std::string toc_type_;
///
- bool is_toc_caption_;
+ bool is_toc_caption_ = false;
///
- bool edit_external_;
+ bool edit_external_ = false;
};
///
--
2.28.0.windows.1
-------------- next part --------------
From 3bbaedcd6bcb7bb22baa3511e19345292919b796 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sat, 31 Oct 2020 15:09:46 +0200
Subject: [PATCH 03/10] Use const references
---
src/Buffer.cpp | 11 +++++------
src/BufferView.cpp | 2 +-
src/Compare.cpp | 2 +-
src/LaTeX.cpp | 6 ++----
src/Language.cpp | 2 +-
src/Layout.cpp | 2 +-
src/ParagraphParameters.cpp | 2 +-
src/ParagraphParameters.h | 2 +-
src/Text3.cpp | 2 +-
src/TextClass.cpp | 1 +
src/Thesaurus.cpp | 3 ++-
src/factory.cpp | 4 ++--
src/frontends/qt/GuiApplication.cpp | 2 +-
src/frontends/qt/GuiApplication.h | 2 +-
src/frontends/qt/GuiCitation.cpp | 4 ++--
src/frontends/qt/GuiCitation.h | 4 ++--
src/frontends/qt/GuiClipboard.cpp | 2 +-
src/frontends/qt/GuiCompare.cpp | 2 +-
src/frontends/qt/GuiCompare.h | 2 +-
src/frontends/qt/GuiDelimiter.cpp | 4 ++--
src/frontends/qt/GuiDocument.cpp | 2 +-
src/frontends/qt/GuiLyXFiles.cpp | 4 ++--
src/frontends/qt/GuiPainter.cpp | 2 +-
src/frontends/qt/GuiPrefs.cpp | 6 +++---
src/frontends/qt/GuiPrefs.h | 6 +++---
src/frontends/qt/GuiRef.cpp | 4 ++--
src/frontends/qt/GuiTabularCreate.cpp | 2 +-
src/frontends/qt/GuiWorkArea.cpp | 2 +-
src/frontends/qt/GuiWorkArea.h | 2 +-
src/frontends/qt/Menus.cpp | 4 ++--
src/frontends/qt/TocWidget.cpp | 2 +-
src/insets/InsetBibtex.cpp | 3 ++-
src/insets/InsetCommand.cpp | 2 +-
src/insets/InsetRef.cpp | 2 +-
src/insets/InsetTabular.cpp | 2 +-
src/insets/InsetText.cpp | 4 ++--
src/insets/InsetText.h | 2 +-
src/mathed/InsetMathGrid.cpp | 2 +-
src/mathed/InsetMathGrid.h | 2 +-
src/mathed/InsetMathRoot.cpp | 4 ++--
src/mathed/MathParser.cpp | 2 +-
src/support/debug.h | 2 +-
src/support/docstream.cpp | 4 ++--
src/support/docstream.h | 4 ++--
src/support/filetools.cpp | 2 +-
src/support/filetools.h | 2 +-
src/tex2lyx/Parser.cpp | 2 +-
src/tex2lyx/Parser.h | 2 +-
src/tex2lyx/tex2lyx.cpp | 2 +-
src/tex2lyx/text.cpp | 16 ++++++++--------
50 files changed, 79 insertions(+), 79 deletions(-)
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 940f30cd1c..64a3daa4aa 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1183,9 +1183,8 @@ bool Buffer::readString(string const & s)
Buffer::ReadStatus Buffer::readFile(FileName const & fn)
{
- FileName fname(fn);
Lexer lex;
- if (!lex.setFile(fname)) {
+ if (!lex.setFile(fn)) {
Alert::error(_("File Not Found"),
bformat(_("Unable to open file `%1$s'."),
from_utf8(fn.absFileName())));
@@ -2702,7 +2701,7 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
break;
case LFUN_BUFFER_EXPORT: {
- docstring const arg = cmd.argument();
+ docstring const & arg = cmd.argument();
if (arg == "custom") {
enable = true;
break;
@@ -2731,7 +2730,7 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|| cmd.action() == LFUN_BRANCH_MASTER_DEACTIVATE);
BranchList const & branchList = master ? masterBuffer()->params().branchlist()
: params().branchlist();
- docstring const branchName = cmd.argument();
+ docstring const & branchName = cmd.argument();
flag.setEnabled(!branchName.empty() && branchList.find(branchName));
break;
}
@@ -2893,7 +2892,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
Buffer * buf = master ? const_cast<Buffer *>(masterBuffer())
: this;
- docstring const branch_name = func.argument();
+ docstring const & branch_name = func.argument();
// the case without a branch name is handled elsewhere
if (branch_name.empty()) {
dispatched = false;
@@ -2921,7 +2920,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
}
case LFUN_BRANCH_ADD: {
- docstring branchnames = func.argument();
+ docstring const & branchnames = func.argument();
if (branchnames.empty()) {
dispatched = false;
break;
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index fbfe41c6db..05630cba0b 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1122,7 +1122,7 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
break;
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
case LFUN_FILE_INSERT_PLAINTEXT: {
- docstring const fname = cmd.argument();
+ docstring const & fname = cmd.argument();
if (!FileName::isAbsolute(to_utf8(fname))) {
flag.message(_("Absolute filename expected."));
return false;
diff --git a/src/Compare.cpp b/src/Compare.cpp
index 51a28f16ec..1b46e6827d 100644
--- a/src/Compare.cpp
+++ b/src/Compare.cpp
@@ -103,7 +103,7 @@ public:
DocPair()
{}
- DocPair(DocIterator o_, DocIterator n_)
+ DocPair(DocIterator const & o_, DocIterator const & n_)
: o(o_), n(n_)
{}
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index e9544705ab..25dffb77a4 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -1627,10 +1627,9 @@ int LaTeX::scanBlgFile(DepTable & dep, TeXErrors & terr)
} else if (regex_match(token, sub, biberError)) {
retval |= BIBTEX_ERROR;
string errstr = N_("Biber error: ") + sub.str(2);
- string msg = token;
terr.insertError(0,
from_local8bit(errstr),
- from_local8bit(msg));
+ from_local8bit(token));
}
prevtoken = token;
}
@@ -1664,10 +1663,9 @@ int LaTeX::scanIlgFile(TeXErrors & terr)
} else if (prefixIs(token, "ERROR: ")) {
retval |= BIBTEX_ERROR;
string errstr = N_("Xindy error: ") + token.substr(6);
- string msg = token;
terr.insertError(0,
from_local8bit(errstr),
- from_local8bit(msg));
+ from_local8bit(token));
}
}
return retval;
diff --git a/src/Language.cpp b/src/Language.cpp
index 9ad7a9c217..dad933f0c6 100644
--- a/src/Language.cpp
+++ b/src/Language.cpp
@@ -89,7 +89,7 @@ string Language::fontenc(BufferParams const & params) const
// We check whether the used rm font supports an encoding our language supports
LaTeXFont const & lf =
theLaTeXFonts().getLaTeXFont(from_ascii(params.fontsRoman()));
- vector<string> const lfe = lf.fontencs();
+ vector<string> const & lfe = lf.fontencs();
for (auto & fe : fontenc_) {
// ASCII means: support all T* encodings plus OT1
if (fe == "ASCII") {
diff --git a/src/Layout.cpp b/src/Layout.cpp
index bfd6863397..ac8fd5847c 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -1885,7 +1885,7 @@ string const & Layout::docbookattr() const
}
-bool isValidTagType(std::string type)
+bool isValidTagType(std::string const & type)
{
return !(type.empty() || (type != "block" && type != "paragraph" && type != "inline"));
}
diff --git a/src/ParagraphParameters.cpp b/src/ParagraphParameters.cpp
index 6ef9224f2d..e6348797dd 100644
--- a/src/ParagraphParameters.cpp
+++ b/src/ParagraphParameters.cpp
@@ -168,7 +168,7 @@ void ParagraphParameters::leftIndent(Length const & li)
}
-void ParagraphParameters::read(string str, bool merge)
+void ParagraphParameters::read(string const & str, bool merge)
{
istringstream is(str);
Lexer lex;
diff --git a/src/ParagraphParameters.h b/src/ParagraphParameters.h
index 36eec30c48..07601e9e33 100644
--- a/src/ParagraphParameters.h
+++ b/src/ParagraphParameters.h
@@ -76,7 +76,7 @@ public:
void leftIndent(Length const &);
/// read the parameters from a string
- void read (std::string str, bool merge = true);
+ void read (std::string const & str, bool merge = true);
/// read the parameters from a lex
void read(Lexer & lex, bool merge = true);
diff --git a/src/Text3.cpp b/src/Text3.cpp
index cf2d701e7f..74f86b26f3 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -1108,7 +1108,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_NEWLINE_INSERT: {
InsetNewlineParams inp;
- docstring arg = cmd.argument();
+ docstring const & arg = cmd.argument();
if (arg == "linebreak")
inp.kind = InsetNewlineParams::LINEBREAK;
else
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index e162fc6091..04b339f13e 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -2045,6 +2045,7 @@ vector<string> const DocumentClass::citeCommands(
{
vector<CitationStyle> const styles = citeStyles(type);
vector<string> cmds;
+ cmds.reserve(styles.size());
for (auto const & cs : styles)
cmds.push_back(cs.name);
diff --git a/src/Thesaurus.cpp b/src/Thesaurus.cpp
index ace03d79e9..1c1adc03b0 100644
--- a/src/Thesaurus.cpp
+++ b/src/Thesaurus.cpp
@@ -217,7 +217,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
MyThes * mythes = nullptr;
docstring const lang_code = from_ascii(wl.lang()->code());
- docstring const t = wl.word();
+ docstring const & t = wl.word();
if (!d->addThesaurus(lang_code))
return meanings;
@@ -266,6 +266,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
// remove silly item
if (support::prefixIs(meaning, '-'))
meaning = support::ltrim(meaning, "- ");
+ ret.reserve(pm->count);
for (int j = 0; j < pm->count; j++) {
ret.push_back(from_iconv_encoding(string(pm->psyns[j]), encoding));
}
diff --git a/src/factory.cpp b/src/factory.cpp
index dd72fe33d1..6f17797ada 100644
--- a/src/factory.cpp
+++ b/src/factory.cpp
@@ -215,7 +215,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
}
case LFUN_INDEX_INSERT: {
- docstring arg = cmd.argument();
+ docstring const & arg = cmd.argument();
return new InsetIndex(buf, InsetIndexParams(arg));
}
@@ -341,7 +341,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
}
case INDEX_CODE: {
- docstring arg = cmd.argument();
+ docstring const & arg = cmd.argument();
return new InsetIndex(buf, InsetIndexParams(arg));
}
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 2c87ad10a2..3c007befc8 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -3002,7 +3002,7 @@ static QStringList uifiles;
static QStringList toolbar_uifiles;
-GuiApplication::ReturnValues GuiApplication::readUIFile(FileName ui_path)
+GuiApplication::ReturnValues GuiApplication::readUIFile(FileName const & ui_path)
{
enum {
ui_menuset = 1,
diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h
index d1294e6798..095976248c 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -242,7 +242,7 @@ private:
FormatMismatch
};
///
- ReturnValues readUIFile(support::FileName);
+ ReturnValues readUIFile(support::FileName const & ui_path);
///
void setGuiLanguage();
///
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index 195b0d349b..c66a6d372c 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -957,7 +957,7 @@ void GuiCitation::clearParams()
void GuiCitation::filterByEntryType(BiblioInfo const & bi,
- vector<docstring> & keyVector, docstring entry_type)
+ vector<docstring> & keyVector, docstring const & entry_type)
{
if (entry_type.empty())
return;
@@ -1009,7 +1009,7 @@ static docstring escape_special_chars(docstring const & expr)
vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
vector<docstring> const & keys_to_search, bool only_keys,
- docstring const & search_expression, docstring field,
+ docstring const & search_expression, docstring const & field,
bool case_sensitive, bool regex)
{
vector<docstring> foundKeys;
diff --git a/src/frontends/qt/GuiCitation.h b/src/frontends/qt/GuiCitation.h
index 13a808763c..6859b7337e 100644
--- a/src/frontends/qt/GuiCitation.h
+++ b/src/frontends/qt/GuiCitation.h
@@ -150,7 +150,7 @@ private:
///
void filterByEntryType(BiblioInfo const & bi,
- std::vector<docstring> & keyVector, docstring entryType);
+ std::vector<docstring> & keyVector, docstring const & entryType);
/// Search a given string within the passed keys.
/// \return the vector of matched keys.
@@ -159,7 +159,7 @@ private:
std::vector<docstring> const & keys_to_search, //< Keys to search.
bool only_keys, //< whether to search only the keys
docstring const & search_expression, //< Search expression (regex possible)
- docstring field, //< field to search, empty for all fields
+ docstring const & field, //< field to search, empty for all fields
bool case_sensitive = false, //< set to true is the search should be case sensitive
bool regex = false //< \set to true if \c search_expression is a regex
); //
diff --git a/src/frontends/qt/GuiClipboard.cpp b/src/frontends/qt/GuiClipboard.cpp
index 422315a03e..59e59005b7 100644
--- a/src/frontends/qt/GuiClipboard.cpp
+++ b/src/frontends/qt/GuiClipboard.cpp
@@ -345,7 +345,7 @@ namespace {
* Since we are going to write a HTML file for external converters we need
* to ensure that it is a well formed HTML file, including all the mentioned tags.
*/
-QString tidyHtml(QString input)
+QString tidyHtml(QString const & input)
{
// Misuse QTextDocument to cleanup the HTML.
// As a side effect, all visual markup like <tt> is converted to CSS,
diff --git a/src/frontends/qt/GuiCompare.cpp b/src/frontends/qt/GuiCompare.cpp
index d282df9526..d1da5b337f 100644
--- a/src/frontends/qt/GuiCompare.cpp
+++ b/src/frontends/qt/GuiCompare.cpp
@@ -244,7 +244,7 @@ void GuiCompare::progressMax(int max) const
}
-void GuiCompare::setStatusMessage(QString msg)
+void GuiCompare::setStatusMessage(QString const & msg)
{
statusBar->showMessage(msg);
}
diff --git a/src/frontends/qt/GuiCompare.h b/src/frontends/qt/GuiCompare.h
index 6d608876d3..649ba5c155 100644
--- a/src/frontends/qt/GuiCompare.h
+++ b/src/frontends/qt/GuiCompare.h
@@ -57,7 +57,7 @@ private Q_SLOTS:
///
void progressMax(int) const;
///
- void setStatusMessage(QString);
+ void setStatusMessage(QString const &);
private:
///
diff --git a/src/frontends/qt/GuiDelimiter.cpp b/src/frontends/qt/GuiDelimiter.cpp
index 8dc97ffe17..4e2eff7d0d 100644
--- a/src/frontends/qt/GuiDelimiter.cpp
+++ b/src/frontends/qt/GuiDelimiter.cpp
@@ -139,7 +139,7 @@ void initMathSymbols()
}
/// \return the math unicode symbol associated to a TeX name.
-MathSymbol const & mathSymbol(string tex_name)
+MathSymbol const & mathSymbol(string const & tex_name)
{
map<string, MathSymbol>::const_iterator it =
math_symbols_.find(tex_name);
@@ -216,7 +216,7 @@ GuiDelimiter::GuiDelimiter(GuiView & lv)
QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
QListWidgetItem * lwi = new QListWidgetItem(symbol);
lyxfont.setFamily(ms.fontfamily);
- QFont font = frontend::getFont(lyxfont);
+ QFont const & font = frontend::getFont(lyxfont);
lwi->setFont(font);
setDelimiterName(lwi, delim);
lwi->setToolTip(toqstr(delim));
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 0244bfdfe8..ca874f6078 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -3309,7 +3309,7 @@ void GuiDocument::getTableStyles()
<< toqstr(system);
for (int i = 0; i < dirs.size(); ++i) {
- QString const dir = dirs.at(i);
+ QString const & dir = dirs.at(i);
QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString fn = QFileInfo(it.next()).fileName();
diff --git a/src/frontends/qt/GuiLyXFiles.cpp b/src/frontends/qt/GuiLyXFiles.cpp
index 5616ac0c2d..9e1caf9295 100644
--- a/src/frontends/qt/GuiLyXFiles.cpp
+++ b/src/frontends/qt/GuiLyXFiles.cpp
@@ -37,7 +37,7 @@ namespace frontend {
namespace {
-QString const guiString(QString in)
+QString const guiString(QString const & in)
{
// recode specially encoded chars in file names (URL encoding and underbar)
return QString::fromUtf8(QByteArray::fromPercentEncoding(in.toUtf8())).replace('_', ' ');
@@ -76,7 +76,7 @@ QMap<QString, QString> GuiLyXFiles::getFiles()
<< toqstr(system);
for (int i = 0; i < dirs.size(); ++i) {
- QString const dir = dirs.at(i);
+ QString const & dir = dirs.at(i);
QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString fn(QFile(it.next()).fileName());
diff --git a/src/frontends/qt/GuiPainter.cpp b/src/frontends/qt/GuiPainter.cpp
index d9074cb427..79bbf5603e 100644
--- a/src/frontends/qt/GuiPainter.cpp
+++ b/src/frontends/qt/GuiPainter.cpp
@@ -240,7 +240,7 @@ void GuiPainter::image(int x, int y, int w, int h, graphics::Image const & i)
fillRectangle(x, y, w, h, Color_graphicsbg);
- QImage const image = qlimage.image();
+ QImage const & image = qlimage.image();
QRectF const drect = QRectF(x, y, w, h);
QRectF const srect = QRectF(0, 0, image.width(), image.height());
// Bilinear filtering is needed on a rare occasion for instant previews when
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index faf88039bb..79064dfd87 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1206,8 +1206,8 @@ void PrefColors::resetAllColor()
}
-bool PrefColors::setColor(int const row, QColor const new_color,
- QString const old_color)
+bool PrefColors::setColor(int const row, QColor const & new_color,
+ QString const & old_color)
{
if (new_color.isValid() && new_color.name() != old_color) {
newcolors_[size_t(row)] = new_color.name();
@@ -1244,7 +1244,7 @@ void PrefColors::setDisabledResets()
}
-bool PrefColors::isDefaultColor(int const row, QString const color)
+bool PrefColors::isDefaultColor(int const row, QString const & color)
{
return color == getDefaultColorByRow(row).name();
}
diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h
index 11a511db2e..3bc368ac62 100644
--- a/src/frontends/qt/GuiPrefs.h
+++ b/src/frontends/qt/GuiPrefs.h
@@ -255,9 +255,9 @@ private Q_SLOTS:
void resetAllColor();
void changeSysColor();
void changeLyxObjectsSelection();
- bool setColor(int const row, QColor const new_color,
- QString const old_color);
- bool isDefaultColor(int const row, QString const color);
+ bool setColor(int const row, QColor const & new_color,
+ QString const & old_color);
+ bool isDefaultColor(int const row, QString const & color);
void setDisabledResets();
private:
diff --git a/src/frontends/qt/GuiRef.cpp b/src/frontends/qt/GuiRef.cpp
index 83be347737..5884ac4009 100644
--- a/src/frontends/qt/GuiRef.cpp
+++ b/src/frontends/qt/GuiRef.cpp
@@ -483,11 +483,11 @@ void GuiRef::redoRefs()
if (groupCB->isChecked()) {
QList<QTreeWidgetItem *> refsCats;
for (int i = 0; i < refsCategories.size(); ++i) {
- QString const cat = refsCategories.at(i);
+ QString const & cat = refsCategories.at(i);
QTreeWidgetItem * item = new QTreeWidgetItem(refsTW);
item->setText(0, cat);
for (int j = 0; j < refsStrings.size(); ++j) {
- QString const ref = refsStrings.at(j);
+ QString const & ref = refsStrings.at(j);
if ((ref.startsWith(cat + QString(":")))
|| (cat == qt_("<No prefix>")
&& (!ref.mid(1).contains(":") || ref.left(1).contains(":")))) {
diff --git a/src/frontends/qt/GuiTabularCreate.cpp b/src/frontends/qt/GuiTabularCreate.cpp
index 1f5e36ec4d..e0e93afad9 100644
--- a/src/frontends/qt/GuiTabularCreate.cpp
+++ b/src/frontends/qt/GuiTabularCreate.cpp
@@ -54,7 +54,7 @@ void GuiTabularCreate::getFiles()
<< toqstr(system);
for (int i = 0; i < dirs.size(); ++i) {
- QString const dir = dirs.at(i);
+ QString const & dir = dirs.at(i);
QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString fn = QFileInfo(it.next()).fileName();
diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index 5937ae9707..c1f74f8c36 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -2193,7 +2193,7 @@ void GuiWorkAreaContainer::updateDisplay()
}
-void GuiWorkAreaContainer::dispatch(FuncRequest f) const
+void GuiWorkAreaContainer::dispatch(FuncRequest const & f) const
{
lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH,
wa_->bufferView().buffer().absFileName()));
diff --git a/src/frontends/qt/GuiWorkArea.h b/src/frontends/qt/GuiWorkArea.h
index 8e1790a2bb..6f24ff313c 100644
--- a/src/frontends/qt/GuiWorkArea.h
+++ b/src/frontends/qt/GuiWorkArea.h
@@ -280,7 +280,7 @@ class GuiWorkAreaContainer : public QWidget, public Ui::WorkAreaUi
Q_OBJECT
// non-null
GuiWorkArea * const wa_;
- void dispatch(FuncRequest f) const;
+ void dispatch(FuncRequest const & f) const;
private Q_SLOTS:
void updateDisplay();
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index a138091c4e..b6a0a424ee 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -358,7 +358,7 @@ public:
void expandFloatInsert(Buffer const * buf);
void expandFlexInsert(Buffer const * buf, InsetLayout::InsetLyXType type);
void expandTocSubmenu(std::string const & type, Toc const & toc_list);
- void expandToc2(Toc const & toc_list, size_t from, size_t to, int depth, string toc_type);
+ void expandToc2(Toc const & toc_list, size_t from, size_t to, int depth, const string &toc_type);
void expandToc(Buffer const * buf);
void expandPasteRecent(Buffer const * buf);
void expandToolbars();
@@ -1258,7 +1258,7 @@ size_t const menu_size_limit = 80;
void MenuDefinition::expandToc2(Toc const & toc_list,
size_t from, size_t to, int depth,
- string toc_type)
+ string const & toc_type)
{
int shortcut_count = 0;
diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp
index 45cc6112d2..de2b07a1ee 100644
--- a/src/frontends/qt/TocWidget.cpp
+++ b/src/frontends/qt/TocWidget.cpp
@@ -365,7 +365,7 @@ void TocWidget::sendDispatch(FuncRequest fr)
{
fr.setViewOrigin(&gui_view_);
- DispatchResult dr=dispatch(fr);
+ DispatchResult const & dr = dispatch(fr);
if (dr.error())
gui_view_.message(dr.message());
}
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index f606444ede..bb578117e2 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -310,7 +310,8 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
vector<pair<docstring, string>> const dbs =
buffer().prepareBibFilePaths(runparams, getBibFiles(), false);
vector<docstring> db_out;
- for (pair<docstring, string> const & db : dbs)
+ db_out.reserve(dbs.size());
+ for (pair<docstring, string> const & db : dbs)
db_out.push_back(db.first);
// Style options
if (style == "default")
diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp
index 6d15c6886a..c3fd15fed5 100644
--- a/src/insets/InsetCommand.cpp
+++ b/src/insets/InsetCommand.cpp
@@ -190,7 +190,7 @@ void InsetCommand::validate(LaTeXFeatures & features) const
void InsetCommand::changeCmdName(string const & new_name)
{
- string const old_name = getCmdName();
+ string const & old_name = getCmdName();
if (old_name == new_name)
return;
diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index d30f2efc68..063691b154 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -536,7 +536,7 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
void InsetRef::validate(LaTeXFeatures & features) const
{
- string const cmd = getCmdName();
+ string const & cmd = getCmdName();
if (cmd == "vref" || cmd == "vpageref")
features.require("varioref");
else if (cmd == "formatted") {
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 00d9bc1fbb..e6c9892025 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -7331,7 +7331,7 @@ ParagraphList InsetTabular::asParList(idx_type stidx, idx_type enidx)
row_type const row2 = tabular.cellRow(enidx);
for (col_type col = col1; col <= col2; col++)
for (row_type row = row1; row <= row2; row++)
- for (auto par : tabular.cellInset(row, col)->paragraphs())
+ for (auto const & par : tabular.cellInset(row, col)->paragraphs())
retval.push_back(par);
return retval;
}
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 6f7a1a40e5..f72b9a6396 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -1011,7 +1011,7 @@ pit_type InsetText::openAddToTocForParagraph(pit_type pit,
{
Paragraph const & par = paragraphs()[pit];
TocBuilder & b = backend.builder(par.layout().tocType());
- docstring const label = par.labelString();
+ docstring const & label = par.labelString();
b.pushItem(dit, label + (label.empty() ? "" : " "), output_active);
return text().lastInSequence(pit);
}
@@ -1130,7 +1130,7 @@ string InsetText::contextMenuName() const
}
-docstring InsetText::toolTipText(docstring prefix, size_t const len) const
+docstring InsetText::toolTipText(docstring const & prefix, size_t const len) const
{
OutputParams rp(&buffer().params().encoding());
rp.for_tooltip = true;
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index 6ce6b5af07..bccaaccf78 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -215,7 +215,7 @@ public:
/// of that sort. (Note: unnecessary internal copies have been removed
/// since the previous note. The efficiency would have to be assessed
/// again by profiling.)
- docstring toolTipText(docstring prefix = empty_docstring(),
+ docstring toolTipText(docstring const & prefix = empty_docstring(),
size_t len = 400) const;
///
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index fef88a9943..783e374f62 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1215,7 +1215,7 @@ void InsetMathGrid::mathmlize(MathStream & ms) const
// FIXME XHTML
// We need to do something about alignment here.
-void InsetMathGrid::htmlize(HtmlStream & os, string attrib) const
+void InsetMathGrid::htmlize(HtmlStream & os, string const & attrib) const
{
bool const havetable = nrows() > 1 || ncols() > 1;
if (!havetable) {
diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h
index 87f781aa7a..df83449191 100644
--- a/src/mathed/InsetMathGrid.h
+++ b/src/mathed/InsetMathGrid.h
@@ -231,7 +231,7 @@ public:
///
void htmlize(HtmlStream &) const override;
///
- void htmlize(HtmlStream &, std::string attrib) const;
+ void htmlize(HtmlStream &, std::string const & attrib) const;
///
void validate(LaTeXFeatures & features) const override;
///
diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp
index 2e6acf0f0c..b4420e98e2 100644
--- a/src/mathed/InsetMathRoot.cpp
+++ b/src/mathed/InsetMathRoot.cpp
@@ -100,13 +100,13 @@ void mathed_draw_root(PainterInfo & pi, int x, int y, MathData const & nucleus,
int const a = dim.ascent();
int const d = dim.descent();
int const t = pi.base.solidLineThickness();
- Dimension const dimn = nucleus.dimension(*pi.base.bv);
+ Dimension const & dimn = nucleus.dimension(*pi.base.bv);
// the width of the left part of the root
int const wl = dim.width() - dimn.width();
// the "exponent"
if (root) {
Changer script = pi.base.font.changeStyle(SCRIPTSCRIPT_STYLE);
- Dimension const dimr = root->dimension(*pi.base.bv);
+ Dimension const & dimr = root->dimension(*pi.base.bv);
int const root_offset = wl - 3 * w / 8 - dimr.width();
root->draw(pi, x + root_offset, y + (d - a)/2);
}
diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp
index f07b2e6409..332d2a1454 100644
--- a/src/mathed/MathParser.cpp
+++ b/src/mathed/MathParser.cpp
@@ -1881,7 +1881,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
bool const prot = nextToken().character() == '*';
if (prot)
getToken();
- docstring const name = t.cs();
+ docstring const & name = t.cs();
docstring const arg = parse_verbatim_item();
Length length;
if (prot && arg == "\\fill")
diff --git a/src/support/debug.h b/src/support/debug.h
index 112b66a43b..da10cd1188 100644
--- a/src/support/debug.h
+++ b/src/support/debug.h
@@ -168,7 +168,7 @@ public:
void setSecondStream(std::ostream * os)
{ second_enabled_ = (second_stream_ = os); }
/// Is the second stream is enabled?
- bool secondEnabled() { return second_enabled_; }
+ bool secondEnabled() const { return second_enabled_; }
/// Sets the debug level
void setLevel(Debug::Type t) { dt_ = t; }
diff --git a/src/support/docstream.cpp b/src/support/docstream.cpp
index 98324d1b25..92855022a7 100644
--- a/src/support/docstream.cpp
+++ b/src/support/docstream.cpp
@@ -383,7 +383,7 @@ SetEnc setEncoding(string const & encoding)
}
-odocstream & operator<<(odocstream & os, SetEnc e)
+odocstream & operator<<(odocstream & os, SetEnc const & e)
{
if (has_facet<iconv_codecvt_facet>(os.rdbuf()->getloc())) {
// This stream must be a file stream, since we never imbue
@@ -413,7 +413,7 @@ odocstream & operator<<(odocstream & os, SetEnc e)
}
-idocstream & operator<<(idocstream & is, SetEnc e)
+idocstream & operator<<(idocstream & is, SetEnc const & e)
{
if (has_facet<iconv_codecvt_facet>(is.rdbuf()->getloc())) {
// This stream must be a file stream, since we never imbue
diff --git a/src/support/docstream.h b/src/support/docstream.h
index 52cc04ae6b..700601c428 100644
--- a/src/support/docstream.h
+++ b/src/support/docstream.h
@@ -111,8 +111,8 @@ SetEnc setEncoding(std::string const & encoding);
os << setEncoding("ISO-8859-1");
\endcode
*/
-odocstream & operator<<(odocstream & os, SetEnc e);
-idocstream & operator<<(idocstream & os, SetEnc e);
+odocstream & operator<<(odocstream & os, SetEnc const & e);
+idocstream & operator<<(idocstream & os, SetEnc const & e);
} // namespace lyx
diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp
index 6d6674dce9..0233c41908 100644
--- a/src/support/filetools.cpp
+++ b/src/support/filetools.cpp
@@ -442,7 +442,7 @@ string const commandPrep(string const & command_in)
}
-FileName const tempFileName(FileName tempdir, string const & mask, bool const dir)
+FileName const tempFileName(FileName const & tempdir, string const & mask, bool const dir)
{
return tempFileName(TempFile(tempdir, mask).name(), dir);
}
diff --git a/src/support/filetools.h b/src/support/filetools.h
index e66af9972f..24adf30ee6 100644
--- a/src/support/filetools.h
+++ b/src/support/filetools.h
@@ -42,7 +42,7 @@ static std::set<std::string> tmp_names_;
*/
FileName const tempFileName(FileName, bool const dir = false);
/// Get temporary file name with custom path
-FileName const tempFileName(FileName, std::string const &, bool const dir = false);
+FileName const tempFileName(FileName const &, std::string const &, bool const dir = false);
/// Get temporary file name with default path
FileName const tempFileName(std::string const &, bool const dir = false);
diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp
index 57253650f7..795628bddf 100644
--- a/src/tex2lyx/Parser.cpp
+++ b/src/tex2lyx/Parser.cpp
@@ -129,7 +129,7 @@ void iparserdocstream::putback(char_type c)
}
-void iparserdocstream::putback(docstring s)
+void iparserdocstream::putback(docstring const & s)
{
s_ = s + s_;
}
diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h
index 41384599c2..9f174c8a0b 100644
--- a/src/tex2lyx/Parser.h
+++ b/src/tex2lyx/Parser.h
@@ -139,7 +139,7 @@ public:
// add to the list of characters to read before actually reading
// the stream
- void putback(docstring s);
+ void putback(const docstring &s);
/// Like std::istream::get()
iparserdocstream & get(char_type &c);
diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index 55a64af28a..8ecfa68374 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -371,7 +371,7 @@ bool checkModule(string const & name, bool command)
if (layout) {
found_style = true;
dpre = layout->preamble();
- std::set<std::string> lreqs = layout->required();
+ std::set<std::string> const & lreqs = layout->required();
if (!lreqs.empty())
cmd_reqs.insert(lreqs.begin(), lreqs.end());
} else if (insetlayout) {
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index e431f3665a..e06ba2dd27 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -47,7 +47,7 @@ namespace lyx {
namespace {
-void output_arguments(ostream &, Parser &, bool, bool, string, Context &,
+void output_arguments(ostream &, Parser &, bool, bool, const string &, Context &,
Layout::LaTeXArgMap const &);
}
@@ -459,7 +459,7 @@ bool translate_len(string const & length, string & valstring, string & unit)
/// If we have ambiguous quotation marks, make a smart guess
/// based on main quote style
-string guessQuoteStyle(string in, bool const opening)
+string guessQuoteStyle(string const & in, bool const opening)
{
string res = in;
if (prefixIs(in, "qr")) {// straight quote
@@ -528,7 +528,7 @@ string guessQuoteStyle(string in, bool const opening)
}
-string const fromPolyglossiaEnvironment(string const s)
+string const fromPolyglossiaEnvironment(string const & s)
{
// Since \arabic is taken by the LaTeX kernel,
// the Arabic polyglossia environment is upcased
@@ -539,7 +539,7 @@ string const fromPolyglossiaEnvironment(string const s)
}
-string uncapitalize(string const s)
+string uncapitalize(string const & s)
{
docstring in = from_ascii(s);
char_type t = lowercase(s[0]);
@@ -548,7 +548,7 @@ string uncapitalize(string const s)
}
-bool isCapitalized(string const s)
+bool isCapitalized(string const & s)
{
docstring in = from_ascii(s);
char_type t = uppercase(s[0]);
@@ -686,7 +686,7 @@ pair<bool, string> convert_latexed_command_inset_arg(string s)
/// try to convert \p s to a valid InsetCommand argument
/// without trying to recode macros.
-string convert_literate_command_inset_arg(string s)
+string convert_literate_command_inset_arg(string const & s)
{
// LyX cannot handle newlines in a latex command
return subst(s, "\n", " ");
@@ -789,7 +789,7 @@ void skip_spaces_braces(Parser & p, bool keepws = false)
}
-void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout, string const prefix,
+void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout, string const & prefix,
Context & context, Layout::LaTeXArgMap const & latexargs)
{
if (context.layout->latextype != LATEX_ITEM_ENVIRONMENT || !prefix.empty()) {
@@ -2536,7 +2536,7 @@ void get_cite_arguments(Parser & p, bool natbibOrder,
}
-void copy_file(FileName const & src, string dstname)
+void copy_file(FileName const & src, string const & dstname)
{
if (!copyFiles())
return;
--
2.28.0.windows.1
-------------- next part --------------
From 471aa734d1d994d909ed5254f85eae8dc73d5ff0 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sat, 31 Oct 2020 19:18:51 +0200
Subject: [PATCH 04/10] Match header/source function argument naming
---
src/Buffer.cpp | 10 ++---
src/BufferList.cpp | 8 ++--
src/BufferView.cpp | 48 ++++++++++-----------
src/Cursor.cpp | 26 ++++++------
src/Cursor.h | 2 +-
src/CutAndPaste.h | 4 +-
src/Floating.h | 4 +-
src/Font.cpp | 8 ++--
src/FontInfo.cpp | 4 +-
src/Format.cpp | 4 +-
src/FuncRequest.cpp | 4 +-
src/Graph.cpp | 6 +--
src/KeySequence.h | 4 +-
src/LaTeXFeatures.cpp | 8 ++--
src/LaTeXFeatures.h | 2 +-
src/Language.cpp | 14 +++----
src/LayoutFile.h | 2 +-
src/Lexer.cpp | 4 +-
src/Lexer.h | 4 +-
src/LyXAction.cpp | 4 +-
src/MetricsInfo.h | 2 +-
src/Paragraph.cpp | 24 +++++------
src/ParagraphParameters.cpp | 12 +++---
src/Server.h | 2 +-
src/Session.cpp | 4 +-
src/Text.h | 2 +-
src/Text3.cpp | 28 ++++++-------
src/TextMetrics.h | 4 +-
src/frontends/qt/FloatPlacement.h | 2 +-
src/frontends/qt/GuiClipboard.h | 2 +-
src/frontends/qt/GuiCounter.h | 2 +-
src/frontends/qt/GuiGraphics.cpp | 60 +++++++++++++--------------
src/frontends/qt/qt_helpers.cpp | 14 +++----
src/frontends/qt/qt_helpers.h | 4 +-
src/insets/ExternalTransforms.h | 2 +-
src/insets/Inset.cpp | 12 +++---
src/insets/InsetGraphicsParams.cpp | 36 ++++++++--------
src/insets/InsetInfo.cpp | 10 ++---
src/insets/InsetLabel.cpp | 14 +++----
src/insets/InsetListingsParams.cpp | 4 +-
src/insets/InsetSeparator.h | 2 +-
src/insets/InsetSpace.h | 2 +-
src/mathed/InsetMath.cpp | 30 +++++++-------
src/mathed/InsetMathAMSArray.h | 2 +-
src/mathed/InsetMathCases.cpp | 4 +-
src/mathed/InsetMathDots.h | 2 +-
src/mathed/InsetMathMacroTemplate.cpp | 22 +++++-----
src/mathed/InsetMathMacroTemplate.h | 4 +-
src/mathed/InsetMathUnknown.cpp | 4 +-
src/mathed/MacroTable.cpp | 10 ++---
src/mathed/TextPainter.cpp | 8 ++--
src/output_plaintext.h | 2 +-
src/tex2lyx/tex2lyx.h | 2 +-
53 files changed, 252 insertions(+), 252 deletions(-)
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 64a3daa4aa..d1831d49aa 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3525,19 +3525,19 @@ bool Buffer::hasChildren() const
}
-void Buffer::collectChildren(ListOfBuffers & clist, bool grand_children) const
+void Buffer::collectChildren(ListOfBuffers & children, bool grand_children) const
{
// loop over children
for (auto const & p : d->children_positions) {
Buffer * child = const_cast<Buffer *>(p.first);
// No duplicates
- ListOfBuffers::const_iterator bit = find(clist.begin(), clist.end(), child);
- if (bit != clist.end())
+ ListOfBuffers::const_iterator bit = find(children.begin(), children.end(), child);
+ if (bit != children.end())
continue;
- clist.push_back(child);
+ children.push_back(child);
if (grand_children)
// there might be grandchildren
- child->collectChildren(clist, true);
+ child->collectChildren(children, true);
}
}
diff --git a/src/BufferList.cpp b/src/BufferList.cpp
index 0cfbec135d..198e0bfad0 100644
--- a/src/BufferList.cpp
+++ b/src/BufferList.cpp
@@ -312,21 +312,21 @@ Buffer * BufferList::getBuffer(support::FileName const & fname, bool internal) c
}
-Buffer * BufferList::getBufferFromTmp(string const & s, bool realpath)
+Buffer * BufferList::getBufferFromTmp(string const & path, bool realpath)
{
for (Buffer * buf : bstore) {
string const temppath = realpath ? FileName(buf->temppath()).realPath() : buf->temppath();
- if (prefixIs(s, temppath)) {
+ if (prefixIs(path, temppath)) {
// check whether the filename matches the master
string const master_name = buf->latexName();
- if (suffixIs(s, master_name))
+ if (suffixIs(path, master_name))
return buf;
// if not, try with the children
for (Buffer * child : buf->getDescendants()) {
string const mangled_child_name = DocFileName(
changeExtension(child->absFileName(),
".tex")).mangledFileName();
- if (suffixIs(s, mangled_child_name))
+ if (suffixIs(path, mangled_child_name))
return child;
}
}
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 05630cba0b..4e704e3249 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -654,24 +654,24 @@ string BufferView::contextMenu(int x, int y) const
-void BufferView::scrollDocView(int const value, bool update)
+void BufferView::scrollDocView(int const pixels, bool update)
{
// The scrollbar values are relative to the top of the screen, therefore the
// offset is equal to the target value.
// No scrolling at all? No need to redraw anything
- if (value == 0)
+ if (pixels == 0)
return;
// If the offset is less than 2 screen height, prefer to scroll instead.
- if (abs(value) <= 2 * height_) {
- d->anchor_ypos_ -= value;
+ if (abs(pixels) <= 2 * height_) {
+ d->anchor_ypos_ -= pixels;
processUpdateFlags(Update::Force);
return;
}
// cut off at the top
- if (value <= d->scrollbarParameters_.min) {
+ if (pixels <= d->scrollbarParameters_.min) {
DocIterator dit = doc_iterator_begin(&buffer_);
showCursor(dit, false, update);
LYXERR(Debug::SCROLLING, "scroll to top");
@@ -679,7 +679,7 @@ void BufferView::scrollDocView(int const value, bool update)
}
// cut off at the bottom
- if (value >= d->scrollbarParameters_.max) {
+ if (pixels >= d->scrollbarParameters_.max) {
DocIterator dit = doc_iterator_end(&buffer_);
dit.backwardPos();
showCursor(dit, false, update);
@@ -692,11 +692,11 @@ void BufferView::scrollDocView(int const value, bool update)
pit_type i = 0;
for (; i != int(d->par_height_.size()); ++i) {
par_pos += d->par_height_[i];
- if (par_pos >= value)
+ if (par_pos >= pixels)
break;
}
- if (par_pos < value) {
+ if (par_pos < pixels) {
// It seems we didn't find the correct pit so stay on the safe side and
// scroll to bottom.
LYXERR0("scrolling position not found!");
@@ -706,7 +706,7 @@ void BufferView::scrollDocView(int const value, bool update)
DocIterator dit = doc_iterator_begin(&buffer_);
dit.pit() = i;
- LYXERR(Debug::SCROLLING, "value = " << value << " -> scroll to pit " << i);
+ LYXERR(Debug::SCROLLING, "pixels = " << pixels << " -> scroll to pit " << i);
showCursor(dit, false, update);
}
@@ -2425,21 +2425,21 @@ int BufferView::minVisiblePart()
}
-int BufferView::scroll(int y)
+int BufferView::scroll(int pixels)
{
- if (y > 0)
- return scrollDown(y);
- if (y < 0)
- return scrollUp(-y);
+ if (pixels > 0)
+ return scrollDown(pixels);
+ if (pixels < 0)
+ return scrollUp(-pixels);
return 0;
}
-int BufferView::scrollDown(int offset)
+int BufferView::scrollDown(int pixels)
{
Text * text = &buffer_.text();
TextMetrics & tm = d->text_metrics_[text];
- int const ymax = height_ + offset;
+ int const ymax = height_ + pixels;
while (true) {
pair<pit_type, ParagraphMetrics const *> last = tm.last();
int bottom_pos = last.second->position() + last.second->descent();
@@ -2448,38 +2448,38 @@ int BufferView::scrollDown(int offset)
if (last.first + 1 == int(text->paragraphs().size())) {
if (bottom_pos <= height_)
return 0;
- offset = min(offset, bottom_pos - height_);
+ pixels = min(pixels, bottom_pos - height_);
break;
}
if (bottom_pos > ymax)
break;
tm.newParMetricsDown();
}
- d->anchor_ypos_ -= offset;
- return -offset;
+ d->anchor_ypos_ -= pixels;
+ return -pixels;
}
-int BufferView::scrollUp(int offset)
+int BufferView::scrollUp(int pixels)
{
Text * text = &buffer_.text();
TextMetrics & tm = d->text_metrics_[text];
- int ymin = - offset;
+ int ymin = - pixels;
while (true) {
pair<pit_type, ParagraphMetrics const *> first = tm.first();
int top_pos = first.second->position() - first.second->ascent();
if (first.first == 0) {
if (top_pos >= 0)
return 0;
- offset = min(offset, - top_pos);
+ pixels = min(pixels, - top_pos);
break;
}
if (top_pos < ymin)
break;
tm.newParMetricsUp();
}
- d->anchor_ypos_ += offset;
- return offset;
+ d->anchor_ypos_ += pixels;
+ return pixels;
}
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 9e7867c8d3..97fbeb6a88 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -637,9 +637,9 @@ void CursorData::recordUndo(UndoKind kind) const
}
-void CursorData::recordUndoInset(Inset const * in) const
+void CursorData::recordUndoInset(Inset const * inset) const
{
- buffer()->undo().recordUndoInset(*this, in);
+ buffer()->undo().recordUndoInset(*this, inset);
}
@@ -897,19 +897,19 @@ void Cursor::pop()
}
-void Cursor::push(Inset & p)
+void Cursor::push(Inset & inset)
{
- push_back(CursorSlice(p));
- p.setBuffer(*buffer());
+ push_back(CursorSlice(inset));
+ inset.setBuffer(*buffer());
}
-void Cursor::pushBackward(Inset & p)
+void Cursor::pushBackward(Inset & inset)
{
LASSERT(!empty(), return);
//lyxerr << "Entering inset " << t << " front" << endl;
- push(p);
- p.idxFirst(*this);
+ push(inset);
+ inset.idxFirst(*this);
}
@@ -1379,19 +1379,19 @@ void Cursor::updateTextTargetOffset()
}
-bool Cursor::selHandle(bool sel)
+bool Cursor::selHandle(bool selecting)
{
//lyxerr << "Cursor::selHandle" << endl;
if (mark())
- sel = true;
- if (sel == selection())
+ selecting = true;
+ if (selecting == selection())
return false;
- if (!sel)
+ if (!selecting)
cap::saveSelection(*this);
resetAnchor();
- selection(sel);
+ selection(selecting);
return true;
}
diff --git a/src/Cursor.h b/src/Cursor.h
index 951a0cc4db..6f4ac227f9 100644
--- a/src/Cursor.h
+++ b/src/Cursor.h
@@ -270,7 +270,7 @@ public:
void setCursorData(CursorData const & data);
/// returns true if we made a decision
- bool getStatus(FuncRequest const & cmd, FuncStatus & flag) const;
+ bool getStatus(FuncRequest const & cmd, FuncStatus & status) const;
/// dispatch from innermost inset upwards
void dispatch(FuncRequest const & cmd);
/// display a message
diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index fcbac19a89..09fe05215a 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -127,8 +127,8 @@ void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
* for a list of paragraphs beginning with the specified par.
* It changes layouts and character styles.
*/
-void switchBetweenClasses(DocumentClassConstPtr c1,
- DocumentClassConstPtr c2, InsetText & in, ErrorList &);
+void switchBetweenClasses(DocumentClassConstPtr oldone,
+ DocumentClassConstPtr newone, InsetText & in, ErrorList &);
/// Get the current selection as a string. Does not change the selection.
/// Does only work if the whole selection is in mathed.
diff --git a/src/Floating.h b/src/Floating.h
index a6f2ec3431..4672d9ac75 100644
--- a/src/Floating.h
+++ b/src/Floating.h
@@ -36,10 +36,10 @@ public:
std::string const & style, std::string const & name,
std::string const & listName, std::string const & listCmd,
std::string const & refPrefix, std::string const & allowedplacement,
- std::string const & htmlType, std::string const & htmlClass,
+ std::string const & htmlTag, std::string const & htmlAttrib,
docstring const & htmlStyle,
std::string const & docbookAttr, std::string const & docbookTagType,
- std::string const & required, bool usesfloat, bool isprefined,
+ std::string const & required, bool usesfloat, bool ispredefined,
bool allowswide, bool allowssideways);
///
std::string const & floattype() const { return floattype_; }
diff --git a/src/Font.cpp b/src/Font.cpp
index aed80592a5..b70c237db4 100644
--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -114,18 +114,18 @@ void Font::setLanguage(Language const * l)
/// Updates font settings according to request
void Font::update(Font const & newfont,
- Language const * document_language,
+ Language const * default_lang,
bool toggleall)
{
bits_.update(newfont.fontInfo(), toggleall);
if (newfont.language() == language() && toggleall)
- if (language() == document_language)
+ if (language() == default_lang)
setLanguage(default_language);
else
- setLanguage(document_language);
+ setLanguage(default_lang);
else if (newfont.language() == reset_language)
- setLanguage(document_language);
+ setLanguage(default_lang);
else if (newfont.language() != ignore_language)
setLanguage(newfont.language());
}
diff --git a/src/FontInfo.cpp b/src/FontInfo.cpp
index 02a9e70e1e..967771373a 100644
--- a/src/FontInfo.cpp
+++ b/src/FontInfo.cpp
@@ -343,9 +343,9 @@ Changer FontInfo::changeStyle(MathStyle const new_style)
}
-Changer FontInfo::change(FontInfo font, bool realiz)
+Changer FontInfo::change(FontInfo font, bool realize)
{
- if (realiz)
+ if (realize)
font.realize(*this);
return make_change(*this, font);
}
diff --git a/src/Format.cpp b/src/Format.cpp
index d639dbfd9f..6a3d49ca53 100644
--- a/src/Format.cpp
+++ b/src/Format.cpp
@@ -94,9 +94,9 @@ string const Format::extensions() const
}
-bool Format::hasExtension(string const & e) const
+bool Format::hasExtension(string const & ext) const
{
- return (find(extension_list_.begin(), extension_list_.end(), e)
+ return (find(extension_list_.begin(), extension_list_.end(), ext)
!= extension_list_.end());
}
diff --git a/src/FuncRequest.cpp b/src/FuncRequest.cpp
index 2049210529..0d6a487b8a 100644
--- a/src/FuncRequest.cpp
+++ b/src/FuncRequest.cpp
@@ -55,9 +55,9 @@ FuncRequest::FuncRequest(FuncCode act, string const & arg, Origin o)
FuncRequest::FuncRequest(FuncCode act, int ax, int ay,
- mouse_button::state but, KeyModifier modifier, Origin o)
+ mouse_button::state button, KeyModifier modifier, Origin o)
: action_(act), origin_(o), view_origin_(nullptr), x_(ax), y_(ay),
- button_(but), modifier_(modifier), allow_async_(true)
+ button_(button), modifier_(modifier), allow_async_(true)
{}
diff --git a/src/Graph.cpp b/src/Graph.cpp
index f78be287b2..86694eea58 100644
--- a/src/Graph.cpp
+++ b/src/Graph.cpp
@@ -45,11 +45,11 @@ bool Graph::bfs_init(int s, bool clear_visited, queue<int> & Q)
Graph::EdgePath const
- Graph::getReachableTo(int target, bool clear_visited)
+ Graph::getReachableTo(int to, bool clear_visited)
{
EdgePath result;
queue<int> Q;
- if (!bfs_init(target, clear_visited, Q))
+ if (!bfs_init(to, clear_visited, Q))
return result;
// Here's the logic, which is shared by the other routines.
@@ -61,7 +61,7 @@ Graph::EdgePath const
while (!Q.empty()) {
int const current = Q.front();
Q.pop();
- if (current != target || theFormats().get(target).name() != "lyx")
+ if (current != to || theFormats().get(to).name() != "lyx")
result.push_back(current);
vector<Arrow *>::iterator it = vertices_[current].in_arrows.begin();
diff --git a/src/KeySequence.h b/src/KeySequence.h
index 444fb08719..6e46abac2c 100644
--- a/src/KeySequence.h
+++ b/src/KeySequence.h
@@ -40,12 +40,12 @@ public:
/**
* Add a key to the key sequence and look it up in the curmap
* if the latter is defined.
- * @param keysym the key to add
+ * @param key the key to add
* @param mod modifier mask
* @param nmod which modifiers to mask out for equality test
* @return the action matching this key sequence or LFUN_UNKNOWN_ACTION
*/
- FuncRequest const & addkey(KeySymbol const & keysym, KeyModifier mod,
+ FuncRequest const & addkey(KeySymbol const & key, KeyModifier mod,
KeyModifier nmod = NoModifier);
/**
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 347a3e0450..59769a02f5 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -832,15 +832,15 @@ TexString getSnippets(std::list<TexString> const & list)
} // namespace
-void LaTeXFeatures::addPreambleSnippet(TexString ts, bool allow_dupes)
+void LaTeXFeatures::addPreambleSnippet(TexString snippet, bool allow_dupes)
{
- addSnippet(preamble_snippets_, move(ts), allow_dupes);
+ addSnippet(preamble_snippets_, move(snippet), allow_dupes);
}
-void LaTeXFeatures::addPreambleSnippet(docstring const & str, bool allow_dupes)
+void LaTeXFeatures::addPreambleSnippet(docstring const & snippet, bool allow_dupes)
{
- addSnippet(preamble_snippets_, TexString(str), allow_dupes);
+ addSnippet(preamble_snippets_, TexString(snippet), allow_dupes);
}
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index 27edb1f6a8..2cc90cdbac 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -142,7 +142,7 @@ public:
void getFontEncodings(std::vector<std::string> & encodings,
bool const onlylangs = false) const;
///
- void useLayout(docstring const & lyt);
+ void useLayout(docstring const & layoutname);
///
void useInsetLayout(InsetLayout const & lay);
///
diff --git a/src/Language.cpp b/src/Language.cpp
index dad933f0c6..884d1a039b 100644
--- a/src/Language.cpp
+++ b/src/Language.cpp
@@ -57,22 +57,22 @@ bool Language::isBabelExclusive() const
}
-docstring const Language::translateLayout(string const & m) const
+docstring const Language::translateLayout(string const & msg) const
{
- if (m.empty())
+ if (msg.empty())
return docstring();
- if (!isAscii(m)) {
- lyxerr << "Warning: not translating `" << m
+ if (!isAscii(msg)) {
+ lyxerr << "Warning: not translating `" << msg
<< "' because it is not pure ASCII.\n";
- return from_utf8(m);
+ return from_utf8(msg);
}
- TranslationMap::const_iterator it = layoutTranslations_.find(m);
+ TranslationMap::const_iterator it = layoutTranslations_.find(msg);
if (it != layoutTranslations_.end())
return it->second;
- docstring t = from_ascii(m);
+ docstring t = from_ascii(msg);
cleanTranslation(t);
return t;
}
diff --git a/src/LayoutFile.h b/src/LayoutFile.h
index 81dff9de78..f2b27a118d 100644
--- a/src/LayoutFile.h
+++ b/src/LayoutFile.h
@@ -107,7 +107,7 @@ public:
/// Read textclass list. Returns false if this fails.
bool read();
/// Clears the textclass so as to force it to be reloaded
- void reset(LayoutFileIndex const & tc);
+ void reset(LayoutFileIndex const & classname);
/// Add a default textclass with all standard layouts.
/// Note that this will over-write any information we may have
diff --git a/src/Lexer.cpp b/src/Lexer.cpp
index b11bf4743a..08fb469ce3 100644
--- a/src/Lexer.cpp
+++ b/src/Lexer.cpp
@@ -944,9 +944,9 @@ bool Lexer::checkFor(char const * required)
}
-void Lexer::setContext(std::string const & str)
+void Lexer::setContext(std::string const & functionName)
{
- pimpl_->context = str;
+ pimpl_->context = functionName;
}
diff --git a/src/Lexer.h b/src/Lexer.h
index 9568b6e19d..6ecdd90989 100644
--- a/src/Lexer.h
+++ b/src/Lexer.h
@@ -138,14 +138,14 @@ public:
std::string const getString(bool trim = false) const;
///
docstring const getDocString(bool trim = false) const;
- /** Get a long string, ended by the tag `endtag'.
+ /** Get a long string, ended by the tag `endtoken'.
This string can span several lines. The first line
serves as a template for how many spaces the lines
are indented. This much white space is skipped from
each following line. This mechanism does not work
perfectly if you use tabs.
*/
- docstring getLongString(docstring const & endtag);
+ docstring getLongString(docstring const & endtoken);
/// Pushes a token list on a stack and replaces it with a new one.
template<int N> void pushTable(LexerKeyword (&table)[N])
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 23cc74504b..8b13630d86 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -4490,9 +4490,9 @@ LyXAction::LyXAction()
}
-FuncRequest LyXAction::lookupFunc(string const & func) const
+FuncRequest LyXAction::lookupFunc(string const & func_name) const
{
- string const func2 = trim(func);
+ string const func2 = trim(func_name);
if (func2.empty())
return FuncRequest(LFUN_NOACTION);
diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h
index 1508eb345f..14fd02642a 100644
--- a/src/MetricsInfo.h
+++ b/src/MetricsInfo.h
@@ -55,7 +55,7 @@ public:
int macro_nesting;
/// Temporarily change a full font.
- Changer changeFontSet(std::string const & font);
+ Changer changeFontSet(std::string const & name);
/// Temporarily change the font to math if needed.
Changer changeEnsureMath(Inset::mode_type mode = Inset::MATH_MODE);
// Temporarily change to the style suitable for use in fractions
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 4ade252e72..c668f3b686 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1560,19 +1560,19 @@ void flushString(ostream & os, docstring & s)
void Paragraph::write(ostream & os, BufferParams const & bparams,
- depth_type & dth) const
+ depth_type & depth) const
{
// The beginning or end of a deeper (i.e. nested) area?
- if (dth != d->params_.depth()) {
- if (d->params_.depth() > dth) {
- while (d->params_.depth() > dth) {
+ if (depth != d->params_.depth()) {
+ if (d->params_.depth() > depth) {
+ while (d->params_.depth() > depth) {
os << "\n\\begin_deeper";
- ++dth;
+ ++depth;
}
} else {
- while (d->params_.depth() < dth) {
+ while (d->params_.depth() < depth) {
os << "\n\\end_deeper";
- --dth;
+ --depth;
}
}
}
@@ -1685,11 +1685,11 @@ void Paragraph::validate(LaTeXFeatures & features) const
}
-void Paragraph::insert(pos_type start, docstring const & str,
+void Paragraph::insert(pos_type pos, docstring const & str,
Font const & font, Change const & change)
{
for (size_t i = 0, n = str.size(); i != n ; ++i)
- insertChar(start + i, str[i], font, change);
+ insertChar(pos + i, str[i], font, change);
}
@@ -4129,12 +4129,12 @@ void Paragraph::setPlainLayout(DocumentClass const & tc)
}
-void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
+void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tc)
{
if (usePlainLayout())
- setPlainLayout(tclass);
+ setPlainLayout(tc);
else
- setDefaultLayout(tclass);
+ setDefaultLayout(tc);
}
diff --git a/src/ParagraphParameters.cpp b/src/ParagraphParameters.cpp
index e6348797dd..72b2286b12 100644
--- a/src/ParagraphParameters.cpp
+++ b/src/ParagraphParameters.cpp
@@ -244,14 +244,14 @@ void ParagraphParameters::read(Lexer & lex, bool merge)
void ParagraphParameters::apply(
- ParagraphParameters const & p, Layout const & layout)
+ ParagraphParameters const & params, Layout const & layout)
{
- spacing(p.spacing());
+ spacing(params.spacing());
// does the layout allow the new alignment?
- if (p.align() & layout.alignpossible)
- align(p.align());
- labelWidthString(p.labelWidthString());
- noindent(p.noindent());
+ if (params.align() & layout.alignpossible)
+ align(params.align());
+ labelWidthString(params.labelWidthString());
+ noindent(params.noindent());
}
diff --git a/src/Server.h b/src/Server.h
index e20406a6d4..9257704b43 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -206,7 +206,7 @@ public:
// lyxserver is using a buffer that is being edited with a bufferview.
// With a common buffer list this is not a problem, maybe. (Alejandro)
///
- Server(std::string const & pip);
+ Server(std::string const & pipes);
///
~Server();
///
diff --git a/src/Session.cpp b/src/Session.cpp
index 43c1b9b93e..c80bca5222 100644
--- a/src/Session.cpp
+++ b/src/Session.cpp
@@ -383,9 +383,9 @@ void LastCommandsSection::setNumberOfLastCommands(unsigned int no)
}
-void LastCommandsSection::add(std::string const & string)
+void LastCommandsSection::add(std::string const & command)
{
- lastcommands.push_back(string);
+ lastcommands.push_back(command);
}
diff --git a/src/Text.h b/src/Text.h
index 1c5d4397f4..4defd94fa6 100644
--- a/src/Text.h
+++ b/src/Text.h
@@ -258,7 +258,7 @@ public:
settings are given to the new one.
This function will handle a multi-paragraph selection.
*/
- void setParagraphs(Cursor const & cur, docstring const & arg, bool modify = false);
+ void setParagraphs(Cursor const & cur, docstring const & arg, bool merge = false);
/// Sets parameters for current or selected paragraphs
void setParagraphs(Cursor const & cur, ParagraphParameters const & p);
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 74f86b26f3..1927a2536a 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -2890,7 +2890,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
- FuncStatus & flag) const
+ FuncStatus & status) const
{
LBUFERR(this == cur.text());
@@ -2913,7 +2913,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
// FIXME We really should not allow this to be put, e.g.,
// in a footnote, or in ERT. But it would make sense in a
// branch, so I'm not sure what to do.
- flag.setOnOff(cur.paragraph().params().startOfAppendix());
+ status.setOnOff(cur.paragraph().params().startOfAppendix());
break;
case LFUN_DIALOG_SHOW_NEW_INSET:
@@ -3043,7 +3043,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
if (cit == floats.end() ||
// and that we know how to generate a list of them
(!cit->second.usesFloatPkg() && cit->second.listCommand().empty())) {
- flag.setUnknown(true);
+ status.setUnknown(true);
// probably not necessary, but...
enable = false;
}
@@ -3227,38 +3227,38 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
break;
case LFUN_FONT_EMPH:
- flag.setOnOff(fontinfo.emph() == FONT_ON);
+ status.setOnOff(fontinfo.emph() == FONT_ON);
enable = !cur.paragraph().isPassThru();
break;
case LFUN_FONT_ITAL:
- flag.setOnOff(fontinfo.shape() == ITALIC_SHAPE);
+ status.setOnOff(fontinfo.shape() == ITALIC_SHAPE);
enable = !cur.paragraph().isPassThru();
break;
case LFUN_FONT_NOUN:
- flag.setOnOff(fontinfo.noun() == FONT_ON);
+ status.setOnOff(fontinfo.noun() == FONT_ON);
enable = !cur.paragraph().isPassThru();
break;
case LFUN_FONT_BOLD:
case LFUN_FONT_BOLDSYMBOL:
- flag.setOnOff(fontinfo.series() == BOLD_SERIES);
+ status.setOnOff(fontinfo.series() == BOLD_SERIES);
enable = !cur.paragraph().isPassThru();
break;
case LFUN_FONT_SANS:
- flag.setOnOff(fontinfo.family() == SANS_FAMILY);
+ status.setOnOff(fontinfo.family() == SANS_FAMILY);
enable = !cur.paragraph().isPassThru();
break;
case LFUN_FONT_ROMAN:
- flag.setOnOff(fontinfo.family() == ROMAN_FAMILY);
+ status.setOnOff(fontinfo.family() == ROMAN_FAMILY);
enable = !cur.paragraph().isPassThru();
break;
case LFUN_FONT_TYPEWRITER:
- flag.setOnOff(fontinfo.family() == TYPEWRITER_FAMILY);
+ status.setOnOff(fontinfo.family() == TYPEWRITER_FAMILY);
enable = !cur.paragraph().isPassThru();
break;
@@ -3414,7 +3414,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
if (!ins)
enable = false;
else
- flag.setOnOff(to_utf8(cmd.argument()) == ins->getParams().groupId);
+ status.setOnOff(to_utf8(cmd.argument()) == ins->getParams().groupId);
break;
}
@@ -3426,7 +3426,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_LANGUAGE:
enable = !cur.paragraph().isPassThru();
- flag.setOnOff(cmd.getArg(0) == cur.real_current_font.language()->lang());
+ status.setOnOff(cmd.getArg(0) == cur.real_current_font.language()->lang());
break;
case LFUN_PARAGRAPH_BREAK:
@@ -3451,7 +3451,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
docstring const layout = resolveLayout(req_layout, cur);
enable = !owner_->forcePlainLayout() && !layout.empty();
- flag.setOnOff(isAlreadyLayout(layout, cur));
+ status.setOnOff(isAlreadyLayout(layout, cur));
break;
}
@@ -3660,7 +3660,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|| (cur.paragraph().layout().pass_thru && !allow_in_passthru)))
enable = false;
- flag.setEnabled(enable);
+ status.setEnabled(enable);
return true;
}
diff --git a/src/TextMetrics.h b/src/TextMetrics.h
index f7f30fa08e..096f92a7eb 100644
--- a/src/TextMetrics.h
+++ b/src/TextMetrics.h
@@ -221,9 +221,9 @@ public:
void setCursorFromCoordinates(Cursor & cur, int x, int y);
///
- int cursorX(CursorSlice const & cursor, bool boundary) const;
+ int cursorX(CursorSlice const & sl, bool boundary) const;
///
- int cursorY(CursorSlice const & cursor, bool boundary) const;
+ int cursorY(CursorSlice const & sl, bool boundary) const;
///
bool cursorHome(Cursor & cur);
diff --git a/src/frontends/qt/FloatPlacement.h b/src/frontends/qt/FloatPlacement.h
index 96d45dfc45..fcdafc3400 100644
--- a/src/frontends/qt/FloatPlacement.h
+++ b/src/frontends/qt/FloatPlacement.h
@@ -47,7 +47,7 @@ public:
///
void setPlacement(std::string const & placement);
///
- void setAlignment(std::string const & placement);
+ void setAlignment(std::string const & alignment);
///
std::string const getPlacement() const;
///
diff --git a/src/frontends/qt/GuiClipboard.h b/src/frontends/qt/GuiClipboard.h
index 9e48b4ee07..278adb8425 100644
--- a/src/frontends/qt/GuiClipboard.h
+++ b/src/frontends/qt/GuiClipboard.h
@@ -73,7 +73,7 @@ public:
void put(std::string const & text) const override;
void put(std::string const & lyx, docstring const & html, docstring const & text) override;
bool hasGraphicsContents(GraphicsType type = AnyGraphicsType) const override;
- bool hasTextContents(TextType typetype = AnyTextType) const override;
+ bool hasTextContents(TextType type = AnyTextType) const override;
bool isInternal() const override;
bool hasInternal() const override;
bool empty() const override;
diff --git a/src/frontends/qt/GuiCounter.h b/src/frontends/qt/GuiCounter.h
index fb589d6c7d..d512a8b06e 100644
--- a/src/frontends/qt/GuiCounter.h
+++ b/src/frontends/qt/GuiCounter.h
@@ -40,7 +40,7 @@ private:
bool checkWidgets(bool readonly) const override;
bool initialiseParams(std::string const & data) override;
//@}
- void processParams(InsetCommandParams const & icp);
+ void processParams(InsetCommandParams const & params);
///
void fillCombos();
///
diff --git a/src/frontends/qt/GuiGraphics.cpp b/src/frontends/qt/GuiGraphics.cpp
index 142f433759..10764c19ca 100644
--- a/src/frontends/qt/GuiGraphics.cpp
+++ b/src/frontends/qt/GuiGraphics.cpp
@@ -492,7 +492,7 @@ void GuiGraphics::on_angle_textChanged(const QString & file_name)
}
-void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
+void GuiGraphics::paramsToDialog(InsetGraphicsParams const & params)
{
static char const * const bb_units[] = { "bp", "cm", "mm", "in" };
static char const * const bb_units_gui[] = { N_("bp"), N_("cm"), N_("mm"), N_("in[[unit of measure]]") };
@@ -519,12 +519,12 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
//lyxerr << bufferFilePath();
string const name =
- igp.filename.outputFileName(fromqstr(bufferFilePath()));
+ params.filename.outputFileName(fromqstr(bufferFilePath()));
filename->setText(toqstr(name));
// set the bounding box values
- if (igp.bbox.empty()) {
- string const bb = readBoundingBox(igp.filename.absFileName());
+ if (params.bbox.empty()) {
+ string const bb = readBoundingBox(params.filename.absFileName());
// the values from the file always have the bigpoint-unit bp
doubleToWidget(lbX, token(bb, ' ', 0));
doubleToWidget(lbY, token(bb, ' ', 1));
@@ -537,32 +537,32 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
bbChanged = false;
} else {
// get the values from the inset
- doubleToWidget(lbX, igp.bbox.xl.value());
- string unit = unit_name[igp.bbox.xl.unit()];
+ doubleToWidget(lbX, params.bbox.xl.value());
+ string unit = unit_name[params.bbox.xl.unit()];
lbXunit->setCurrentIndex(lbXunit->findData(toqstr(unit)));
- doubleToWidget(lbY, igp.bbox.yb.value());
- unit = unit_name[igp.bbox.yb.unit()];
+ doubleToWidget(lbY, params.bbox.yb.value());
+ unit = unit_name[params.bbox.yb.unit()];
lbYunit->setCurrentIndex(lbYunit->findData(toqstr(unit)));
- doubleToWidget(rtX, igp.bbox.xr.value());
- unit = unit_name[igp.bbox.xr.unit()];
+ doubleToWidget(rtX, params.bbox.xr.value());
+ unit = unit_name[params.bbox.xr.unit()];
rtXunit->setCurrentIndex(rtXunit->findData(toqstr(unit)));
- doubleToWidget(rtY, igp.bbox.yt.value());
- unit = unit_name[igp.bbox.yt.unit()];
+ doubleToWidget(rtY, params.bbox.yt.value());
+ unit = unit_name[params.bbox.yt.unit()];
rtYunit->setCurrentIndex(rtYunit->findData(toqstr(unit)));
bbChanged = true;
}
// Update the draft and clip mode
- draftCB->setChecked(igp.draft);
- clip->setChecked(igp.clip);
- displayGB->setChecked(igp.display);
- displayscale->setText(toqstr(convert<string>(igp.lyxscale)));
+ draftCB->setChecked(params.draft);
+ clip->setChecked(params.clip);
+ displayGB->setChecked(params.display);
+ displayscale->setText(toqstr(convert<string>(params.lyxscale)));
// the output section (width/height)
- doubleToWidget(Scale, igp.scale);
+ doubleToWidget(Scale, params.scale);
//igp.scale defaults to 100, so we treat it as empty
- bool const scaleChecked = !igp.scale.empty() && igp.scale != "100";
+ bool const scaleChecked = !params.scale.empty() && params.scale != "100";
scaleCB->blockSignals(true);
scaleCB->setChecked(scaleChecked);
scaleCB->blockSignals(false);
@@ -578,17 +578,17 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
for (; it != end; ++it)
groupCO->addItem(toqstr(*it), toqstr(*it));
groupCO->insertItem(0, qt_("None"), QString());
- if (igp.groupId.empty())
+ if (params.groupId.empty())
groupCO->setCurrentIndex(0);
else
groupCO->setCurrentIndex(
- groupCO->findData(toqstr(igp.groupId), Qt::MatchExactly));
+ groupCO->findData(toqstr(params.groupId), Qt::MatchExactly));
groupCO->blockSignals(false);
- if (igp.width.value() == 0)
+ if (params.width.value() == 0)
lengthToWidgets(Width, widthUnit, _(autostr), defaultUnit);
else
- lengthToWidgets(Width, widthUnit, igp.width, defaultUnit);
+ lengthToWidgets(Width, widthUnit, params.width, defaultUnit);
bool const widthChecked = !Width->text().isEmpty() &&
Width->text() != qt_(autostr);
@@ -598,10 +598,10 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
Width->setEnabled(widthChecked);
widthUnit->setEnabled(widthChecked);
- if (igp.height.value() == 0)
+ if (params.height.value() == 0)
lengthToWidgets(Height, heightUnit, _(autostr), defaultUnit);
else
- lengthToWidgets(Height, heightUnit, igp.height, defaultUnit);
+ lengthToWidgets(Height, heightUnit, params.height, defaultUnit);
bool const heightChecked = !Height->text().isEmpty()
&& Height->text() != qt_(autostr);
@@ -618,11 +618,11 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
setAutoText();
updateAspectRatioStatus();
- doubleToWidget(angle, igp.rotateAngle);
- rotateOrderCB->setChecked(igp.scaleBeforeRotation);
+ doubleToWidget(angle, params.rotateAngle);
+ rotateOrderCB->setChecked(params.scaleBeforeRotation);
rotateOrderCB->setEnabled( (widthChecked || heightChecked || scaleChecked)
- && igp.rotateAngle != "0");
+ && params.rotateAngle != "0");
origin->clear();
@@ -631,13 +631,13 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
toqstr(rorigin_lyx_strs[i]));
}
- if (!igp.rotateOrigin.empty())
- origin->setCurrentIndex(origin->findData(toqstr(igp.rotateOrigin)));
+ if (!params.rotateOrigin.empty())
+ origin->setCurrentIndex(origin->findData(toqstr(params.rotateOrigin)));
else
origin->setCurrentIndex(0);
// latex section
- latexoptions->setText(toqstr(igp.special));
+ latexoptions->setText(toqstr(params.special));
// cf bug #3852
filename->setFocus();
}
diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index d9cc3644e1..dcac28f734 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -686,7 +686,7 @@ QStringList fileFilters(QString const & desc)
}
-QString formatToolTip(QString text, int em)
+QString formatToolTip(QString text, int width)
{
// 1. QTooltip activates word wrapping only if mightBeRichText()
// is true. So we convert the text to rich text.
@@ -704,9 +704,9 @@ QString formatToolTip(QString text, int em)
// Compute desired width in pixels
QFont const font = QToolTip::font();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
- int const px_width = em * QFontMetrics(font).horizontalAdvance("M");
+ int const px_width = width * QFontMetrics(font).horizontalAdvance("M");
#else
- int const px_width = em * QFontMetrics(font).width("M");
+ int const px_width = width * QFontMetrics(font).width("M");
#endif
// Determine the ideal width of the tooltip
QTextDocument td("");
@@ -723,12 +723,12 @@ QString formatToolTip(QString text, int em)
}
-QString qtHtmlToPlainText(QString const & html)
+QString qtHtmlToPlainText(QString const & text)
{
- if (!Qt::mightBeRichText(html))
- return html;
+ if (!Qt::mightBeRichText(text))
+ return text;
QTextDocument td;
- td.setHtml(html);
+ td.setHtml(text);
return td.toPlainText();
}
diff --git a/src/frontends/qt/qt_helpers.h b/src/frontends/qt/qt_helpers.h
index 92c72f3b26..102c0137de 100644
--- a/src/frontends/qt/qt_helpers.h
+++ b/src/frontends/qt/qt_helpers.h
@@ -244,9 +244,9 @@ private:
#endif
-// Check if qstr is understood as rich text (Qt HTML) and if so, produce a
+// Check if text is understood as rich text (Qt HTML) and if so, produce a
// rendering in plain text.
-QString qtHtmlToPlainText(QString const & qstr);
+QString qtHtmlToPlainText(QString const & text);
} // namespace lyx
diff --git a/src/insets/ExternalTransforms.h b/src/insets/ExternalTransforms.h
index 10c3dccd12..8b22f622c8 100644
--- a/src/insets/ExternalTransforms.h
+++ b/src/insets/ExternalTransforms.h
@@ -46,7 +46,7 @@ public:
class ExtraData {
public:
std::string const get(std::string const & id) const;
- void set(std::string const & id, std::string const & contents);
+ void set(std::string const & id, std::string const & data);
typedef std::map<std::string, std::string>::const_iterator const_iterator;
const_iterator begin() const { return data_.begin(); }
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index b561533998..14f9f7f19b 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -381,7 +381,7 @@ void Inset::doDispatch(Cursor & cur, FuncRequest &cmd)
bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
- FuncStatus & flag) const
+ FuncStatus & status) const
{
// LFUN_INSET_APPLY is sent from the dialogs when the data should
// be applied. This is either changed to LFUN_INSET_MODIFY (if the
@@ -396,20 +396,20 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
// Allow modification of our data.
// This needs to be handled in the doDispatch method of our
// instantiatable children.
- flag.setEnabled(true);
+ status.setEnabled(true);
return true;
case LFUN_INSET_INSERT:
// Don't allow insertion of new insets.
// Every inset that wants to allow new insets from open
// dialogs needs to override this.
- flag.setEnabled(false);
+ status.setEnabled(false);
return true;
case LFUN_INSET_SETTINGS:
if (cmd.argument().empty() || cmd.getArg(0) == insetName(lyxCode())) {
bool const enable = hasSettings();
- flag.setEnabled(enable);
+ status.setEnabled(enable);
return true;
} else {
return false;
@@ -417,12 +417,12 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
case LFUN_IN_MATHMACROTEMPLATE:
// By default we're not in a InsetMathMacroTemplate inset
- flag.setEnabled(false);
+ status.setEnabled(false);
return true;
case LFUN_IN_IPA:
// By default we're not in an IPA inset
- flag.setEnabled(false);
+ status.setEnabled(false);
return true;
default:
diff --git a/src/insets/InsetGraphicsParams.cpp b/src/insets/InsetGraphicsParams.cpp
index 9f55246098..a8c2a26239 100644
--- a/src/insets/InsetGraphicsParams.cpp
+++ b/src/insets/InsetGraphicsParams.cpp
@@ -82,25 +82,25 @@ void InsetGraphicsParams::init()
}
-void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
+void InsetGraphicsParams::copy(InsetGraphicsParams const & params)
{
- filename = igp.filename;
- lyxscale = igp.lyxscale;
- display = igp.display;
- scale = igp.scale;
- width = igp.width;
- height = igp.height;
- keepAspectRatio = igp.keepAspectRatio;
- draft = igp.draft;
- scaleBeforeRotation = igp.scaleBeforeRotation;
-
- bbox = igp.bbox;
- clip = igp.clip;
-
- rotateAngle = igp.rotateAngle;
- rotateOrigin = igp.rotateOrigin;
- special = igp.special;
- groupId = igp.groupId;
+ filename = params.filename;
+ lyxscale = params.lyxscale;
+ display = params.display;
+ scale = params.scale;
+ width = params.width;
+ height = params.height;
+ keepAspectRatio = params.keepAspectRatio;
+ draft = params.draft;
+ scaleBeforeRotation = params.scaleBeforeRotation;
+
+ bbox = params.bbox;
+ clip = params.clip;
+
+ rotateAngle = params.rotateAngle;
+ rotateOrigin = params.rotateOrigin;
+ special = params.special;
+ groupId = params.groupId;
}
diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index 3a61dfdccd..981fa536be 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -456,12 +456,12 @@ string InsetInfoParams::infoType() const
-InsetInfo::InsetInfo(Buffer * buf, string const & name)
+InsetInfo::InsetInfo(Buffer * buf, string const & info)
: InsetCollapsible(buf), initialized_(false)
{
params_.type = InsetInfoParams::UNKNOWN_INFO;
params_.force_ltr = false;
- setInfo(name);
+ setInfo(info);
status_ = Collapsed;
}
@@ -682,9 +682,9 @@ void InsetInfo::doDispatch(Cursor & cur, FuncRequest & cmd)
}
-void InsetInfo::setInfo(string const & name)
+void InsetInfo::setInfo(string const & info)
{
- if (name.empty())
+ if (info.empty())
return;
string saved_date_specifier;
@@ -693,7 +693,7 @@ void InsetInfo::setInfo(string const & name)
saved_date_specifier = split(params_.name, '@');
// info_type name
string type;
- params_.name = trim(split(name, type, ' '));
+ params_.name = trim(split(info, type, ' '));
params_.type = nameTranslator().find(type);
if (params_.name.empty())
params_.name = defaultValueTranslator().find(params_.type);
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index eeced08451..b624cce119 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -161,19 +161,19 @@ docstring InsetLabel::screenLabel() const
}
-void InsetLabel::updateBuffer(ParIterator const & par, UpdateType utype, bool const /*deleted*/)
+void InsetLabel::updateBuffer(ParIterator const & it, UpdateType utype, bool const /*deleted*/)
{
docstring const & label = getParam("name");
// Check if this one is active (i.e., neither deleted with change-tracking
// nor in an inset that does not produce output, such as notes or inactive branches)
- Paragraph const & para = par.paragraph();
- bool active = !para.isDeleted(par.pos()) && para.inInset().producesOutput();
+ Paragraph const & para = it.paragraph();
+ bool active = !para.isDeleted(it.pos()) && para.inInset().producesOutput();
// If not, check whether we are in a deleted/non-outputting inset
if (active) {
- for (size_type sl = 0 ; sl < par.depth() ; ++sl) {
- Paragraph const & outer_par = par[sl].paragraph();
- if (outer_par.isDeleted(par[sl].pos())
+ for (size_type sl = 0 ; sl < it.depth() ; ++sl) {
+ Paragraph const & outer_par = it[sl].paragraph();
+ if (outer_par.isDeleted(it[sl].pos())
|| !outer_par.inInset().producesOutput()) {
active = false;
break;
@@ -194,7 +194,7 @@ void InsetLabel::updateBuffer(ParIterator const & par, UpdateType utype, bool co
Counters const & cnts =
buffer().masterBuffer()->params().documentClass().counters();
active_counter_ = cnts.currentCounter();
- Language const * lang = par->getParLanguage(buffer().params());
+ Language const * lang = it->getParLanguage(buffer().params());
if (lang && !active_counter_.empty()) {
counter_value_ = cnts.theCounter(active_counter_, lang->code());
pretty_counter_ = cnts.prettyCounter(active_counter_, lang->code());
diff --git a/src/insets/InsetListingsParams.cpp b/src/insets/InsetListingsParams.cpp
index 54707418df..9390d6bbe4 100644
--- a/src/insets/InsetListingsParams.cpp
+++ b/src/insets/InsetListingsParams.cpp
@@ -948,12 +948,12 @@ docstring ParValidator::validate(string const & name,
}
-bool ParValidator::onoff(string const & name) const
+bool ParValidator::onoff(string const & key) const
{
int p = InsetListingsParams::package();
// locate name in parameter table
- ListingsParams::const_iterator it = all_params_[p].find(name);
+ ListingsParams::const_iterator it = all_params_[p].find(key);
if (it != all_params_[p].end())
return it->second.onoff_;
else
diff --git a/src/insets/InsetSeparator.h b/src/insets/InsetSeparator.h
index 3f8a84cb07..f7e0ab9059 100644
--- a/src/insets/InsetSeparator.h
+++ b/src/insets/InsetSeparator.h
@@ -43,7 +43,7 @@ public:
///
InsetSeparator();
///
- explicit InsetSeparator(InsetSeparatorParams const & par);
+ explicit InsetSeparator(InsetSeparatorParams const & params);
///
static void string2params(std::string const &, InsetSeparatorParams &);
///
diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h
index 1d200764a4..5cf7aa7303 100644
--- a/src/insets/InsetSpace.h
+++ b/src/insets/InsetSpace.h
@@ -99,7 +99,7 @@ public:
///
InsetSpace() : Inset(0) {}
///
- explicit InsetSpace(InsetSpaceParams const & par);
+ explicit InsetSpace(InsetSpaceParams const & params);
///
InsetSpaceParams const & params() const { return params_; }
///
diff --git a/src/mathed/InsetMath.cpp b/src/mathed/InsetMath.cpp
index 33a9a4e6b4..40cb906606 100644
--- a/src/mathed/InsetMath.cpp
+++ b/src/mathed/InsetMath.cpp
@@ -30,21 +30,21 @@ using namespace std;
namespace lyx {
-HullType hullType(docstring const & s)
-{
- if (s == "none") return hullNone;
- if (s == "simple") return hullSimple;
- if (s == "equation") return hullEquation;
- if (s == "eqnarray") return hullEqnArray;
- if (s == "align") return hullAlign;
- if (s == "alignat") return hullAlignAt;
- if (s == "xalignat") return hullXAlignAt;
- if (s == "xxalignat") return hullXXAlignAt;
- if (s == "multline") return hullMultline;
- if (s == "gather") return hullGather;
- if (s == "flalign") return hullFlAlign;
- if (s == "regexp") return hullRegexp;
- lyxerr << "unknown hull type '" << to_utf8(s) << "'" << endl;
+HullType hullType(docstring const & name)
+{
+ if (name == "none") return hullNone;
+ if (name == "simple") return hullSimple;
+ if (name == "equation") return hullEquation;
+ if (name == "eqnarray") return hullEqnArray;
+ if (name == "align") return hullAlign;
+ if (name == "alignat") return hullAlignAt;
+ if (name == "xalignat") return hullXAlignAt;
+ if (name == "xxalignat") return hullXXAlignAt;
+ if (name == "multline") return hullMultline;
+ if (name == "gather") return hullGather;
+ if (name == "flalign") return hullFlAlign;
+ if (name == "regexp") return hullRegexp;
+ lyxerr << "unknown hull type '" << to_utf8(name) << "'" << endl;
return hullUnknown;
}
diff --git a/src/mathed/InsetMathAMSArray.h b/src/mathed/InsetMathAMSArray.h
index 5186f5504e..ab9ead0bd0 100644
--- a/src/mathed/InsetMathAMSArray.h
+++ b/src/mathed/InsetMathAMSArray.h
@@ -34,7 +34,7 @@ public:
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
- void draw(PainterInfo & pain, int x, int y) const override;
+ void draw(PainterInfo & pi, int x, int y) const override;
///
InsetMathAMSArray * asAMSArrayInset() override { return this; }
///
diff --git a/src/mathed/InsetMathCases.cpp b/src/mathed/InsetMathCases.cpp
index 5ddb9d015e..09ad0f8fa8 100644
--- a/src/mathed/InsetMathCases.cpp
+++ b/src/mathed/InsetMathCases.cpp
@@ -32,8 +32,8 @@ using namespace lyx::support;
namespace lyx {
-InsetMathCases::InsetMathCases(Buffer * buf, row_type n)
- : InsetMathGrid(buf, 2, n, 'c', from_ascii("ll"))
+InsetMathCases::InsetMathCases(Buffer * buf, row_type rows)
+ : InsetMathGrid(buf, 2, rows, 'c', from_ascii("ll"))
{}
diff --git a/src/mathed/InsetMathDots.h b/src/mathed/InsetMathDots.h
index d2026de204..2650de0044 100644
--- a/src/mathed/InsetMathDots.h
+++ b/src/mathed/InsetMathDots.h
@@ -23,7 +23,7 @@ class latexkeys;
class InsetMathDots : public InsetMath {
public:
///
- explicit InsetMathDots(latexkeys const * l);
+ explicit InsetMathDots(latexkeys const * key);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
diff --git a/src/mathed/InsetMathMacroTemplate.cpp b/src/mathed/InsetMathMacroTemplate.cpp
index 294e24b073..1152936ee2 100644
--- a/src/mathed/InsetMathMacroTemplate.cpp
+++ b/src/mathed/InsetMathMacroTemplate.cpp
@@ -1087,7 +1087,7 @@ void InsetMathMacroTemplate::doDispatch(Cursor & cur, FuncRequest & cmd)
bool InsetMathMacroTemplate::getStatus(Cursor & cur, FuncRequest const & cmd,
- FuncStatus & flag) const
+ FuncStatus & status) const
{
bool ret = true;
string const arg = to_utf8(cmd.argument());
@@ -1098,12 +1098,12 @@ bool InsetMathMacroTemplate::getStatus(Cursor & cur, FuncRequest const & cmd,
num = convert<int>(arg);
bool on = (num >= optionals_
&& numargs_ < 9 && num <= numargs_ + 1);
- flag.setEnabled(on);
+ status.setEnabled(on);
break;
}
case LFUN_MATH_MACRO_APPEND_GREEDY_PARAM:
- flag.setEnabled(numargs_ < 9);
+ status.setEnabled(numargs_ < 9);
break;
case LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM:
@@ -1111,40 +1111,40 @@ bool InsetMathMacroTemplate::getStatus(Cursor & cur, FuncRequest const & cmd,
int num = numargs_;
if (!arg.empty())
num = convert<int>(arg);
- flag.setEnabled(num >= 1 && num <= numargs_);
+ status.setEnabled(num >= 1 && num <= numargs_);
break;
}
case LFUN_MATH_MACRO_MAKE_OPTIONAL:
- flag.setEnabled(numargs_ > 0
+ status.setEnabled(numargs_ > 0
&& optionals_ < numargs_
&& type_ != MacroTypeDef);
break;
case LFUN_MATH_MACRO_MAKE_NONOPTIONAL:
- flag.setEnabled(optionals_ > 0
+ status.setEnabled(optionals_ > 0
&& type_ != MacroTypeDef);
break;
case LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM:
- flag.setEnabled(numargs_ < 9);
+ status.setEnabled(numargs_ < 9);
break;
case LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM:
- flag.setEnabled(optionals_ > 0);
+ status.setEnabled(optionals_ > 0);
break;
case LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM:
- flag.setEnabled(numargs_ == 0
+ status.setEnabled(numargs_ == 0
&& type_ != MacroTypeDef);
break;
case LFUN_IN_MATHMACROTEMPLATE:
- flag.setEnabled(true);
+ status.setEnabled(true);
break;
default:
- ret = InsetMathNest::getStatus(cur, cmd, flag);
+ ret = InsetMathNest::getStatus(cur, cmd, status);
break;
}
return ret;
diff --git a/src/mathed/InsetMathMacroTemplate.h b/src/mathed/InsetMathMacroTemplate.h
index 24a0b14875..09408968d6 100644
--- a/src/mathed/InsetMathMacroTemplate.h
+++ b/src/mathed/InsetMathMacroTemplate.h
@@ -29,8 +29,8 @@ public:
///
explicit InsetMathMacroTemplate(Buffer * buf);
///
- InsetMathMacroTemplate(Buffer * buf, docstring const & name, int nargs,
- int optional, MacroType type,
+ InsetMathMacroTemplate(Buffer * buf, docstring const & name, int numargs,
+ int optionals, MacroType type,
std::vector<MathData> const & optionalValues = std::vector<MathData>(),
MathData const & def = MathData(),
MathData const & display = MathData());
diff --git a/src/mathed/InsetMathUnknown.cpp b/src/mathed/InsetMathUnknown.cpp
index 926e7dd5d5..e79a17c015 100644
--- a/src/mathed/InsetMathUnknown.cpp
+++ b/src/mathed/InsetMathUnknown.cpp
@@ -23,9 +23,9 @@
namespace lyx {
-InsetMathUnknown::InsetMathUnknown(docstring const & nm,
+InsetMathUnknown::InsetMathUnknown(docstring const & name,
docstring const & selection, bool final, bool black)
- : name_(nm), final_(final), black_(black), kerning_(0),
+ : name_(name), final_(final), black_(black), kerning_(0),
selection_(selection)
{}
diff --git a/src/mathed/MacroTable.cpp b/src/mathed/MacroTable.cpp
index c1a4c49312..fb2a9e08a4 100644
--- a/src/mathed/MacroTable.cpp
+++ b/src/mathed/MacroTable.cpp
@@ -63,7 +63,7 @@ MacroData::MacroData(Buffer * buf, InsetMathMacroTemplate const & macro)
}
-bool MacroData::expand(vector<MathData> const & args, MathData & to) const
+bool MacroData::expand(vector<MathData> const & from, MathData & to) const
{
updateData();
@@ -82,9 +82,9 @@ bool MacroData::expand(vector<MathData> const & args, MathData & to) const
//it.cell().erase(it.pos());
//it.cell().insert(it.pos(), it.nextInset()->asInsetMath()
size_t n = static_cast<InsetMathMacroArgument*>(it.nextInset())->number();
- if (n <= args.size()) {
+ if (n <= from.size()) {
it.cell().erase(it.pos());
- it.cell().insert(it.pos(), args[n - 1]);
+ it.cell().insert(it.pos(), from[n - 1]);
}
}
//LYXERR0("MathData::expand: res: " << inset.cell(0));
@@ -249,11 +249,11 @@ MacroTable::insert(docstring const & name, MacroData const & data)
MacroTable::iterator
-MacroTable::insert(Buffer * buf, docstring const & def)
+MacroTable::insert(Buffer * buf, docstring const & definition)
{
//lyxerr << "MacroTable::insert, def: " << to_utf8(def) << endl;
InsetMathMacroTemplate mac(buf);
- mac.fromString(def);
+ mac.fromString(definition);
MacroData data(buf, mac);
return insert(mac.name(), data);
}
diff --git a/src/mathed/TextPainter.cpp b/src/mathed/TextPainter.cpp
index 7ff8368d6b..fb7e7ff3a5 100644
--- a/src/mathed/TextPainter.cpp
+++ b/src/mathed/TextPainter.cpp
@@ -42,16 +42,16 @@ void TextPainter::draw(int x, int y, char_type const * str)
}
-void TextPainter::horizontalLine(int x, int y, int n, char_type c)
+void TextPainter::horizontalLine(int x, int y, int len, char_type c)
{
- for (int i = 0; i < n && i + x < xmax_; ++i)
+ for (int i = 0; i < len && i + x < xmax_; ++i)
at(x + i, y) = c;
}
-void TextPainter::verticalLine(int x, int y, int n, char_type c)
+void TextPainter::verticalLine(int x, int y, int len, char_type c)
{
- for (int i = 0; i < n && i + y < ymax_; ++i)
+ for (int i = 0; i < len && i + y < ymax_; ++i)
at(x, y + i) = c;
}
diff --git a/src/output_plaintext.h b/src/output_plaintext.h
index ebecc5ceba..8b2e4f9d1c 100644
--- a/src/output_plaintext.h
+++ b/src/output_plaintext.h
@@ -36,7 +36,7 @@ void writePlaintextFile(Buffer const & buf, odocstream &, OutputParams const &);
///
void writePlaintextParagraph(Buffer const & buf,
- Paragraph const & paragraphs,
+ Paragraph const & par,
odocstream & ofs,
OutputParams const &,
bool & ref_printed,
diff --git a/src/tex2lyx/tex2lyx.h b/src/tex2lyx/tex2lyx.h
index c73785ee88..cd7323ba0d 100644
--- a/src/tex2lyx/tex2lyx.h
+++ b/src/tex2lyx/tex2lyx.h
@@ -81,7 +81,7 @@ void parse_math(Parser & p, std::ostream & os, unsigned flags, mode_type mode);
/// in table.cpp
void handle_tabular(Parser & p, std::ostream & os, std::string const & name,
- std::string const & width, std::string const & halign,
+ std::string const & tabularwidth, std::string const & halign,
Context const & context);
--
2.28.0.windows.1
-------------- next part --------------
From e407e957febb0e8ba4fbb53b7b0bec97b814f2b1 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sun, 1 Nov 2020 11:00:02 +0200
Subject: [PATCH 05/10] Remove obsolete variant of `bformat`
---
src/support/lstrings.cpp | 10 ----------
src/support/lstrings.h | 1 -
2 files changed, 11 deletions(-)
diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp
index ad19d7f35d..32ee9818ee 100644
--- a/src/support/lstrings.cpp
+++ b/src/support/lstrings.cpp
@@ -1542,16 +1542,6 @@ docstring bformat(docstring const & fmt, docstring const & arg1, int arg2)
}
-docstring bformat(docstring const & fmt, char const * arg1, docstring const & arg2)
-{
- LATTEST(contains(fmt, from_ascii("%1$s")));
- LATTEST(contains(fmt, from_ascii("%2$s")));
- docstring str = subst(fmt, from_ascii("%1$s"), from_ascii(arg1));
- str = subst(str, from_ascii("%2$s"), arg2);
- return subst(str, from_ascii("%%"), from_ascii("%"));
-}
-
-
docstring bformat(docstring const & fmt, int arg1, int arg2)
{
LATTEST(contains(fmt, from_ascii("%1$d")));
diff --git a/src/support/lstrings.h b/src/support/lstrings.h
index 937196855c..cee60e8c85 100644
--- a/src/support/lstrings.h
+++ b/src/support/lstrings.h
@@ -373,7 +373,6 @@ docstring bformat(docstring const & fmt, docstring const & arg1);
docstring bformat(docstring const & fmt, char * arg1);
docstring bformat(docstring const & fmt, docstring const & arg1, docstring const & arg2);
docstring bformat(docstring const & fmt, docstring const & arg1, int arg2);
-docstring bformat(docstring const & fmt, char const * arg1, docstring const & arg2);
docstring bformat(docstring const & fmt, int arg1, int arg2);
docstring bformat(docstring const & fmt, docstring const & arg1, docstring const & arg2, docstring const & arg3);
docstring bformat(docstring const & fmt, docstring const & arg1, docstring const & arg2, docstring const & arg3, docstring const & arg4);
--
2.28.0.windows.1
-------------- next part --------------
From 6249218660d89f5b85faf8f0c1b4ec4dce2bcc98 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sun, 1 Nov 2020 12:57:14 +0200
Subject: [PATCH 06/10] Constify InsetQuotesParams
---
src/insets/InsetQuotes.cpp | 10 +++++-----
src/insets/InsetQuotes.h | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp
index c93de5a063..b9b6557a5e 100644
--- a/src/insets/InsetQuotes.cpp
+++ b/src/insets/InsetQuotes.cpp
@@ -100,7 +100,7 @@ char InsetQuotesParams::getStyleChar(QuoteStyle const & style) const
InsetQuotesParams::QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s,
- bool const allow_wildcards, QuoteStyle fb)
+ bool const allow_wildcards, QuoteStyle fb) const
{
QuoteStyle res = fb;
@@ -132,7 +132,7 @@ InsetQuotesParams::QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s,
InsetQuotesParams::QuoteSide InsetQuotesParams::getQuoteSide(string const & s,
- bool const allow_wildcards, QuoteSide fb)
+ bool const allow_wildcards, QuoteSide fb) const
{
QuoteSide res = fb;
@@ -164,7 +164,7 @@ InsetQuotesParams::QuoteSide InsetQuotesParams::getQuoteSide(string const & s,
InsetQuotesParams::QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s,
- bool const allow_wildcards, QuoteLevel fb)
+ bool const allow_wildcards, QuoteLevel fb) const
{
QuoteLevel res = fb;
@@ -574,7 +574,7 @@ map<string, docstring> InsetQuotesParams::getTypes() const
}
-docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langdef)
+docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langdef) const
{
docstring const styledesc =
bformat(_("%1$souter%2$s and %3$sinner%4$s[[quotation marks]]"),
@@ -592,7 +592,7 @@ docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langd
}
-docstring const InsetQuotesParams::getShortGuiLabel(docstring const & str)
+docstring const InsetQuotesParams::getShortGuiLabel(docstring const & str) const
{
string const s = to_ascii(str);
QuoteStyle const style = getQuoteStyle(s);
diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h
index 5bc7f39269..b4d96ffc75 100644
--- a/src/insets/InsetQuotes.h
+++ b/src/insets/InsetQuotes.h
@@ -86,9 +86,9 @@ public:
docstring getXMLQuote(char_type c) const;
/// Returns a descriptive label of a style suitable for dialog and menu
docstring const getGuiLabel(QuoteStyle const & qs,
- bool langdef = false);
+ bool langdef = false) const;
/// Returns a descriptive label of a given char
- docstring const getShortGuiLabel(docstring const & str);
+ docstring const getShortGuiLabel(docstring const & str) const;
///
int stylescount() const;
/// Returns the matching style shortcut char
@@ -96,15 +96,15 @@ public:
/// Returns the quote style from the shortcut string
QuoteStyle getQuoteStyle(std::string const & s,
bool const allow_wildcards = false,
- QuoteStyle fallback = EnglishQuotes);
+ QuoteStyle fallback = EnglishQuotes) const;
/// Returns the quote sind from the shortcut string
QuoteSide getQuoteSide(std::string const & s,
bool const allow_wildcards = false,
- QuoteSide fallback = OpeningQuote);
+ QuoteSide fallback = OpeningQuote) const;
/// Returns the quote level from the shortcut string
QuoteLevel getQuoteLevel(std::string const & s,
bool const allow_wildcards = false,
- QuoteLevel fallback = PrimaryQuotes);
+ QuoteLevel fallback = PrimaryQuotes) const;
};
///
--
2.28.0.windows.1
-------------- next part --------------
From ed75d8189c1372a5a1e124ace7ea792a95f75dc8 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sun, 1 Nov 2020 13:05:14 +0200
Subject: [PATCH 07/10] Use bool literals
---
src/convert/lyxconvert.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/convert/lyxconvert.cpp b/src/convert/lyxconvert.cpp
index fbe20d3a0f..52ad54bdad 100644
--- a/src/convert/lyxconvert.cpp
+++ b/src/convert/lyxconvert.cpp
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
(char*)"-platform", (char*)"minimal",
NULL };
int qtargsc = sizeof(qtargs) / sizeof(qtargs[0]) - 1;
- bool debug = (1 == 0);
+ bool debug = false;
while (arg < argc) {
if ('-' == argv[arg][0] && !strcmp(argv[arg], "-platform")) {
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
} else if ('-' == argv[arg][0] && 't' == argv[arg][1]) {
oformat = argv[++arg]; arg++ ;
} else if ('-' == argv[arg][0] && 'd' == argv[arg][1]) {
- debug = (1 == 1); arg++;
+ debug = true; arg++;
} else if ('-' == argv[arg][0] && 'V' == argv[arg][1]) {
version(myname);
} else if ('-' == argv[arg][0]) {
--
2.28.0.windows.1
-------------- next part --------------
From 5166067cff3f587eee7a9d33a0f2796eab3d8720 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sun, 1 Nov 2020 13:34:49 +0200
Subject: [PATCH 08/10] Use default member initialization
---
src/lyxfind.cpp | 82 +++++++++++++++++++------------------------------
1 file changed, 31 insertions(+), 51 deletions(-)
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 54683b0db3..4c004d5474 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -61,56 +61,51 @@ namespace lyx {
class IgnoreFormats {
public:
///
- IgnoreFormats()
- : ignoreFamily_(false), ignoreSeries_(false),
- ignoreShape_(false), ignoreUnderline_(false),
- ignoreMarkUp_(false), ignoreStrikeOut_(false),
- ignoreSectioning_(false), ignoreFrontMatter_(false),
- ignoreColor_(false), ignoreLanguage_(false) {}
+ IgnoreFormats() = default;
///
- bool getFamily() { return ignoreFamily_; }
+ bool getFamily() const { return ignoreFamily_; }
///
- bool getSeries() { return ignoreSeries_; }
+ bool getSeries() const { return ignoreSeries_; }
///
- bool getShape() { return ignoreShape_; }
+ bool getShape() const { return ignoreShape_; }
///
- bool getUnderline() { return ignoreUnderline_; }
+ bool getUnderline() const { return ignoreUnderline_; }
///
- bool getMarkUp() { return ignoreMarkUp_; }
+ bool getMarkUp() const { return ignoreMarkUp_; }
///
- bool getStrikeOut() { return ignoreStrikeOut_; }
+ bool getStrikeOut() const { return ignoreStrikeOut_; }
///
- bool getSectioning() { return ignoreSectioning_; }
+ bool getSectioning() const { return ignoreSectioning_; }
///
- bool getFrontMatter() { return ignoreFrontMatter_; }
+ bool getFrontMatter() const { return ignoreFrontMatter_; }
///
- bool getColor() { return ignoreColor_; }
+ bool getColor() const { return ignoreColor_; }
///
- bool getLanguage() { return ignoreLanguage_; }
+ bool getLanguage() const { return ignoreLanguage_; }
///
void setIgnoreFormat(string const & type, bool value);
private:
///
- bool ignoreFamily_;
+ bool ignoreFamily_ = false;
///
- bool ignoreSeries_;
+ bool ignoreSeries_ = false;
///
- bool ignoreShape_;
+ bool ignoreShape_ = false;
///
- bool ignoreUnderline_;
+ bool ignoreUnderline_ = false;
///
- bool ignoreMarkUp_;
+ bool ignoreMarkUp_ = false;
///
- bool ignoreStrikeOut_;
+ bool ignoreStrikeOut_ = false;
///
- bool ignoreSectioning_;
+ bool ignoreSectioning_ = false;
///
- bool ignoreFrontMatter_;
+ bool ignoreFrontMatter_ = false;
///
- bool ignoreColor_;
+ bool ignoreColor_ = false;
///
- bool ignoreLanguage_;
+ bool ignoreLanguage_ = false;
};
@@ -1065,35 +1060,20 @@ class KeyInfo {
* so that they can be ignored */
endArguments
};
- KeyInfo()
- : keytype(invalid),
- head(""),
- _tokensize(-1),
- _tokenstart(-1),
- _dataStart(-1),
- _dataEnd(-1),
- parenthesiscount(1),
- disabled(false),
- used(false)
- {};
+ KeyInfo() = default;
KeyInfo(KeyType type, int parcount, bool disable)
: keytype(type),
- _tokensize(-1),
- _tokenstart(-1),
- _dataStart(-1),
- _dataEnd(-1),
parenthesiscount(parcount),
- disabled(disable),
- used(false) {};
- KeyType keytype;
+ disabled(disable) {}
+ KeyType keytype = invalid;
string head;
- int _tokensize;
- int _tokenstart;
- int _dataStart;
- int _dataEnd;
- int parenthesiscount;
- bool disabled;
- bool used; /* by pattern */
+ int _tokensize = -1;
+ int _tokenstart = -1;
+ int _dataStart = -1;
+ int _dataEnd = -1;
+ int parenthesiscount = 1;
+ bool disabled = false;
+ bool used = false; /* by pattern */
};
class Border {
--
2.28.0.windows.1
-------------- next part --------------
From 59f1e4339fa9fe0aa01b93b8bc5ea539cf2c528c Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sun, 1 Nov 2020 14:00:49 +0200
Subject: [PATCH 09/10] Constify LaTeXFont
---
src/LaTeXFonts.cpp | 28 +++++++++++------------
src/LaTeXFonts.h | 56 +++++++++++++++++++++++-----------------------
2 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp
index d28a7d2930..c9d030e8c3 100644
--- a/src/LaTeXFonts.cpp
+++ b/src/LaTeXFonts.cpp
@@ -35,13 +35,13 @@ namespace lyx {
LaTeXFonts latexfonts;
-LaTeXFont LaTeXFont::altFont(docstring const & name)
+LaTeXFont LaTeXFont::altFont(docstring const & name) const
{
return theLaTeXFonts().getAltFont(name);
}
-bool LaTeXFont::available(bool ot1, bool nomath)
+bool LaTeXFont::available(bool ot1, bool nomath) const
{
if (nomath && !nomathfont_.empty())
return altFont(nomathfont_).available(ot1, nomath);
@@ -66,7 +66,7 @@ bool LaTeXFont::available(bool ot1, bool nomath)
}
-bool LaTeXFont::providesNoMath(bool ot1, bool complete)
+bool LaTeXFont::providesNoMath(bool ot1, bool complete) const
{
docstring const usedfont = getUsedFont(ot1, complete, false, false);
@@ -79,7 +79,7 @@ bool LaTeXFont::providesNoMath(bool ot1, bool complete)
}
-bool LaTeXFont::providesOSF(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesOSF(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
@@ -96,7 +96,7 @@ bool LaTeXFont::providesOSF(bool ot1, bool complete, bool nomath)
}
-bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
@@ -111,7 +111,7 @@ bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath)
}
-bool LaTeXFont::hasMonolithicExpertSet(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::hasMonolithicExpertSet(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
@@ -124,7 +124,7 @@ bool LaTeXFont::hasMonolithicExpertSet(bool ot1, bool complete, bool nomath)
}
-bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
@@ -138,7 +138,7 @@ bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath)
}
-bool LaTeXFont::providesMoreOptions(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesMoreOptions(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
@@ -152,7 +152,7 @@ bool LaTeXFont::providesMoreOptions(bool ot1, bool complete, bool nomath)
return (moreopts_);
}
-bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool nomath)
+bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
@@ -171,7 +171,7 @@ bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool
}
-docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath, bool osf)
+docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath, bool osf) const
{
if (osf && osfFontOnly())
return osffont_;
@@ -211,7 +211,7 @@ docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath, boo
}
-docstring const LaTeXFont::getUsedPackage(bool ot1, bool complete, bool nomath)
+docstring const LaTeXFont::getUsedPackage(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
if (usedfont.empty())
@@ -220,7 +220,7 @@ docstring const LaTeXFont::getUsedPackage(bool ot1, bool complete, bool nomath)
}
-string const LaTeXFont::getAvailablePackage(bool dryrun)
+string const LaTeXFont::getAvailablePackage(bool dryrun) const
{
if (package_.empty())
return string();
@@ -245,7 +245,7 @@ string const LaTeXFont::getAvailablePackage(bool dryrun)
string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool osf,
- int scale, string const & extraopts, bool nomath)
+ int scale, string const & extraopts, bool nomath) const
{
ostringstream os;
bool const needosfopt = (osf != osfdefault_);
@@ -292,7 +292,7 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool
string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool sc,
- bool osf, bool nomath, string const & extraopts, int scale)
+ bool osf, bool nomath, string const & extraopts, int scale) const
{
ostringstream os;
diff --git a/src/LaTeXFonts.h b/src/LaTeXFonts.h
index 1da7d06e4f..8aae4ae31c 100644
--- a/src/LaTeXFonts.h
+++ b/src/LaTeXFonts.h
@@ -30,42 +30,42 @@ public:
LaTeXFont() : osfdefault_(false), switchdefault_(false), moreopts_(false),
osffontonly_(false) { fontenc_.push_back("T1"); }
/// The font name
- docstring const & name() { return name_; }
+ docstring const & name() const { return name_; }
/// The name to appear in the document dialog
- docstring const & guiname() { return guiname_; }
+ docstring const & guiname() const { return guiname_; }
/// Font family (rm, sf, tt)
- docstring const & family() { return family_; }
+ docstring const & family() const { return family_; }
/// The package that provides this font
- docstring const & package() { return package_; }
+ docstring const & package() const { return package_; }
/// Does this provide a specific font encoding?
bool hasFontenc(std::string const &) const;
/// The font encoding(s)
std::vector<std::string> const & fontencs() const { return fontenc_; }
/// Alternative font if package() is not available
- std::vector<docstring> const & altfonts() { return altfonts_; }
+ std::vector<docstring> const & altfonts() const { return altfonts_; }
/// A font that provides all families
- docstring const & completefont() { return completefont_; }
+ docstring const & completefont() const { return completefont_; }
/// A font specifically needed for OT1 font encoding
- docstring const & ot1font() { return ot1font_; }
+ docstring const & ot1font() const { return ot1font_; }
/// A font that provides Old Style Figures for this type face
- docstring const & osffont() { return osffont_; }
+ docstring const & osffont() const { return osffont_; }
/// A package option for Old Style Figures
- docstring const & osfoption() { return osfoption_; }
+ docstring const & osfoption() const { return osfoption_; }
/// A package option for true SmallCaps
- docstring const & scoption() { return scoption_; }
+ docstring const & scoption() const { return scoption_; }
/// A package option for both Old Style Figures and SmallCaps
- docstring const & osfscoption() { return osfscoption_; }
+ docstring const & osfscoption() const { return osfscoption_; }
/// A package option for font scaling
- docstring const & scaleoption() { return scaleoption_; }
+ docstring const & scaleoption() const { return scaleoption_; }
/// A macro for font scaling
- docstring const & scalecmd() { return scalecmd_; }
+ docstring const & scalecmd() const { return scalecmd_; }
/// Does this provide additional options?
- bool providesMoreOptions(bool ot1, bool complete, bool nomath);
+ bool providesMoreOptions(bool ot1, bool complete, bool nomath) const;
/// Alternative requirement to test for
- docstring const & required() { return required_; }
+ docstring const & required() const { return required_; }
/// Does this font provide a given \p feature
bool provides(std::string const & name, bool ot1,
- bool complete, bool nomath);
+ bool complete, bool nomath) const;
/// Issue the familydefault switch
bool switchdefault() const { return switchdefault_; }
/// Does the font provide Old Style Figures as default?
@@ -73,35 +73,35 @@ public:
/// Does OSF font replace (rather than complement) the non-OSF one?
bool osfFontOnly() const { return osffontonly_; }
/// Is this font available?
- bool available(bool ot1, bool nomath);
+ bool available(bool ot1, bool nomath) const;
/// Does this font provide an alternative without math?
- bool providesNoMath(bool ot1, bool complete);
+ bool providesNoMath(bool ot1, bool complete) const;
/// Does this font provide Old Style Figures?
- bool providesOSF(bool ot1, bool complete, bool nomath);
+ bool providesOSF(bool ot1, bool complete, bool nomath) const;
/// Does this font provide optional true SmallCaps?
- bool providesSC(bool ot1, bool complete, bool nomath);
+ bool providesSC(bool ot1, bool complete, bool nomath) const;
/** does this font provide OSF and Small Caps only via
* a single, undifferentiated expert option?
*/
- bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath);
+ bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath) const;
/// Does this font provide scaling?
- bool providesScale(bool ot1, bool complete, bool nomath);
+ bool providesScale(bool ot1, bool complete, bool nomath) const;
/// Return the LaTeX Code
std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
bool sc, bool osf, bool nomath,
std::string const & extraopts = std::string(),
- int scale = 100);
+ int scale = 100) const;
/// Return the actually used font
- docstring const getUsedFont(bool ot1, bool complete, bool nomath, bool osf);
+ docstring const getUsedFont(bool ot1, bool complete, bool nomath, bool osf) const;
/// Return the actually used package
- docstring const getUsedPackage(bool ot1, bool complete, bool nomath);
+ docstring const getUsedPackage(bool ot1, bool complete, bool nomath) const;
///
bool read(Lexer & lex);
///
bool readFont(Lexer & lex);
private:
/// Return the preferred available package
- std::string const getAvailablePackage(bool dryrun);
+ std::string const getAvailablePackage(bool dryrun) const;
/// Return the package options
std::string const getPackageOptions(bool ot1,
bool complete,
@@ -109,9 +109,9 @@ private:
bool osf,
int scale,
std::string const & extraopts,
- bool nomath);
+ bool nomath) const;
/// Return an alternative font
- LaTeXFont altFont(docstring const & name);
+ LaTeXFont altFont(docstring const & name) const;
///
docstring name_;
///
--
2.28.0.windows.1
-------------- next part --------------
From 48ad9ae730f5feee7070f5077e65eaeff8978bde Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sun, 1 Nov 2020 17:50:35 +0200
Subject: [PATCH 10/10] Correct constness for Author and AuthorList
---
src/Author.cpp | 19 +++++++++++++++++++
src/Author.h | 10 ++++++++--
src/Buffer.cpp | 7 ++++---
src/Changes.cpp | 2 +-
src/Changes.h | 2 +-
src/Paragraph.cpp | 2 +-
src/Paragraph.h | 2 +-
7 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/src/Author.cpp b/src/Author.cpp
index b4cf9fd97b..2d1e2682ef 100644
--- a/src/Author.cpp
+++ b/src/Author.cpp
@@ -147,6 +147,13 @@ void AuthorList::recordCurrentAuthor(Author const & a)
}
+Author & AuthorList::get(int id)
+{
+ LASSERT(id < (int)authors_.size() , return authors_[0]);
+ return authors_[id];
+}
+
+
Author const & AuthorList::get(int id) const
{
LASSERT(id < (int)authors_.size() , return authors_[0]);
@@ -154,6 +161,18 @@ Author const & AuthorList::get(int id) const
}
+AuthorList::Authors::iterator AuthorList::begin()
+{
+ return authors_.begin();
+}
+
+
+AuthorList::Authors::iterator AuthorList::end()
+{
+ return authors_.end();
+}
+
+
AuthorList::Authors::const_iterator AuthorList::begin() const
{
return authors_.begin();
diff --git a/src/Author.h b/src/Author.h
index 798cfd8043..ff4f000848 100644
--- a/src/Author.h
+++ b/src/Author.h
@@ -39,9 +39,9 @@ public:
///
int bufferId() const { return buffer_id_; }
///
- void setBufferId(int buffer_id) const { buffer_id_ = buffer_id; }
+ void setBufferId(int buffer_id) { buffer_id_ = buffer_id; }
///
- void setUsed(bool u) const { used_ = u; }
+ void setUsed(bool u) { used_ = u; }
///
bool used() const { return used_; }
/// Was the author line not missing?
@@ -76,12 +76,18 @@ public:
///
void recordCurrentAuthor(Author const & a);
///
+ Author & get(int id);
+ ///
Author const & get(int id) const;
///
void sort();
///
typedef std::vector<Author> Authors;
///
+ Authors::iterator begin();
+ ///
+ Authors::iterator end();
+ ///
Authors::const_iterator begin() const;
///
Authors::const_iterator end() const;
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index d1831d49aa..70e2decc19 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1685,17 +1685,18 @@ bool Buffer::write(ostream & ofs) const
/// For each author, set 'used' to true if there is a change
/// by this author in the document; otherwise set it to 'false'.
- for (Author const & a : params().authors())
+ BufferParams & params = const_cast<Buffer *>(this)->params();
+ for (Author & a : params.authors())
a.setUsed(false);
ParIterator const end = const_cast<Buffer *>(this)->par_iterator_end();
ParIterator it = const_cast<Buffer *>(this)->par_iterator_begin();
for ( ; it != end; ++it)
- it->checkAuthors(params().authors());
+ it->checkAuthors(params.authors());
// now write out the buffer parameters.
ofs << "\\begin_header\n";
- params().writeFile(ofs, this);
+ params.writeFile(ofs, this);
ofs << "\\end_header\n";
// write the text
diff --git a/src/Changes.cpp b/src/Changes.cpp
index 7e97a24d10..c3f128cf8c 100644
--- a/src/Changes.cpp
+++ b/src/Changes.cpp
@@ -502,7 +502,7 @@ void Changes::lyxMarkChange(ostream & os, BufferParams const & bparams, int & co
}
-void Changes::checkAuthors(AuthorList const & authorList)
+void Changes::checkAuthors(AuthorList & authorList) const
{
for (ChangeRange const & cr : table_)
if (cr.change.type != Change::UNCHANGED)
diff --git a/src/Changes.h b/src/Changes.h
index 6146b5a0f2..af1780947c 100644
--- a/src/Changes.h
+++ b/src/Changes.h
@@ -132,7 +132,7 @@ public:
int & column, Change const & old, Change const & change);
///
- void checkAuthors(AuthorList const & authorList);
+ void checkAuthors(AuthorList & authorList) const;
///
void addToToc(DocIterator const & cdit, Buffer const & buffer,
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index c668f3b686..cdc173c65c 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -4248,7 +4248,7 @@ int Paragraph::fixBiblio(Buffer const & buffer)
}
-void Paragraph::checkAuthors(AuthorList const & authorList)
+void Paragraph::checkAuthors(AuthorList & authorList)
{
d->changes_.checkAuthors(authorList);
}
diff --git a/src/Paragraph.h b/src/Paragraph.h
index 4812684c3d..ea09784cb1 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -455,7 +455,7 @@ public:
/// For each author, set 'used' to true if there is a change
/// by this author in the paragraph.
- void checkAuthors(AuthorList const & authorList);
+ void checkAuthors(AuthorList & authorList);
///
void changeCase(BufferParams const & bparams, pos_type pos,
--
2.28.0.windows.1
More information about the lyx-devel
mailing list