X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FEncoding.cpp;h=c7ea237179e79c966c7a700cea998fa0dda8da05;hb=33f9cfb7961501b38c573eede468b011687f46de;hp=47e27eb97d9c94e6909e8367618f5c6f41c197e8;hpb=33d663720b85c15798f7a043996aee5a43f516fc;p=lyx.git diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 47e27eb97d..c7ea237179 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -17,6 +17,7 @@ #include "Lexer.h" #include "support/debug.h" +#include "support/docstring.h" #include "support/gettext.h" #include "support/lstrings.h" #include "support/mutex.h" @@ -67,7 +68,7 @@ EncodingException::EncodingException(char_type c) } -const char * EncodingException::what() const throw() +const char * EncodingException::what() const noexcept { return "Could not find LaTeX command for a character"; } @@ -228,8 +229,7 @@ pair Encoding::latexString(docstring const & input, bool d docstring result; docstring uncodable; bool terminate = false; - for (size_t n = 0; n < input.size(); ++n) { - char_type const c = input[n]; + for (char_type const c : input) { try { pair latex_char = latexChar(c); docstring const latex = latex_char.first; @@ -252,10 +252,10 @@ pair Encoding::latexString(docstring const & input, bool d if (dryrun) { result += "<" + _("LyX Warning: ") + _("uncodable character") + " '"; - result += docstring(1, input[n]); + result += docstring(1, c); result += "'>"; } else - uncodable += input[n]; + uncodable += c; } } return make_pair(result, uncodable); @@ -644,7 +644,7 @@ Encodings::fromLyXName(string const & name, bool allowUnsafe) const Encoding const * -Encodings::fromLaTeXName(string const & n, int const & p, bool allowUnsafe) const +Encodings::fromLaTeXName(string const & n, int p, bool allowUnsafe) const { string name = n; // FIXME: if we have to test for too many of these synonyms, @@ -667,7 +667,7 @@ Encodings::fromLaTeXName(string const & n, int const & p, bool allowUnsafe) cons Encoding const * -Encodings::fromIconvName(string const & n, int const & p, bool allowUnsafe) const +Encodings::fromIconvName(string const & n, int p, bool allowUnsafe) const { EncodingList::const_iterator const end = encodinglist.end(); for (EncodingList::const_iterator it = encodinglist.begin(); it != end; ++it) @@ -733,14 +733,14 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile) } else if (prefixIs(flag, "force=")) { vector encs = getVectorFromString(flag.substr(6), ";"); - for (size_t i = 0; i < encs.size(); ++i) - forcedselected[encs[i]].insert(symbol); + for (auto const & enc : encs) + forcedselected[enc].insert(symbol); flags |= CharInfoForceSelected; } else if (prefixIs(flag, "force!=")) { vector encs = getVectorFromString(flag.substr(7), ";"); - for (size_t i = 0; i < encs.size(); ++i) - forcednotselected[encs[i]].insert(symbol); + for (auto const & enc : encs) + forcednotselected[enc].insert(symbol); flags |= CharInfoForceSelected; } else if (flag == "mathalpha") { mathalpha.insert(symbol);