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