]> git.lyx.org Git - lyx.git/blobdiff - src/Encoding.cpp
compil fix for Qt-4.2
[lyx.git] / src / Encoding.cpp
index 37e85ccf766c714fd55d66975ca8288a593b10be..3dca7b01ab4fb52020123533a7e7800f0f0336bc 100644 (file)
@@ -247,6 +247,18 @@ char_type const max_ucs4 = 0x110000;
 } // namespace anon
 
 
+EncodingException::EncodingException(char_type c)
+       : failed_char(c), par_id(0), pos(0)
+{
+}
+
+
+const char * EncodingException::what() const throw()
+{
+       return "Could not find LaTeX command for a character";
+}
+
+
 Encoding::Encoding(string const & n, string const & l, string const & i,
                   bool f, Encoding::Package p)
        : Name_(n), LatexName_(l), iconvName_(i), fixedwidth_(f), package_(p)
@@ -321,10 +333,7 @@ docstring const Encoding::latexChar(char_type c) const
                // c cannot be encoded in this encoding
                CharInfoMap::const_iterator const it = unicodesymbols.find(c);
                if (it == unicodesymbols.end())
-                       lyxerr << "Could not find LaTeX command for character 0x"
-                              << hex << c << dec
-                              << ".\nLaTeX export will fail."
-                              << endl;
+                       throw EncodingException(c);
                else
                        return it->second.command;
        }
@@ -332,6 +341,27 @@ docstring const Encoding::latexChar(char_type c) const
 }
 
 
+set<char_type> Encoding::getSymbolsList()
+{
+       // assure the used encoding is properly initialized
+       if (!complete_)
+               init();
+       BOOST_ASSERT(complete_);
+
+       // first all encodable characters
+       CharSet symbols = encodable_;
+       // add those below start_encodable_
+       for (char_type c = 0; c < start_encodable_; ++c)
+               symbols.insert(c);
+       // now the ones from the unicodesymbols file
+       CharInfoMap::const_iterator const end = unicodesymbols.end();
+       for (CharInfoMap::const_iterator it = unicodesymbols.begin(); it != end; ++it) {
+               symbols.insert(it->first);
+       }
+       return symbols;
+}
+
+
 void Encodings::validate(char_type c, LaTeXFeatures & features)
 {
        CharInfoMap::const_iterator const it = unicodesymbols.find(c);
@@ -485,7 +515,7 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
                info.force = false;
                while (!flags.empty()) {
                        string flag;
-                       flags = support::split(flags, flag, ',');
+                       flags = split(flags, flag, ',');
                        if (flag == "combining")
                                info.combining = true;
                        else if (flag == "force")