X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetListingsParams.cpp;h=9390d6bbe4549867005cfe5e2ed3b2c8add7cecf;hb=e26a60edef3eae39c2e8379f395febedc5ba7efa;hp=1f1ad4a4d2e1a65349c6e098d720b47a379f2280;hpb=75bfed55079cab6b73fbea6ce4ae3f10d1af3b91;p=features.git diff --git a/src/insets/InsetListingsParams.cpp b/src/insets/InsetListingsParams.cpp index 1f1ad4a4d2..9390d6bbe4 100644 --- a/src/insets/InsetListingsParams.cpp +++ b/src/insets/InsetListingsParams.cpp @@ -13,7 +13,7 @@ #include "InsetListingsParams.h" -#include "Length.h" +#include "support/Length.h" #include "Lexer.h" #include "support/convert.h" @@ -55,7 +55,7 @@ public: string const & i, docstring const & h) : value_(v), onoff_(o), type_(t), info_(i), hint_(h) {} - /// Validate a paramater. + /// Validate a parameter. /// \retval an empty string if \c par is valid. /// \retval otherwise an explanation WRT to \c par invalidity. docstring validate(string const & par) const; @@ -232,8 +232,8 @@ docstring ListingsParam::validate(string const & par) const return bformat(_("Please specify one or more of '%1$s'."), from_utf8(info_)); } - for (size_t i = 0; i < par2.size(); ++i) - if (info_.find(par2[i], 0) == string::npos) + for (char c : par2) + if (info_.find(c, 0) == string::npos) return bformat(_("Should be composed of one or more of %1$s."), from_utf8(info_)); if (unclosed) @@ -247,22 +247,23 @@ docstring ListingsParam::validate(string const & par) const /// languages and language/dialect combinations char const * allowed_languages = "no language\nABAP\n[R/2 4.3]ABAP\n[R/2 5.0]ABAP\n[R/3 3.1]ABAP\n" - "[R/3 4.6C]ABAP\n[R/3 6.10]ABAP\nACSL\nAda\n[2005]Ada\n[83]Ada\n" - "[95]Ada\nALGOL\n[60]ALGOL\n[68]ALGOL\nAssembler\n" + "[R/3 4.6C]ABAP\n[R/3 6.10]ABAP\nACM\nACMscript\nACSL\nAda\n[2005]Ada\n[83]Ada\n" + "[95]Ada\nALGOL\n[60]ALGOL\n[68]ALGOL\nAnt\nAssembler\n" "[Motorola68k]Assembler\n[x86masm]Assembler\nAwk\n[gnu]Awk\n[POSIX]Awk\n" "bash\nBasic\n[Visual]Basic\nC\n[ANSI]C\n[Handel]C\n[Objective]C\n" "[Sharp]C\nC++\n[ANSI]C++\n[GNU]C++\n[ISO]C++\n[Visual]C++\nCaml\n" - "[light]Caml\n[Objective]Caml\nClean\nCobol\n[1974]Cobol\n[1985]Cobol\n" + "[light]Caml\n[Objective]Caml\nCIL\nClean\nCobol\n[1974]Cobol\n[1985]Cobol\n" "[ibm]Cobol\nComal 80\ncommand.com\n[WinXP]command.com\nComsol\ncsh\n" - "Delphi\nEiffel\nElan\nerlang\nEuphoria\nFortran\n[77]Fortran\n[90]Fortran\n" - "[95]Fortran\nGCL\nGnuplot\nHaskell\nHTML\nIDL\n[CORBA]IDL\ninform\n" - "Java\n[AspectJ]Java\nJVMIS\nksh\nLingo\nLisp\n[Auto]Lisp\nLogo\n" - "make\n[gnu]make\nMathematica\n[1.0]Mathematica\n[3.0]Mathematica\n" + "Delphi\nEiffel\nElan\nelisp\nerlang\nEuphoria\nFortran\n[77]Fortran\n[90]Fortran\n" + "[95]Fortran\n[03]Fortran\n[08]Fortran\nGAP\nGCL\nGnuplot\nGo\nhansl\nHaskell\nHTML\nIDL\n[CORBA]IDL\ninform\n" + "Java\n[AspectJ]Java\nJVMIS\nksh\nLingo\nLisp\n[Auto]Lisp\nLLVM\nLogo\n" + "Lua\n[5.0]Lua\n[5.1]Lua\n[5.2]Lua\n[5.3]Lua\n" + "make\n[gnu]make\nMathematica\n[1.0]Mathematica\n[3.0]Mathematica\n[11.0]Mathematica\n" "[5.2]Mathematica\nMatlab\nMercury\nMetaPost\nMiranda\nMizar\nML\n" "Modula-2\nMuPAD\nNASTRAN\nOberon-2\nOCL\n[decorative]OCL\n[OMG]OCL\n" - "Octave\nOz\nPascal\n[Borland6]Pascal\n[Standard]Pascal\n[XSC]Pascal\n" + "Octave\nOORexx\nOz\nPascal\n[Borland6]Pascal\n[Standard]Pascal\n[XSC]Pascal\n" "Perl\nPHP\nPL/I\nPlasm\nPostScript\nPOV\nProlog\nPromela\nPSTricks\n" - "Python\nR\nReduce\nRexx\nRSL\nRuby\nS\n[PLUS]S\nSAS\nScilab\nsh\n" + "Python\nR\nReduce\nRexx\n[VM/XA]Rexx\nRSL\nRuby\nS\n[PLUS]S\nSAS\nScala\nScilab\nsh\n" "SHELXL\nSimula\n[67]Simula\n[CII]Simula\n[DEC]Simula\n[IBM]Simula\n" "SPARQL\nSQL\ntcl\n[tk]tcl\nTeX\n[AlLaTeX]TeX\n[common]TeX\n[LaTeX]TeX\n" "[plain]TeX\n[primitive]TeX\nVBScript\nVerilog\nVHDL\n[AMS]VHDL\nVRML\n" @@ -947,19 +948,19 @@ 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 return false; } -} // namespace anon. +} // namespace // define a global ParValidator ParValidator * par_validator = 0; @@ -969,13 +970,13 @@ ParValidator * par_validator = 0; int InsetListingsParams::package_ = 0; InsetListingsParams::InsetListingsParams() - : inline_(false), params_(), status_(InsetCollapsable::Open) + : inline_(false), params_(), status_(InsetCollapsible::Open) { } InsetListingsParams::InsetListingsParams(string const & par, bool in, - InsetCollapsable::CollapseStatus s) + InsetCollapsible::CollapseStatus s) : inline_(in), params_(), status_(s) { // this will activate parameter validation. @@ -996,9 +997,9 @@ void InsetListingsParams::write(ostream & os) const void InsetListingsParams::read(Lexer & lex) { lex >> inline_; - int s = InsetCollapsable::Collapsed; + int s = InsetCollapsible::Collapsed; lex >> s; - status_ = static_cast(s); + status_ = static_cast(s); string par; lex >> par; fromEncodedString(par); @@ -1072,8 +1073,8 @@ void InsetListingsParams::addParam(string const & key, // non-ascii/number characters, just to be safe else { bool has_special_char = false; - for (size_t i = 0; i < value.size(); ++i) - if (!isAlnumASCII(value[i])) { + for (char c : value) + if (!isAlnumASCII(c)) { has_special_char = true; break; }