1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-07-22 16:05:17 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file trans.h
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-07-22 16:05:17 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Matthias Ettrich
|
|
|
|
|
* \author John Levon
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-07-22 16:05:17 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef TRANS_H
|
|
|
|
|
#define TRANS_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-09-07 01:45:40 +00:00
|
|
|
|
#include "trans_decl.h"
|
2001-07-16 15:42:57 +00:00
|
|
|
|
|
2003-09-07 01:45:40 +00:00
|
|
|
|
#include <map>
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
class LyXLex;
|
|
|
|
|
|
|
|
|
|
class TransManager;
|
|
|
|
|
|
|
|
|
|
/**
|
2002-03-21 17:27:08 +00:00
|
|
|
|
Trans: holds a .kmap file
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*/
|
2001-07-16 15:42:57 +00:00
|
|
|
|
class Trans {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
Trans();
|
|
|
|
|
///
|
2001-07-16 15:42:57 +00:00
|
|
|
|
~Trans();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
int Load(std::string const & language);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
|
bool IsDefined() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & GetName() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const process(char, TransManager &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
|
bool isAccentDefined(tex_accent, KmodInfo &) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
2001-07-12 11:11:10 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void AddDeadkey(tex_accent, std::string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
void FreeKeymap();
|
|
|
|
|
///
|
|
|
|
|
int Load(LyXLex &);
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & Match(unsigned char c);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-07-16 15:42:57 +00:00
|
|
|
|
void InsertException(KmodException & exclist, char c,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & data, bool = false,
|
1999-09-27 18:44:28 +00:00
|
|
|
|
tex_accent = TEX_NOACCENT);
|
|
|
|
|
///
|
2001-07-16 15:42:57 +00:00
|
|
|
|
void FreeException(KmodException & exclist);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string name_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::map<int, std::string> keymap_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-07-16 15:42:57 +00:00
|
|
|
|
std::map<int, KmodInfo> kmod_list_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-12-05 08:50:13 +00:00
|
|
|
|
inline
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & Trans::Match(unsigned char c)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::map<int, std::string>::iterator it = keymap_.find(c);
|
2001-07-16 15:42:57 +00:00
|
|
|
|
if (it != keymap_.end()) {
|
|
|
|
|
return it->second;
|
|
|
|
|
}
|
2003-10-06 15:43:21 +00:00
|
|
|
|
static std::string dummy;
|
2001-07-16 15:42:57 +00:00
|
|
|
|
return dummy;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-22 16:05:17 +00:00
|
|
|
|
#endif // TRANS_H
|