From d6a7ec506eb4145f5a8108684222e77b695d21f9 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Mon, 4 May 2020 14:05:44 -0400 Subject: [PATCH] s/requires_/required_/ for code consistency --- src/LaTeXFonts.cpp | 28 ++++++++++++++-------------- src/LaTeXFonts.h | 4 ++-- src/Language.cpp | 2 +- src/Language.h | 4 ++-- src/Layout.cpp | 10 +++++----- src/Layout.h | 4 ++-- src/TextClass.cpp | 2 +- src/TextClass.h | 4 ++-- src/insets/InsetLayout.cpp | 2 +- src/insets/InsetLayout.h | 4 ++-- src/mathed/InsetMathMacro.cpp | 8 ++++---- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp index b52a8c06d5..12c0856c5d 100644 --- a/src/LaTeXFonts.cpp +++ b/src/LaTeXFonts.cpp @@ -48,12 +48,12 @@ bool LaTeXFont::available(bool ot1, bool nomath) else if (ot1 && !ot1font_.empty()) return (ot1font_ == "none") ? true : altFont(ot1font_).available(ot1, nomath); - else if (requires_.empty() && package_.empty()) + else if (required_.empty() && package_.empty()) return true; - else if (!requires_.empty() - && LaTeXFeatures::isAvailable(to_ascii(requires_))) + else if (!required_.empty() + && LaTeXFeatures::isAvailable(to_ascii(required_))) return true; - else if (requires_.empty() && !package_.empty() + else if (required_.empty() && !package_.empty() && LaTeXFeatures::isAvailable(to_ascii(package_))) return true; else if (!altfonts_.empty()) { @@ -181,19 +181,19 @@ docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath) && altFont(completefont_).available(ot1, nomath)) return completefont_; else if (switchdefault_) { - if (requires_.empty() - || (!requires_.empty() - && LaTeXFeatures::isAvailable(to_ascii(requires_)))) + if (required_.empty() + || (!required_.empty() + && LaTeXFeatures::isAvailable(to_ascii(required_)))) return name_; } - else if (!requires_.empty() - && LaTeXFeatures::isAvailable(to_ascii(requires_))) + else if (!required_.empty() + && LaTeXFeatures::isAvailable(to_ascii(required_))) return name_; else if (!package_.empty() && LaTeXFeatures::isAvailable(to_ascii(package_))) return name_; else if (!preamble_.empty() && package_.empty() - && requires_.empty() && !switchdefault_ + && required_.empty() && !switchdefault_ && altfonts_.empty()) { return name_; } @@ -224,7 +224,7 @@ string const LaTeXFont::getAvailablePackage(bool dryrun) return string(); string const package = to_ascii(package_); - if (!requires_.empty() && LaTeXFeatures::isAvailable(to_ascii(requires_))) + if (!required_.empty() && LaTeXFeatures::isAvailable(to_ascii(required_))) return package; else if (LaTeXFeatures::isAvailable(package)) return package; @@ -232,7 +232,7 @@ string const LaTeXFont::getAvailablePackage(bool dryrun) else if (dryrun) return package; - docstring const req = requires_.empty() ? package_ : requires_; + docstring const req = required_.empty() ? package_ : required_; frontend::Alert::warning(_("Font not available"), bformat(_("The LaTeX package `%1$s' needed for the font `%2$s'\n" "is not available on your system. LyX will fall back to the default font."), @@ -314,7 +314,7 @@ string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool frontend::Alert::warning(_("Font not available"), bformat(_("The LaTeX package `%1$s' needed for the font `%2$s'\n" "is not available on your system. LyX will fall back to the default font."), - requires_, guiname_), true); + required_, guiname_), true); } else { string const package = getAvailablePackage(dryrun); @@ -474,7 +474,7 @@ bool LaTeXFont::readFont(Lexer & lex) break; } case LF_REQUIRES: - lex >> requires_; + lex >> required_; break; case LF_SCALEOPTION: lex >> scaleoption_; diff --git a/src/LaTeXFonts.h b/src/LaTeXFonts.h index 481c2f78cb..79bd34b7ec 100644 --- a/src/LaTeXFonts.h +++ b/src/LaTeXFonts.h @@ -59,7 +59,7 @@ public: /// Does this provide additional options? bool providesMoreOptions(bool ot1, bool complete, bool nomath); /// Alternative requirement to test for - docstring const & required() { return requires_; } + docstring const & required() { return required_; } /// Does this font provide a given \p feature bool provides(std::string const & name, bool ot1, bool complete, bool nomath); @@ -140,7 +140,7 @@ private: /// std::vector provides_; /// - docstring requires_; + docstring required_; /// docstring preamble_; /// diff --git a/src/Language.cpp b/src/Language.cpp index 809e04bcfb..9b176286c8 100644 --- a/src/Language.cpp +++ b/src/Language.cpp @@ -258,7 +258,7 @@ bool Language::readLanguage(Lexer & lex) lex.getLongString(from_ascii("EndPreBabelPreamble")); break; case LA_REQUIRES: - lex >> requires_; + lex >> required_; break; case LA_PROVIDES: lex >> provides_; diff --git a/src/Language.h b/src/Language.h index 2e03644139..c810974727 100644 --- a/src/Language.h +++ b/src/Language.h @@ -57,7 +57,7 @@ public: /// active characters std::string const activeChars() const { return active_chars_; } /// requirement (package, function) - std::string const required() const { return requires_; } + std::string const required() const { return required_; } /// provides feature std::string const provides() const { return provides_; } /// translatable GUI name @@ -125,7 +125,7 @@ private: /// trivstring active_chars_; /// - trivstring requires_; + trivstring required_; /// trivstring provides_; /// diff --git a/src/Layout.cpp b/src/Layout.cpp index 3ed2ddf6c8..877464f240 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -607,7 +607,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass) lex.eatLine(); vector const req = getVectorFromString(lex.getString(true)); - requires_.insert(req.begin(), req.end()); + required_.insert(req.begin(), req.end()); break; } @@ -1443,11 +1443,11 @@ void Layout::write(ostream & os) const case Spacing::Default: break; } - if (!requires_.empty()) { + if (!required_.empty()) { os << "\tRequires "; - for (set::const_iterator it = requires_.begin(); - it != requires_.end(); ++it) { - if (it != requires_.begin()) + for (set::const_iterator it = required_.begin(); + it != required_.end(); ++it) { + if (it != required_.begin()) os << ','; os << *it; } diff --git a/src/Layout.h b/src/Layout.h index edb9ba7f18..ffc976d8ff 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -153,7 +153,7 @@ public: /// this layout for language \p lang docstring const babelpreamble() const { return babelpreamble_; } /// - std::set const & required() const { return requires_; } + std::set const & required() const { return required_; } /// std::set const & autonests() const { return autonests_; } /// @@ -483,7 +483,7 @@ private: /// Are adjacent paragraphs handled as one group? bool par_group_; /// Packages needed for this layout - std::set requires_; + std::set required_; /// Layouts that are by default nested after this one std::set autonests_; /// Layouts that by auto-nest this one diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 0f3273e152..c22e7ae126 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -686,7 +686,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) lexrc.eatLine(); vector const req = getVectorFromString(lexrc.getString()); - requires_.insert(req.begin(), req.end()); + required_.insert(req.begin(), req.end()); break; } diff --git a/src/TextClass.h b/src/TextClass.h index 64fa9aa127..65891397b9 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -304,7 +304,7 @@ protected: /// latex packages loaded by document class. std::set provides_; /// latex packages requested by document class. - std::set requires_; + std::set required_; /// std::map package_options_; /// default modules wanted by document class @@ -490,7 +490,7 @@ public: /// is this feature already provided by the class? bool provides(std::string const & p) const; /// features required by the class? - std::set const & required() const { return requires_; } + std::set const & required() const { return required_; } /// package options to write to LaTeX file std::map const & packageOptions() const { return package_options_; } diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index 8df2ca5e8b..7bb8b175f1 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -497,7 +497,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass, lex.eatLine(); vector const req = getVectorFromString(lex.getString(true)); - requires_.insert(req.begin(), req.end()); + required_.insert(req.begin(), req.end()); break; } case IL_SPELLCHECK: diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index 8f3099438a..3bab0a4898 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -149,7 +149,7 @@ public: /// Defaults to true. bool htmlisblock() const { return htmlisblock_; } /// - std::set required() const { return requires_; } + std::set required() const { return required_; } /// bool isMultiPar() const { return multipar_; } /// @@ -276,7 +276,7 @@ private: /// bool htmlisblock_; /// - std::set requires_; + std::set required_; /// bool multipar_; /// diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index d296130faf..bdf86258c7 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -239,7 +239,7 @@ public: /// mutable std::map editing_; /// - std::string requires_; + std::string required_; /// update macro representation bool needsUpdate_; /// @@ -644,7 +644,7 @@ void InsetMathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc, d->nesting_ = nesting; // update requires - d->requires_ = d->macro_->required(); + d->required_ = d->macro_->required(); if (!d->needsUpdate_ // non-normal mode? We are done! @@ -906,8 +906,8 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const // instant preview is on for math, in which case we will be missing // the corresponding requirements. // In this case, we get the required info from the global macro table. - if (!d->requires_.empty()) - features.require(d->requires_); + if (!d->required_.empty()) + features.require(d->required_); else if (!d->macro_) { // Update requires for known global macros. MacroData const * data = MacroTable::globalMacros().get(name());