* qt_helpers.cpp:
[lyx.git] / src / Language.h
blob575dd3339217ebbcf53efa4ab2920bd5c15b264e
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.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
9 * \author Dekel Tsur
10 * \author Jürgen Vigna
12 * Full author contact details are available in file CREDITS.
15 #ifndef LANGUAGE_H
16 #define LANGUAGE_H
18 #include <map>
19 #include <string>
22 namespace lyx {
24 namespace support { class FileName; }
26 class Encoding;
27 class Lexer;
29 ///
30 class Language {
31 public:
32 ///
33 Language() : rightToLeft_(false) {}
34 ///
35 std::string const & lang() const { return lang_; }
36 ///
37 std::string const & babel() const { return babel_; }
38 ///
39 std::string const & display() const { return display_; }
40 ///
41 bool rightToLeft() const { return rightToLeft_; }
42 ///
43 Encoding const * encoding() const { return encoding_; }
44 ///
45 std::string const & encodingStr() const { return encodingStr_; }
46 ///
47 std::string const & code() const { return code_; }
48 ///
49 std::string const & latex_options() const { return latex_options_; }
50 ///
51 bool internalFontEncoding() const;
52 ///
53 bool read(Lexer & lex);
54 private:
55 ///
56 std::string lang_;
57 ///
58 std::string babel_;
59 ///
60 std::string display_;
61 ///
62 bool rightToLeft_;
63 ///
64 std::string encodingStr_;
65 ///
66 Encoding const * encoding_;
67 ///
68 std::string code_;
69 ///
70 std::string latex_options_;
73 class Languages
75 public:
76 ///
77 typedef std::map<std::string, Language> LanguageList;
78 ///
79 typedef LanguageList::const_iterator const_iterator;
80 ///
81 typedef LanguageList::size_type size_type;
82 ///
83 void read(support::FileName const & filename);
84 ///
85 Language const * getLanguage(std::string const & language) const;
86 ///
87 size_type size() const { return languagelist.size(); }
88 ///
89 const_iterator begin() const { return languagelist.begin(); }
90 ///
91 const_iterator end() const { return languagelist.end(); }
92 ///
94 private:
95 ///
96 LanguageList languagelist;
99 /// Global singleton instance.
100 extern Languages languages;
101 /// Default language defined in LyXRC
102 extern Language const * default_language;
103 /// Used to indicate that the language should be left unchanged when
104 /// applying a font change.
105 extern Language const * ignore_language;
106 /// Default language defined in LyXRC
107 extern Language const * latex_language;
108 /// Used to indicate that the language should be reset to the Buffer
109 // language when applying a font change.
110 extern Language const * reset_language;
113 } // namespace lyx
115 #endif