]> git.lyx.org Git - lyx.git/blob - src/encoding.h
Next step of true unicode filenames: Use support::FileName instead of
[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 namespace support { class FileName; }
24
25 ///
26 class Encoding {
27 public:
28         ///
29         Encoding() {}
30         ///
31         Encoding(std::string const & n, std::string const & l,
32                  std::string const & i)
33                 : Name_(n), LatexName_(l), iconvName_(i)
34         {
35         }
36         ///
37         std::string const & name() const { return Name_; }
38         ///
39         std::string const & latexName() const { return LatexName_; }
40         ///
41         std::string const & iconvName() const { return iconvName_; }
42 private:
43         ///
44         std::string Name_;
45         ///
46         std::string LatexName_;
47         ///
48         std::string iconvName_;
49 };
50
51 class Encodings {
52 public:
53         ///
54         typedef std::map<std::string, Encoding> EncodingList;
55         ///
56         Encodings();
57         ///
58         void read(support::FileName 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         ///
65         enum Letter_Form {
66                 ///
67                 FORM_ISOLATED,
68                 ///
69                 FORM_FINAL,
70                 ///
71                 FORM_INITIAL,
72                 ///
73                 FORM_MEDIAL
74         };
75         ///
76         static bool isComposeChar_hebrew(char_type c);
77         ///
78         static bool isComposeChar_arabic(char_type c);
79         ///
80         static bool is_arabic_special(char_type c);
81         ///
82         static bool is_arabic(char_type c);
83         ///
84         static char_type transformChar(char_type c, Letter_Form form);
85
86 private:
87         ///
88         EncodingList encodinglist;
89 };
90
91 extern Encodings encodings;
92
93
94 } // namespace lyx
95
96 #endif