From 2d49fa67d01d03ad393fa76306dc27de1a9281a1 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Fri, 28 Feb 2020 00:36:55 -0500 Subject: [PATCH] More requires --> required, for C++2a. --- src/BufferParams.cpp | 4 ++-- src/CiteEnginesList.cpp | 2 +- src/CiteEnginesList.h | 2 +- src/Floating.cpp | 2 +- src/Floating.h | 6 +++--- src/LaTeXFeatures.cpp | 8 ++++---- src/LaTeXFonts.h | 2 +- src/Language.cpp | 4 ++-- src/Language.h | 2 +- src/frontends/qt/GuiDocument.cpp | 8 ++++---- src/mathed/InsetMathDecoration.cpp | 4 ++-- src/mathed/InsetMathDots.cpp | 4 ++-- src/mathed/InsetMathMacro.cpp | 6 +++--- src/mathed/InsetMathSymbol.cpp | 4 ++-- src/mathed/MacroTable.cpp | 4 ++-- src/mathed/MacroTable.h | 2 +- src/mathed/MathFactory.cpp | 20 ++++++++++---------- src/mathed/MathParser.h | 2 +- src/mathed/MathSupport.cpp | 2 +- 19 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 1155bc642f..2ad8d32cd7 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1606,8 +1606,8 @@ void BufferParams::validate(LaTeXFeatures & features) const if (use_microtype) features.require("microtype"); - if (!language->requires().empty()) - features.require(language->requires()); + if (!language->required().empty()) + features.require(language->required()); } diff --git a/src/CiteEnginesList.cpp b/src/CiteEnginesList.cpp index 58b686511b..f58fa72cda 100644 --- a/src/CiteEnginesList.cpp +++ b/src/CiteEnginesList.cpp @@ -110,7 +110,7 @@ bool LyXCiteEngine::isDefaultBiblio(string const & bf) const } -bool LyXCiteEngine::requires(const string p) const +bool LyXCiteEngine::required(const string p) const { return find(package_list_.begin(), package_list_.end(), p) != package_list_.end(); } diff --git a/src/CiteEnginesList.h b/src/CiteEnginesList.h index 2f419b4bfe..ad703325c6 100644 --- a/src/CiteEnginesList.h +++ b/src/CiteEnginesList.h @@ -80,7 +80,7 @@ public: std::vector const & getPackageList() const { return package_list_; } /// - bool requires(std::string const p) const; + bool required(std::string const p) const; private: /// what appears in the ui std::string name_; diff --git a/src/Floating.cpp b/src/Floating.cpp index 9074c3922d..3f6eb548e7 100644 --- a/src/Floating.cpp +++ b/src/Floating.cpp @@ -35,7 +35,7 @@ Floating::Floating(string const & type, string const & placement, bool allowswide, bool allowssideways) : floattype_(type), placement_(placement), ext_(ext), within_(within), style_(style), name_(name), listname_(listName), listcommand_(listCmd), - refprefix_(refPrefix), allowedplacement_(allowedplacement), requires_(requires), + refprefix_(refPrefix), allowedplacement_(allowedplacement), required_(requires), usesfloatpkg_(usesfloat), ispredefined_(ispredefined), allowswide_(allowswide), allowssideways_(allowssideways), html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle) diff --git a/src/Floating.h b/src/Floating.h index e4c9e130f9..f013ed2270 100644 --- a/src/Floating.h +++ b/src/Floating.h @@ -37,7 +37,7 @@ public: std::string const & listName, std::string const & listCmd, std::string const & refPrefix, std::string const & allowedplacement, std::string const & htmlType, std::string const & htmlClass, - docstring const & htmlStyle, std::string const & requires, + docstring const & htmlStyle, std::string const & required, bool usesfloat, bool isprefined, bool allowswide, bool allowssideways); /// @@ -66,7 +66,7 @@ public: /// bool usesFloatPkg() const { return usesfloatpkg_; } /// allowed placement options - std::string const & requires() const { return requires_; } + std::string const & required() const { return required_; } /// bool isPredefined() const { return ispredefined_; } /// @@ -103,7 +103,7 @@ private: /// std::string allowedplacement_; /// - std::string requires_; + std::string required_; /// bool usesfloatpkg_; /// diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index ced53bfe42..a1190e0618 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -878,8 +878,8 @@ void LaTeXFeatures::useFloat(string const & name, bool subfloat) if (!fl.floattype().empty()) { if (fl.usesFloatPkg()) require("float"); - if (!fl.requires().empty()) { - vector reqs = getVectorFromString(fl.requires()); + if (!fl.required().empty()) { + vector reqs = getVectorFromString(fl.required()); for (auto const req : reqs) require(req); } @@ -891,8 +891,8 @@ void LaTeXFeatures::useLanguage(Language const * lang) { if (!lang->babel().empty() || !lang->polyglossia().empty()) UsedLanguages_.insert(lang); - if (!lang->requires().empty()) - require(lang->requires()); + if (!lang->required().empty()) + require(lang->required()); // currently only supported for Babel if (!lang->provides().empty() && useBabel()) provide(lang->provides()); diff --git a/src/LaTeXFonts.h b/src/LaTeXFonts.h index 6d08cb9fce..481c2f78cb 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 & requires() { return requires_; } + docstring const & required() { return requires_; } /// Does this font provide a given \p feature bool provides(std::string const & name, bool ot1, bool complete, bool nomath); diff --git a/src/Language.cpp b/src/Language.cpp index 6bccf7a104..809e04bcfb 100644 --- a/src/Language.cpp +++ b/src/Language.cpp @@ -45,13 +45,13 @@ Language const * reset_language = 0; bool Language::isPolyglossiaExclusive() const { - return babel().empty() && !polyglossia().empty() && requires().empty(); + return babel().empty() && !polyglossia().empty() && required().empty(); } bool Language::isBabelExclusive() const { - return !babel().empty() && polyglossia().empty() && requires().empty(); + return !babel().empty() && polyglossia().empty() && required().empty(); } diff --git a/src/Language.h b/src/Language.h index a535f980cb..2e03644139 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 requires() const { return requires_; } + std::string const required() const { return requires_; } /// provides feature std::string const provides() const { return provides_; } /// translatable GUI name diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index c62e955859..2d1cc7628f 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -2274,7 +2274,7 @@ void GuiDocument::languageChanged(int i) Language const * lang = lyx::languages.getLanguage( fromqstr(langModule->languageCO->itemData(i).toString())); if (lang->babel().empty() && !lang->polyglossia().empty() - && lang->requires() != "CJK" && lang->requires() != "japanese") { + && lang->required() != "CJK" && lang->required() != "japanese") { // If we force to switch fontspec on, store // current state (#8717) if (fontModule->osFontsCB->isEnabled()) @@ -2971,8 +2971,8 @@ void GuiDocument::updateEngineDependends() biblioModule->citeEngineCO->currentIndex()).toString(); LyXCiteEngine const * ce = theCiteEnginesList[fromqstr(engine)]; - bool const citepack = ce->requires("biblatex.sty") || ce->requires("jurabib.sty") - || ce->requires("natbib.sty"); + bool const citepack = ce->required("biblatex.sty") || ce->required("jurabib.sty") + || ce->required("natbib.sty"); biblioModule->citePackageOptionsLE->setEnabled(citepack); biblioModule->citePackageOptionsL->setEnabled(citepack); } @@ -4196,7 +4196,7 @@ void GuiDocument::paramsToDialog() langModule->languageCO->currentIndex()).toString())); bool const need_fontspec = lang->babel().empty() && !lang->polyglossia().empty() - && lang->requires() != "CJK" && lang->requires() != "japanese"; + && lang->required() != "CJK" && lang->required() != "japanese"; bool const os_fonts_available = bp_.baseClass()->outputType() == lyx::LATEX && LaTeXFeatures::isAvailable("fontspec"); diff --git a/src/mathed/InsetMathDecoration.cpp b/src/mathed/InsetMathDecoration.cpp index 92696a82eb..35ba155614 100644 --- a/src/mathed/InsetMathDecoration.cpp +++ b/src/mathed/InsetMathDecoration.cpp @@ -283,8 +283,8 @@ void InsetMathDecoration::validate(LaTeXFeatures & features) const "span.symbol{height: 0.5ex;}"); } } else { - if (!key_->requires.empty()) - features.require(key_->requires); + if (!key_->required.empty()) + features.require(key_->required); } InsetMathNest::validate(features); } diff --git a/src/mathed/InsetMathDots.cpp b/src/mathed/InsetMathDots.cpp index 8c4bd8374b..3679771745 100644 --- a/src/mathed/InsetMathDots.cpp +++ b/src/mathed/InsetMathDots.cpp @@ -80,8 +80,8 @@ docstring InsetMathDots::name() const void InsetMathDots::validate(LaTeXFeatures & features) const { - if (!key_->requires.empty()) - features.require(key_->requires); + if (!key_->required.empty()) + features.require(key_->required); } diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index 6ecc0c164d..d296130faf 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -644,7 +644,7 @@ void InsetMathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc, d->nesting_ = nesting; // update requires - d->requires_ = d->macro_->requires(); + d->requires_ = d->macro_->required(); if (!d->needsUpdate_ // non-normal mode? We are done! @@ -911,8 +911,8 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const else if (!d->macro_) { // Update requires for known global macros. MacroData const * data = MacroTable::globalMacros().get(name()); - if (data && !data->requires().empty()) - features.require(data->requires()); + if (data && !data->required().empty()) + features.require(data->required()); } if (name() == "binom") diff --git a/src/mathed/InsetMathSymbol.cpp b/src/mathed/InsetMathSymbol.cpp index 5603cfedd5..b3b44bffdc 100644 --- a/src/mathed/InsetMathSymbol.cpp +++ b/src/mathed/InsetMathSymbol.cpp @@ -247,8 +247,8 @@ void InsetMathSymbol::validate(LaTeXFeatures & features) const "sub.limit{font-size: 75%;}\n" "sup.limit{font-size: 75%;}"); } else { - if (!sym_->requires.empty()) - features.require(sym_->requires); + if (!sym_->required.empty()) + features.require(sym_->required); } } diff --git a/src/mathed/MacroTable.cpp b/src/mathed/MacroTable.cpp index d279bdb844..af97405949 100644 --- a/src/mathed/MacroTable.cpp +++ b/src/mathed/MacroTable.cpp @@ -110,10 +110,10 @@ vector const & MacroData::defaults() const } -string const MacroData::requires() const +string const MacroData::required() const { if (sym_) - return sym_->requires; + return sym_->required; return string(); } diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index d31d04b35b..9690182976 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -60,7 +60,7 @@ public: /// std::vector const & defaults() const; /// - std::string const requires() const; + std::string const required() const; /// bool hidden() const; /// diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index d21af77950..f4b5668718 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -217,7 +217,7 @@ void initSymbols() requires = ""; tmp.hidden = hidden = true; } else - tmp.requires = requires; + tmp.required = requires; theMathWordList[it->first] = tmp; wit = theMathWordList.find(it->first); it->second.setSymbol(&(wit->second)); @@ -249,9 +249,9 @@ void initSymbols() if ((is >> help)) { // backward compatibility if (help == "esintoramsmath") - tmp.requires = "esint|amsmath"; + tmp.required = "esint|amsmath"; else - tmp.requires = to_ascii(help); + tmp.required = to_ascii(help); } } else { LYXERR(Debug::MATHED, "skipping line '" << line << "'\n" @@ -265,13 +265,13 @@ void initSymbols() // create fallbacks if necessary // store requirements as long as we can - if (tmp.requires.empty()) { + if (tmp.required.empty()) { if (tmp.inset == "msa" || tmp.inset == "msb") - tmp.requires = "amssymb"; + tmp.required = "amssymb"; else if (tmp.inset == "wasy") - tmp.requires = "wasysym"; + tmp.required = "wasysym"; else if (tmp.inset == "mathscr") - tmp.requires = "mathrsfs"; + tmp.required = "mathrsfs"; } // symbol font is not available sometimes @@ -307,9 +307,9 @@ void initSymbols() << " used for " << to_utf8(tmp.name)); } - if (tmp.requires == "hiddensymbol") + if (tmp.required == "hiddensymbol") { - tmp.requires = ""; + tmp.required = ""; tmp.hidden = true; } @@ -326,7 +326,7 @@ void initSymbols() << " draw: " << int(tmp.draw.empty() ? 0 : tmp.draw[0]) << " extra: " << to_utf8(tmp.extra) << " xml: " << to_utf8(tmp.xmlname) - << " requires: " << tmp.requires + << " requires: " << tmp.required << " hidden: " << tmp.hidden << '\''); } string tmp = "cmm"; diff --git a/src/mathed/MathParser.h b/src/mathed/MathParser.h index 9ff6db1a91..cd0f2b9f59 100644 --- a/src/mathed/MathParser.h +++ b/src/mathed/MathParser.h @@ -57,7 +57,7 @@ public: /// how is this called as XML entity in MathML? docstring xmlname; /// required LaTeXFeatures - std::string requires; + std::string required; /// Should this macro be hidden from autocompletion (since it requires /// user preamble code)? bool hidden; diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index 2cf4bd5f26..55b0822068 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -1024,7 +1024,7 @@ void validate_math_word(LaTeXFeatures & features, docstring const & word) MathWordList const & words = mathedWordList(); MathWordList::const_iterator it = words.find(word); if (it != words.end()) { - string const req = it->second.requires; + string const req = it->second.required; if (!req.empty()) features.require(req); } -- 2.39.5