]> git.lyx.org Git - lyx.git/blob - src/trans.h
we rely on Windows and maybe Linux on a Qt bug
[lyx.git] / src / trans.h
1 // -*- C++ -*-
2 /**
3  * \file trans.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 Matthias Ettrich
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef TRANS_H
15 #define TRANS_H
16
17 #include "trans_decl.h"
18
19 #include <map>
20
21
22 namespace lyx {
23
24
25 class LyXLex;
26
27 class TransManager;
28
29 /**
30   Trans: holds a .kmap file
31   */
32 class Trans {
33 public:
34         ///
35         Trans();
36         ///
37         ~Trans();
38
39         ///
40         int load(std::string const & language);
41         ///
42         bool isDefined() const;
43         ///
44         std::string const & getName() const;
45         ///
46         std::string const process(char, TransManager &);
47         ///
48         bool isAccentDefined(tex_accent, KmodInfo &) const;
49
50 private:
51         ///
52         void addDeadkey(tex_accent, std::string const &);
53         ///
54         void freeKeymap();
55         ///
56         int load(LyXLex &);
57         ///
58         std::string const & match(unsigned char c);
59         ///
60         void insertException(KmodException & exclist, char c,
61                              std::string const & data, bool = false,
62                              tex_accent = TEX_NOACCENT);
63         ///
64         void freeException(KmodException & exclist);
65
66         ///
67         std::string name_;
68         ///
69         std::map<int, std::string> keymap_;
70         ///
71         std::map<int, KmodInfo> kmod_list_;
72 };
73
74
75 ///
76 inline
77 std::string const & Trans::match(unsigned char c)
78 {
79         std::map<int, std::string>::iterator it = keymap_.find(c);
80         if (it != keymap_.end()) {
81                 return it->second;
82         }
83         static std::string dummy;
84         return dummy;
85 }
86
87
88 } // namespace lyx
89
90 #endif // TRANS_H