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-10-06 15:43:21 +00:00
|
|
|
|
#include <string>
|
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
|
2000-07-04 20:32:37 +00:00
|
|
|
|
class Encoding;
|
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
|
|
|
|
class Language {
|
|
|
|
|
public:
|
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
Language() : rightToLeft_(false) {}
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
Language(std::string const & l, std::string const & b, std::string const & d,
|
2005-07-16 15:55:36 +00:00
|
|
|
|
bool rtl, std::string const & es, Encoding const * e, std::string const & c,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & o)
|
2005-07-16 12:02:31 +00:00
|
|
|
|
: lang_(l), babel_(b), display_(d), rightToLeft_(rtl),
|
2005-07-16 15:55:36 +00:00
|
|
|
|
encodingStr_(es), encoding_(e), code_(c), latex_options_(o)
|
2000-09-22 15:09:51 +00:00
|
|
|
|
{}
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
std::string const & lang() const { return lang_; }
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
std::string const & babel() const { return babel_; }
|
2000-09-27 15:23:24 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
std::string const & display() const { return display_; }
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2006-04-09 00:26:19 +00:00
|
|
|
|
bool rightToLeft() const { return rightToLeft_; }
|
2000-07-04 20:32:37 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
Encoding const * encoding() const { return encoding_; }
|
2000-09-22 15:09:51 +00:00
|
|
|
|
///
|
2005-07-16 15:55:36 +00:00
|
|
|
|
std::string const & encodingStr() const { return encodingStr_; }
|
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
std::string const & code() const { return code_; }
|
2001-01-20 14:16:01 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
std::string const & latex_options() const { return latex_options_; }
|
2000-06-08 23:16:16 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string lang_;
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string babel_;
|
2000-09-27 15:23:24 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string display_;
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
bool rightToLeft_;
|
2000-07-04 20:32:37 +00:00
|
|
|
|
///
|
2005-07-16 15:55:36 +00:00
|
|
|
|
std::string encodingStr_;
|
|
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
|
Encoding const * encoding_;
|
2000-09-22 15:09:51 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string code_;
|
2001-01-20 14:16:01 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::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:
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
typedef std::map<std::string, Language> LanguageList;
|
2000-10-10 12:36:36 +00:00
|
|
|
|
///
|
|
|
|
|
typedef LanguageList::const_iterator const_iterator;
|
|
|
|
|
///
|
2001-03-21 13:27:03 +00:00
|
|
|
|
typedef LanguageList::size_type size_type;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void read(std::string const & filename);
|
2000-10-10 12:36:36 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
Language const * getLanguage(std::string const & language) const;
|
2000-10-10 12:36:36 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
size_type size() const { return languagelist.size(); }
|
2001-03-21 13:27:03 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
const_iterator begin() const { return languagelist.begin(); }
|
2002-03-21 17:27:08 +00:00
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
|
const_iterator end() const { return languagelist.end(); }
|
2002-03-21 17:27:08 +00:00
|
|
|
|
///
|
|
|
|
|
|
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
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
|
#endif
|