4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
16 #include "support/docstring.h"
22 namespace support { class FileName; }
33 Encoding(std::string const & n, std::string const & l,
34 std::string const & i);
36 std::string const & name() const { return Name_; }
38 std::string const & latexName() const { return LatexName_; }
40 std::string const & iconvName() const { return iconvName_; }
42 * Convert \p c to something that LaTeX can understand.
43 * This is either the character itself (if it is representable
44 * in this encoding), or a LaTeX macro.
45 * If the character is not representable in this encoding, but no
46 * LaTeX macro is known, a warning is given of lyxerr, and the
47 * character is returned.
49 docstring const latexChar(char_type c) const;
50 /// Add the preamble snippet needed for the output of latexChar(c)
52 void validate(char_type c, LaTeXFeatures & features) const;
57 std::string LatexName_;
59 std::string iconvName_;
61 typedef std::set<char_type> CharSet;
62 /// Set of UCS4 characters that we can encode (for singlebyte
65 /// All code points below this are encodable. This helps us to avoid
66 /// lokup of ASCII characters in encodable_ and gives about 1 sec
67 /// speedup on export of the Userguide.
68 char_type start_encodable_;
74 typedef std::map<std::string, Encoding> EncodingList;
75 /// iterator to iterate over all encodings.
76 /// We hide the fact that our encoding list is implemented as a map.
77 class const_iterator : public EncodingList::const_iterator {
78 typedef EncodingList::const_iterator base;
80 const_iterator() : base() {}
81 const_iterator(base const & b) : base(b) {}
82 Encoding const & operator*() const { return base::operator*().second; }
83 Encoding const * operator->() const { return &(base::operator*().second); }
87 /// Read the encodings.
88 /// \param encfile encodings definition file
89 /// \param symbolsfile unicode->LaTeX mapping file
90 void read(support::FileName const & encfile,
91 support::FileName const & symbolsfile);
92 /// Get encoding from LyX name \p name
93 Encoding const * getFromLyXName(std::string const & name) const;
94 /// Get encoding from LaTeX name \p name
95 Encoding const * getFromLaTeXName(std::string const & name) const;
98 const_iterator begin() const { return encodinglist.begin(); }
100 const_iterator end() const { return encodinglist.end(); }
114 static bool isComposeChar_hebrew(char_type c);
116 static bool isComposeChar_arabic(char_type c);
118 static bool is_arabic_special(char_type c);
120 static bool is_arabic(char_type c);
122 static char_type transformChar(char_type c, Letter_Form form);
123 /// Is this a combining char?
124 static bool isCombiningChar(char_type c);
128 EncodingList encodinglist;
131 extern Encodings encodings;