#include <boost/cstdint.hpp>
-#include <sstream>
+#include <iterator>
#include <algorithm>
+#include <sstream>
using namespace std;
using namespace lyx::support;
/// The highest code point in UCS4 encoding (1<<20 + 1<<16)
char_type const max_ucs4 = 0x110000;
-} // namespace anon
+} // namespace
EncodingException::EncodingException(char_type c)
}
}
lyxerr.enable();
- CharSet::iterator it = encodable_.find(start_encodable_);
- while (it != encodable_.end()) {
+ CharSet::iterator it = encodable.find(start_encodable);
+ while (it != encodable.end()) {
encodable.erase(it);
++start_encodable;
- it = encodable_.find(start_encodable_);
+ it = encodable.find(start_encodable);
}
const_cast<Encoding *>(this)->complete_ = true;
}
// assure the used encoding is properly initialized
init();
- // first all encodable characters
- vector<char_type> symbols(encodable_.begin(), encodable_.end());
- // add those below start_encodable_
+ // first all those below start_encodable_
+ vector<char_type> symbols;
for (char_type c = 0; c < start_encodable_; ++c)
symbols.push_back(c);
- // now the ones from the unicodesymbols file
- CharInfoMap::const_iterator const end = unicodesymbols.end();
- CharInfoMap::const_iterator it = unicodesymbols.begin();
- for (; it != end; ++it)
- symbols.push_back(it->first);
+ // add all encodable characters
+ copy(encodable_.begin(), encodable_.end(), back_inserter(symbols));
+ // now the ones from the unicodesymbols file that are not already there
+ for (pair<char_type, CharInfo> const & elem : unicodesymbols) {
+ if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end())
+ symbols.push_back(elem.first);
+ }
+ // finally, sort the vector
+ sort(symbols.begin(), symbols.end());
return symbols;
}
CharInfoMap::const_iterator const end = unicodesymbols.end();
CharInfoMap::const_iterator it = unicodesymbols.begin();
for (combining = false; it != end; ++it) {
+ if (it->second.deprecated())
+ continue;
docstring const math = it->second.mathcommand();
docstring const text = it->second.textcommand();
if ((cmdtype & MATH_CMD) && math == cmd) {
size_t unicmd_size = 0;
char_type c = 0;
for (; it != uniend; ++it) {
+ if (it->second.deprecated())
+ continue;
docstring const math = mathmode ? it->second.mathcommand()
: docstring();
docstring const text = textmode ? it->second.textcommand()
}
+bool Encodings::isUnicodeTextOnly(char_type c)
+{
+ if (isASCII(c) || isMathAlpha(c))
+ return false;
+
+ CharInfoMap::const_iterator const it = unicodesymbols.find(c);
+ return it == unicodesymbols.end() || it->second.mathcommand().empty();
+}
+
+
Encoding const *
Encodings::fromLyXName(string const & name, bool allowUnsafe) const
{
flags &= ~CharInfoMathNoTermination;
} else if (contains(flag, "tipashortcut=")) {
tipashortcut = split(flag, '=');
+ } else if (flag == "deprecated") {
+ flags |= CharInfoDeprecated;
} else {
lyxerr << "Ignoring unknown flag `" << flag
<< "' for symbol `0x"