1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-07-22 16:05:17 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +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
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "KmodInfo.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
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
///
|
2006-04-09 00:26:19 +00:00
|
|
|
|
int load(std::string const & language);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2006-04-09 00:26:19 +00:00
|
|
|
|
bool isDefined() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2006-04-09 00:26:19 +00:00
|
|
|
|
std::string const & getName() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2007-03-31 08:12:08 +00:00
|
|
|
|
docstring const process(char_type, 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
|
|
|
|
///
|
2007-03-31 08:12:08 +00:00
|
|
|
|
void addDeadkey(tex_accent, docstring const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2006-04-09 00:26:19 +00:00
|
|
|
|
void freeKeymap();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2006-04-09 00:26:19 +00:00
|
|
|
|
int load(LyXLex &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2007-03-31 08:12:08 +00:00
|
|
|
|
docstring const & match(char_type c);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2007-03-31 08:12:08 +00:00
|
|
|
|
void insertException(KmodException & exclist, char_type c,
|
|
|
|
|
docstring const & data, bool = false,
|
1999-09-27 18:44:28 +00:00
|
|
|
|
tex_accent = TEX_NOACCENT);
|
|
|
|
|
///
|
2006-04-09 00:26:19 +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
|
|
|
|
///
|
2007-03-31 08:12:08 +00:00
|
|
|
|
std::map<char_type, docstring> keymap_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2007-03-31 08:12:08 +00:00
|
|
|
|
std::map<tex_accent, 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
|
2007-03-31 08:12:08 +00:00
|
|
|
|
docstring const & Trans::match(char_type c)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2007-03-31 08:12:08 +00:00
|
|
|
|
std::map<char_type, docstring>::iterator it = keymap_.find(c);
|
2001-07-16 15:42:57 +00:00
|
|
|
|
if (it != keymap_.end()) {
|
|
|
|
|
return it->second;
|
|
|
|
|
}
|
2007-03-31 08:12:08 +00:00
|
|
|
|
static docstring dummy;
|
2001-07-16 15:42:57 +00:00
|
|
|
|
return dummy;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2002-07-22 16:05:17 +00:00
|
|
|
|
#endif // TRANS_H
|