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"
23 namespace support { class FileName; }
34 Encoding(std::string const & n, std::string const & l,
35 std::string const & i);
37 std::string const & name() const { return Name_; }
39 std::string const & latexName() const { return LatexName_; }
41 std::string const & iconvName() const { return iconvName_; }
43 * Convert \p c to something that LaTeX can understand.
44 * This is either the character itself (if it is representable
45 * in this encoding), or a LaTeX macro.
46 * If the character is not representable in this encoding, but no
47 * LaTeX macro is known, a warning is given of lyxerr, and the
48 * character is returned.
50 docstring const latexChar(char_type c) const;
55 std::string LatexName_;
57 std::string iconvName_;
59 typedef std::set<char_type> CharSet;
60 /// Set of UCS4 characters that we can encode (for singlebyte
63 /// All code points below this are encodable. This helps us to avoid
64 /// lokup of ASCII characters in encodable_ and gives about 1 sec
65 /// speedup on export of the Userguide.
66 char_type start_encodable_;
72 typedef std::map<std::string, Encoding> EncodingList;
73 /// iterator to iterate over all encodings.
74 /// We hide the fact that our encoding list is implemented as a map.
75 class const_iterator : public EncodingList::const_iterator {
76 typedef EncodingList::const_iterator base;
78 const_iterator() : base() {}
79 const_iterator(base const & b) : base(b) {}
80 Encoding const & operator*() const { return base::operator*().second; }
81 Encoding const * operator->() const { return &(base::operator*().second); }
85 /// Read the encodings.
86 /// \param encfile encodings definition file
87 /// \param symbolsfile unicode->LaTeX mapping file
88 void read(support::FileName const & encfile,
89 support::FileName const & symbolsfile);
90 /// Get encoding from LyX name \p name
91 Encoding const * getFromLyXName(std::string const & name) const;
92 /// Get encoding from LaTeX name \p name
93 Encoding const * getFromLaTeXName(std::string const & name) const;
96 const_iterator begin() const { return encodinglist.begin(); }
98 const_iterator end() const { return encodinglist.end(); }
112 static bool isComposeChar_hebrew(char_type c);
114 static bool isComposeChar_arabic(char_type c);
116 static bool is_arabic_special(char_type c);
118 static bool is_arabic(char_type c);
120 static char_type transformChar(char_type c, Letter_Form form);
121 /// Is this a combining char?
122 static bool isCombiningChar(char_type c);
124 * Add the preamble snippet needed for the output of \p c to
126 * This does not depend on the used encoding, since the inputenc
127 * package only maps the code point \p c to a command, it does not
128 * make this command available.
130 static void validate(char_type c, LaTeXFeatures & features);
134 EncodingList encodinglist;
137 extern Encodings encodings;