Consider the case where there is not any layout name.
[lyx.git] / src / encoding.h
blob830a05c3c491f11cd24430441a9761d41b9644ae
1 // -*- C++ -*-
2 /**
3 * \file encoding.h
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.
13 #ifndef ENCODING_H
14 #define ENCODING_H
16 #include <map>
17 #include <string>
20 ///
21 typedef unsigned short int Uchar;
23 ///
24 class Encoding {
25 public:
26 ///
27 Encoding() {}
28 ///
29 Encoding(std::string const & n, std::string const & l, Uchar const * e)
30 : Name_(n), LatexName_(l) {
31 for (int i = 0; i < 256; ++i)
32 encoding_table[i] = e[i];
34 ///
35 std::string const & Name() const {
36 return Name_;
38 ///
39 std::string const & LatexName() const {
40 return LatexName_;
42 ///
43 Uchar ucs(unsigned char c) const {
44 return encoding_table[c];
46 private:
47 ///
48 std::string Name_;
49 ///
50 std::string LatexName_;
51 ///
52 Uchar encoding_table[256];
55 extern Encoding symbol_encoding;
57 class Encodings {
58 public:
59 ///
60 typedef std::map<std::string, Encoding> EncodingList;
61 ///
62 Encodings();
63 ///
64 void read(std::string const & filename);
65 ///
66 Encoding const * getEncoding(std::string const & encoding) const;
67 ///
68 Encoding const * symbol_encoding() {
69 return &symbol_encoding_;
72 ///
73 enum Letter_Form {
74 ///
75 FORM_ISOLATED,
76 ///
77 FORM_FINAL,
78 ///
79 FORM_INITIAL,
80 ///
81 FORM_MEDIAL
83 ///
84 static
85 bool IsComposeChar_hebrew(unsigned char c);
86 ///
87 static
88 bool IsComposeChar_arabic(unsigned char c);
89 ///
90 static
91 bool is_arabic_special(unsigned char c);
92 ///
93 static
94 bool is_arabic(unsigned char c);
95 ///
96 static
97 unsigned char TransformChar(unsigned char c, Letter_Form form);
99 private:
101 EncodingList encodinglist;
103 Encoding symbol_encoding_;
106 extern Encodings encodings;
108 #endif