]> git.lyx.org Git - lyx.git/blobdiff - src/Encoding.cpp
Capitalize labels of floats, etc. Fixes #11993.
[lyx.git] / src / Encoding.cpp
index b24c31366fe6d800094422302c5debbac5d517c6..c7ea237179e79c966c7a700cea998fa0dda8da05 100644 (file)
@@ -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"
@@ -228,8 +229,7 @@ pair<docstring, docstring> 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<docstring, bool> latex_char = latexChar(c);
                        docstring const latex = latex_char.first;
@@ -252,10 +252,10 @@ pair<docstring, docstring> 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<string> 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<string> 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);