]> git.lyx.org Git - lyx.git/blob - src/language.h
If I ever see another licence blurb again, it'll be too soon...
[lyx.git] / src / language.h
1 // -*- C++ -*-
2 /**
3  * \file language.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 Jean-Marc Lasgouttes
9  * \author Dekel Tsur
10  * \author Jürgen Vigna
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef LANGUAGE_H
16 #define LANGUAGE_H
17
18 #include <map>
19 #include "LString.h"
20
21 class Encoding;
22
23 ///
24 class Language {
25 public:
26         ///
27         Language() : RightToLeft_(false) {}
28         ///
29         Language(string const & l, string const & b, string const & d,
30                  bool rtl, Encoding const * e, string const & c,
31                  string const & o)
32                 : lang_(l), babel_(b), display_(d), RightToLeft_(rtl),
33                   encoding_(e), code_(c), latex_options_(o)
34                 {}
35         ///
36         string const & lang() const {
37                 return lang_;
38         }
39         ///
40         string const & babel() const {
41                 return babel_;
42         }
43         ///
44         string const & display() const {
45                 return display_;
46         }
47         ///
48         bool RightToLeft() const {
49                 return RightToLeft_;
50         }
51         ///
52         Encoding const * encoding() const {
53                 return encoding_;
54         }
55         ///
56         string const & code() const {
57                 return code_;
58         }
59         ///
60         string const & latex_options() const {
61                 return latex_options_;
62         }
63 private:
64         ///
65         string lang_;
66         ///
67         string babel_;
68         ///
69         string display_;
70         ///
71         bool RightToLeft_;
72         ///
73         Encoding const * encoding_;
74         ///
75         string code_;
76         ///
77         string latex_options_;
78 };
79
80 class Languages
81 {
82 public:
83         ///
84         typedef std::map<string, Language> LanguageList;
85         ///
86         typedef LanguageList::const_iterator const_iterator;
87         ///
88         typedef LanguageList::size_type size_type;
89         ///
90         void read(string const & filename);
91         ///
92         Language const * getLanguage(string const & language) const;
93         ///
94         size_type size() const {
95                 return languagelist.size();
96         }
97         ///
98         const_iterator begin() const {
99                 return languagelist.begin();
100         }
101         ///
102         const_iterator end() const {
103                 return languagelist.end();
104         }
105         ///
106
107 private:
108         ///
109         LanguageList languagelist;
110 };
111
112 extern Languages languages;
113 extern Language const * default_language;
114 extern Language const * english_language;
115 extern Language const * ignore_language;
116 extern Language const * latex_language;
117
118 #endif