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;
51 /// Add the preamble snippet needed for the output of latexChar(c)
53 void validate(char_type c, LaTeXFeatures & features) const;
58 std::string LatexName_;
60 std::string iconvName_;
62 typedef std::set<char_type> CharSet;
63 /// Set of UCS4 characters that we can encode (for singlebyte
66 /// All code points below this are encodable. This helps us to avoid
67 /// lokup of ASCII characters in encodable_ and gives about 1 sec
68 /// speedup on export of the Userguide.
69 char_type start_encodable_;
75 typedef std::map<std::string, Encoding> EncodingList;
76 /// iterator to iterate over all encodings.
77 /// We hide the fact that our encoding list is implemented as a map.
78 class const_iterator : public EncodingList::const_iterator {
79 typedef EncodingList::const_iterator base;
81 const_iterator() : base() {}
82 const_iterator(base const & b) : base(b) {}
83 Encoding const & operator*() const { return base::operator*().second; }
84 Encoding const * operator->() const { return &(base::operator*().second); }
88 /// Read the encodings.
89 /// \param encfile encodings definition file
90 /// \param symbolsfile unicode->LaTeX mapping file
91 void read(support::FileName const & encfile,
92 support::FileName const & symbolsfile);
93 /// Get encoding from LyX name \p name
94 Encoding const * getFromLyXName(std::string const & name) const;
95 /// Get encoding from LaTeX name \p name
96 Encoding const * getFromLaTeXName(std::string const & name) const;
99 const_iterator begin() const { return encodinglist.begin(); }
101 const_iterator end() const { return encodinglist.end(); }
115 static bool isComposeChar_hebrew(char_type c);
117 static bool isComposeChar_arabic(char_type c);
119 static bool is_arabic_special(char_type c);
121 static bool is_arabic(char_type c);
123 static char_type transformChar(char_type c, Letter_Form form);
124 /// Is this a combining char?
125 static bool isCombiningChar(char_type c);
129 EncodingList encodinglist;
132 extern Encodings encodings;