]> git.lyx.org Git - lyx.git/blob - src/encoding.h
Fix thinko in Buffer::makeLaTeXFile
[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,
30                  std::string const & i)
31                 : Name_(n), LatexName_(l), iconvName_(i)
32         {
33         }
34         ///
35         std::string const & name() const { return Name_; }
36         ///
37         std::string const & latexName() const { return LatexName_; }
38         ///
39         std::string const & iconvName() const { return iconvName_; }
40 private:
41         ///
42         std::string Name_;
43         ///
44         std::string LatexName_;
45         ///
46         std::string iconvName_;
47 };
48
49 extern Encoding symbol_encoding;
50
51 class Encodings {
52 public:
53         ///
54         typedef std::map<std::string, Encoding> EncodingList;
55         ///
56         Encodings();
57         ///
58         void read(std::string const & filename);
59         /// Get encoding from LyX name \p name
60         Encoding const * getFromLyXName(std::string const & name) const;
61         /// Get encoding from LaTeX name \p name
62         Encoding const * getFromLaTeXName(std::string const & name) const;
63         ///
64         Encoding const * symbol_encoding() { return &symbol_encoding_; }
65
66         ///
67         enum Letter_Form {
68                 ///
69                 FORM_ISOLATED,
70                 ///
71                 FORM_FINAL,
72                 ///
73                 FORM_INITIAL,
74                 ///
75                 FORM_MEDIAL
76         };
77         ///
78         static bool isComposeChar_hebrew(char_type c);
79         ///
80         static bool isComposeChar_arabic(char_type c);
81         ///
82         static bool is_arabic_special(char_type c);
83         ///
84         static bool is_arabic(char_type c);
85         ///
86         static char_type transformChar(char_type c, Letter_Form form);
87
88 private:
89         ///
90         EncodingList encodinglist;
91         ///
92         Encoding symbol_encoding_;
93 };
94
95 extern Encodings encodings;
96
97
98 } // namespace lyx
99
100 #endif