]> git.lyx.org Git - lyx.git/blob - src/language.h
The std::string mammoth path.
[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 <string>
20
21
22 class Encoding;
23
24 ///
25 class Language {
26 public:
27         ///
28         Language() : RightToLeft_(false) {}
29         ///
30         Language(std::string const & l, std::string const & b, std::string const & d,
31                  bool rtl, Encoding const * e, std::string const & c,
32                  std::string const & o)
33                 : lang_(l), babel_(b), display_(d), RightToLeft_(rtl),
34                   encoding_(e), code_(c), latex_options_(o)
35                 {}
36         ///
37         std::string const & lang() const {
38                 return lang_;
39         }
40         ///
41         std::string const & babel() const {
42                 return babel_;
43         }
44         ///
45         std::string const & display() const {
46                 return display_;
47         }
48         ///
49         bool RightToLeft() const {
50                 return RightToLeft_;
51         }
52         ///
53         Encoding const * encoding() const {
54                 return encoding_;
55         }
56         ///
57         std::string const & code() const {
58                 return code_;
59         }
60         ///
61         std::string const & latex_options() const {
62                 return latex_options_;
63         }
64 private:
65         ///
66         std::string lang_;
67         ///
68         std::string babel_;
69         ///
70         std::string display_;
71         ///
72         bool RightToLeft_;
73         ///
74         Encoding const * encoding_;
75         ///
76         std::string code_;
77         ///
78         std::string latex_options_;
79 };
80
81 class Languages
82 {
83 public:
84         ///
85         typedef std::map<std::string, Language> LanguageList;
86         ///
87         typedef LanguageList::const_iterator const_iterator;
88         ///
89         typedef LanguageList::size_type size_type;
90         ///
91         void read(std::string const & filename);
92         ///
93         Language const * getLanguage(std::string const & language) const;
94         ///
95         size_type size() const {
96                 return languagelist.size();
97         }
98         ///
99         const_iterator begin() const {
100                 return languagelist.begin();
101         }
102         ///
103         const_iterator end() const {
104                 return languagelist.end();
105         }
106         ///
107
108 private:
109         ///
110         LanguageList languagelist;
111 };
112
113 extern Languages languages;
114 extern Language const * default_language;
115 extern Language const * english_language;
116 extern Language const * ignore_language;
117 extern Language const * latex_language;
118
119 #endif