]> git.lyx.org Git - lyx.git/blob - src/encoding.h
use more unicode in math
[lyx.git] / src / encoding.h
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.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef ENCODING_H
14 #define ENCODING_H
15
16 #include <map>
17 #include <string>
18
19 #include "support/types.h"
20
21 namespace lyx {
22
23 ///
24 class Encoding {
25 public:
26         ///
27         Encoding() {}
28         ///
29         Encoding(std::string const & n, std::string const & l, char_type const * e)
30                 : Name_(n), LatexName_(l)
31         {
32                 for (int i = 0; i < 256; ++i)
33                         encoding_table[i] = e[i];
34         }
35         ///
36         std::string const & name() const { return Name_; }
37         ///
38         std::string const & latexName() const { return LatexName_; }
39         ///
40         char_type ucs(char_type c) const;
41 private:
42         ///
43         std::string Name_;
44         ///
45         std::string LatexName_;
46         ///
47         char_type encoding_table[256];
48 };
49
50 extern Encoding symbol_encoding;
51
52 class Encodings {
53 public:
54         ///
55         typedef std::map<std::string, Encoding> EncodingList;
56         ///
57         Encodings();
58         ///
59         void read(std::string const & filename);
60         ///
61         Encoding const * getEncoding(std::string const & encoding) const;
62         ///
63         Encoding const * symbol_encoding() { return &symbol_encoding_; }
64
65         ///
66         enum Letter_Form {
67                 ///
68                 FORM_ISOLATED,
69                 ///
70                 FORM_FINAL,
71                 ///
72                 FORM_INITIAL,
73                 ///
74                 FORM_MEDIAL
75         };
76         ///
77         static bool isComposeChar_hebrew(char_type c);
78         ///
79         static bool isComposeChar_arabic(char_type c);
80         ///
81         static bool is_arabic_special(char_type c);
82         ///
83         static bool is_arabic(char_type c);
84         ///
85         static char_type transformChar(char_type c, Letter_Form form);
86
87 private:
88         ///
89         EncodingList encodinglist;
90         ///
91         Encoding symbol_encoding_;
92 };
93
94 extern Encodings encodings;
95
96
97 } // namespace lyx
98
99 #endif