]> git.lyx.org Git - lyx.git/blob - src/trans.h
Alfredo's second patch
[lyx.git] / src / trans.h
1 // -*- C++ -*-
2 /**
3  * \file trans.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author unknown
8  */
9
10 #ifndef TRANS_H
11 #define TRANS_H
12
13 #include <map>
14
15 #include "tex-accent.h"
16 #include "LString.h"
17 #include "trans_decl.h"
18
19 class LyXLex;
20
21 class TransManager;
22
23 /**
24   Trans: holds a .kmap file
25   */
26 class Trans {
27 public:
28         ///
29         Trans();
30         ///
31         ~Trans();
32
33         ///
34         int Load(string const & language);
35         ///
36         bool IsDefined() const;
37         ///
38         string const & GetName() const;
39         ///
40         string const process(char, TransManager &);
41         ///
42         bool isAccentDefined(tex_accent, KmodInfo &) const;
43
44 private:
45         ///
46         void AddDeadkey(tex_accent, string const &);
47         ///
48         void FreeKeymap();
49         ///
50         int Load(LyXLex &);
51         ///
52         string const & Match(unsigned char c);
53         ///
54         void InsertException(KmodException & exclist, char c,
55                              string const & data, bool = false,
56                              tex_accent = TEX_NOACCENT);
57         ///
58         void FreeException(KmodException & exclist);
59
60         ///
61         string name_;
62         ///
63         std::map<int, string> keymap_;
64         ///
65         std::map<int, KmodInfo> kmod_list_;
66 };
67
68
69 ///
70 inline
71 string const & Trans::Match(unsigned char c)
72 {
73         std::map<int, string>::iterator it = keymap_.find(c);
74         if (it != keymap_.end()) {
75                 return it->second;
76         }
77         static string dummy;
78         return dummy;
79 }
80
81 #endif // TRANS_H