This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / trans.h
blob6ff2ac3cecf0588e4c4fe14daf478337b3ffe759
1 // -*- C++ -*-
2 #ifndef _Trans_h_
3 #define _Trans_h_
5 #ifdef __GNUG__
6 #pragma interface
7 #endif
9 #include "tex-accent.h"
10 #include "LString.h"
11 #include "trans_decl.h"
13 class LyXLex;
15 class TransManager;
17 /**
18 TransInterface: the interface that every translation class
19 should obey too.
20 Visitor pattern applied here
22 class TransInterface {
23 public:
24 ///
25 virtual string process(char,TransManager&)=0;
26 ///
27 virtual bool isAccentDefined(tex_accent,KmodInfo&)=0;
30 /**
31 DefaultTrans: the default translation class. Hols info
32 on tex-accents. Monostate
34 class DefaultTrans: public TransInterface {
35 private:
36 ///
37 static bool init_;
38 public:
39 ///
40 DefaultTrans();
41 ///
42 virtual string process(char,TransManager&);
46 /**
47 Trans: holds a .kmap file
49 class Trans:public TransInterface {
50 public:
51 ///
52 Trans();
53 ///
54 virtual ~Trans();
56 ///
57 int Load(string const &language);
58 ///
59 bool IsDefined();
60 ///
61 const string& GetName();
62 ///
63 string process(char,TransManager&);
64 ///
65 bool isAccentDefined(tex_accent,KmodInfo&);
67 private:
68 ///
69 typedef KmodInfo kmod_list_decl;
70 ///
71 typedef KmodException keyexc;
73 ///
74 void AddDeadkey(tex_accent, const string&, const string&);
75 ///
76 void FreeKeymap();
77 ///
78 int Load(LyXLex &);
79 ///
80 inline char* Match(char c);
81 ///
82 void InsertException(keyexc &exclist, char c,
83 const string& data, bool = false,
84 tex_accent = TEX_NOACCENT);
85 ///
86 void FreeException(keyexc& exclist);
88 ///
89 string name_;
90 ///
91 char *keymap_[256];
92 ///
93 kmod_list_decl *kmod_list_[TEX_MAX_ACCENT+1];
98 char* Trans::Match(char c)
100 return keymap_[(unsigned char)c];
103 #endif