mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
6c300f72a2
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15422 a592a061-630c-0410-9148-cb99ea01b6c8
91 lines
1.4 KiB
C++
91 lines
1.4 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file trans.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Lars Gullik Bjønnes
|
|
* \author Matthias Ettrich
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef TRANS_H
|
|
#define TRANS_H
|
|
|
|
#include "trans_decl.h"
|
|
|
|
#include <map>
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
class LyXLex;
|
|
|
|
class TransManager;
|
|
|
|
/**
|
|
Trans: holds a .kmap file
|
|
*/
|
|
class Trans {
|
|
public:
|
|
///
|
|
Trans();
|
|
///
|
|
~Trans();
|
|
|
|
///
|
|
int load(std::string const & language);
|
|
///
|
|
bool isDefined() const;
|
|
///
|
|
std::string const & getName() const;
|
|
///
|
|
std::string const process(char, TransManager &);
|
|
///
|
|
bool isAccentDefined(tex_accent, KmodInfo &) const;
|
|
|
|
private:
|
|
///
|
|
void addDeadkey(tex_accent, std::string const &);
|
|
///
|
|
void freeKeymap();
|
|
///
|
|
int load(LyXLex &);
|
|
///
|
|
std::string const & match(unsigned char c);
|
|
///
|
|
void insertException(KmodException & exclist, char c,
|
|
std::string const & data, bool = false,
|
|
tex_accent = TEX_NOACCENT);
|
|
///
|
|
void freeException(KmodException & exclist);
|
|
|
|
///
|
|
std::string name_;
|
|
///
|
|
std::map<int, std::string> keymap_;
|
|
///
|
|
std::map<int, KmodInfo> kmod_list_;
|
|
};
|
|
|
|
|
|
///
|
|
inline
|
|
std::string const & Trans::match(unsigned char c)
|
|
{
|
|
std::map<int, std::string>::iterator it = keymap_.find(c);
|
|
if (it != keymap_.end()) {
|
|
return it->second;
|
|
}
|
|
static std::string dummy;
|
|
return dummy;
|
|
}
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
#endif // TRANS_H
|