]> git.lyx.org Git - lyx.git/blob - src/trans.h
Simplify the mechanics of generating the 'inactive' pixmap.
[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 class LyXLex;
23
24 class TransManager;
25
26 /**
27   Trans: holds a .kmap file
28   */
29 class Trans {
30 public:
31         ///
32         Trans();
33         ///
34         ~Trans();
35
36         ///
37         int Load(std::string const & language);
38         ///
39         bool IsDefined() const;
40         ///
41         std::string const & GetName() const;
42         ///
43         std::string const process(char, TransManager &);
44         ///
45         bool isAccentDefined(tex_accent, KmodInfo &) const;
46
47 private:
48         ///
49         void AddDeadkey(tex_accent, std::string const &);
50         ///
51         void FreeKeymap();
52         ///
53         int Load(LyXLex &);
54         ///
55         std::string const & Match(unsigned char c);
56         ///
57         void InsertException(KmodException & exclist, char c,
58                              std::string const & data, bool = false,
59                              tex_accent = TEX_NOACCENT);
60         ///
61         void FreeException(KmodException & exclist);
62
63         ///
64         std::string name_;
65         ///
66         std::map<int, std::string> keymap_;
67         ///
68         std::map<int, KmodInfo> kmod_list_;
69 };
70
71
72 ///
73 inline
74 std::string const & Trans::Match(unsigned char c)
75 {
76         std::map<int, std::string>::iterator it = keymap_.find(c);
77         if (it != keymap_.end()) {
78                 return it->second;
79         }
80         static std::string dummy;
81         return dummy;
82 }
83
84 #endif // TRANS_H