2000-03-10 13:52:19 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file language.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author Dekel Tsur
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
|
#ifndef LANGUAGE_H
|
|
|
|
|
#define LANGUAGE_H
|
|
|
|
|
|
|
|
|
|
#include <map>
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_string.h"
|
2000-03-10 13:52:19 +00:00
|
|
|
|
|
2000-07-04 20:32:37 +00:00
|
|
|
|
class Encoding;
|
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
|
|
|
|
class Language {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
Language() : RightToLeft_(false) {}
|
|
|
|
|
///
|
2000-09-27 15:23:24 +00:00
|
|
|
|
Language(string const & l, string const & b, string const & d,
|
2001-01-20 14:16:01 +00:00
|
|
|
|
bool rtl, Encoding const * e, string const & c,
|
|
|
|
|
string const & o)
|
2000-09-27 15:23:24 +00:00
|
|
|
|
: lang_(l), babel_(b), display_(d), RightToLeft_(rtl),
|
2001-01-20 14:16:01 +00:00
|
|
|
|
encoding_(e), code_(c), latex_options_(o)
|
2000-09-22 15:09:51 +00:00
|
|
|
|
{}
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
|
|
|
|
string const & lang() const {
|
|
|
|
|
return lang_;
|
|
|
|
|
}
|
|
|
|
|
///
|
2000-09-27 15:23:24 +00:00
|
|
|
|
string const & babel() const {
|
|
|
|
|
return babel_;
|
|
|
|
|
}
|
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
|
string const & display() const {
|
|
|
|
|
return display_;
|
|
|
|
|
}
|
|
|
|
|
///
|
|
|
|
|
bool RightToLeft() const {
|
|
|
|
|
return RightToLeft_;
|
|
|
|
|
}
|
2000-07-04 20:32:37 +00:00
|
|
|
|
///
|
|
|
|
|
Encoding const * encoding() const {
|
|
|
|
|
return encoding_;
|
|
|
|
|
}
|
2000-09-22 15:09:51 +00:00
|
|
|
|
///
|
|
|
|
|
string const & code() const {
|
|
|
|
|
return code_;
|
|
|
|
|
}
|
2001-01-20 14:16:01 +00:00
|
|
|
|
///
|
|
|
|
|
string const & latex_options() const {
|
|
|
|
|
return latex_options_;
|
|
|
|
|
}
|
2000-06-08 23:16:16 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
string lang_;
|
|
|
|
|
///
|
2000-09-27 15:23:24 +00:00
|
|
|
|
string babel_;
|
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
|
string display_;
|
|
|
|
|
///
|
|
|
|
|
bool RightToLeft_;
|
2000-07-04 20:32:37 +00:00
|
|
|
|
///
|
|
|
|
|
Encoding const * encoding_;
|
2000-09-22 15:09:51 +00:00
|
|
|
|
///
|
|
|
|
|
string code_;
|
2001-01-20 14:16:01 +00:00
|
|
|
|
///
|
|
|
|
|
string latex_options_;
|
2000-03-10 13:52:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
2000-10-10 12:36:36 +00:00
|
|
|
|
class Languages
|
2000-04-26 13:57:28 +00:00
|
|
|
|
{
|
2000-10-10 12:36:36 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
typedef std::map<string, Language> LanguageList;
|
|
|
|
|
///
|
|
|
|
|
typedef LanguageList::const_iterator const_iterator;
|
|
|
|
|
///
|
2001-03-21 13:27:03 +00:00
|
|
|
|
typedef LanguageList::size_type size_type;
|
|
|
|
|
///
|
2000-10-10 12:36:36 +00:00
|
|
|
|
void read(string const & filename);
|
|
|
|
|
///
|
|
|
|
|
Language const * getLanguage(string const & language) const;
|
|
|
|
|
///
|
2001-03-21 13:27:03 +00:00
|
|
|
|
size_type size() const {
|
|
|
|
|
return languagelist.size();
|
|
|
|
|
}
|
|
|
|
|
///
|
2000-10-10 12:36:36 +00:00
|
|
|
|
const_iterator begin() const {
|
2002-03-21 17:27:08 +00:00
|
|
|
|
return languagelist.begin();
|
|
|
|
|
}
|
|
|
|
|
///
|
|
|
|
|
const_iterator end() const {
|
|
|
|
|
return languagelist.end();
|
|
|
|
|
}
|
|
|
|
|
///
|
|
|
|
|
|
2000-10-10 12:36:36 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
LanguageList languagelist;
|
|
|
|
|
};
|
2000-04-26 13:57:28 +00:00
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
|
extern Languages languages;
|
2000-03-17 10:14:46 +00:00
|
|
|
|
extern Language const * default_language;
|
2000-10-30 21:53:29 +00:00
|
|
|
|
extern Language const * english_language;
|
2001-03-21 13:27:03 +00:00
|
|
|
|
extern Language const * ignore_language;
|
2001-08-11 18:31:14 +00:00
|
|
|
|
extern Language const * latex_language;
|
2000-03-10 13:52:19 +00:00
|
|
|
|
|
|
|
|
|
#endif
|