X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftrans.h;h=4b923e87e6e35289f9b986e4bef1dddb34955ef2;hb=32ef0d04c48a1751abbb5e3b17d1bec25f22c255;hp=259433f300c18da2edfa2bcf9204455fb594b348;hpb=1cebcbea9904d51a8e3122c23e17d0d047292394;p=lyx.git diff --git a/src/trans.h b/src/trans.h index 259433f300..4b923e87e6 100644 --- a/src/trans.h +++ b/src/trans.h @@ -6,6 +6,8 @@ #pragma interface #endif +#include + #include "tex-accent.h" #include "LString.h" #include "trans_decl.h" @@ -14,6 +16,7 @@ class LyXLex; class TransManager; +#if 0 /** TransInterface: the interface that every translation class should obey too. @@ -22,82 +25,108 @@ class TransManager; class TransInterface { public: /// - virtual string process(char, TransManager &) = 0; + virtual string const process(char, TransManager &) = 0; /// - virtual bool isAccentDefined(tex_accent, KmodInfo &) = 0; + virtual bool isAccentDefined(tex_accent, KmodInfo &) const = 0; }; /** - DefaultTrans: the default translation class. Hols info + DefaultTrans: the default translation class. Holds info on tex-accents. Monostate */ class DefaultTrans : public TransInterface { -private: - /// - static bool init_; public: /// DefaultTrans(); /// - virtual string process(char, TransManager &); + virtual string const process(char, TransManager &); +private: + /// + static bool init_; }; - +#endif /** Trans: holds a .kmap file */ -class Trans : public TransInterface { +//class Trans : public TransInterface { +class Trans { public: /// Trans(); /// - virtual ~Trans(); + ~Trans(); /// int Load(string const & language); /// - bool IsDefined(); + bool IsDefined() const; /// - string const & GetName(); + string const & GetName() const; /// - string process(char, TransManager &); + string const process(char, TransManager &); /// - bool isAccentDefined(tex_accent, KmodInfo &); + bool isAccentDefined(tex_accent, KmodInfo &) const; private: +#if 0 /// typedef KmodInfo kmod_list_decl; /// typedef KmodException keyexc; - +#endif +#if 0 /// void AddDeadkey(tex_accent, string const &, string const &); +#else + /// + void AddDeadkey(tex_accent, string const &); +#endif /// void FreeKeymap(); /// int Load(LyXLex &); /// - inline char * Match(char c); + inline string const & Match(unsigned char c); /// - void InsertException(keyexc & exclist, char c, + void InsertException(KmodException & exclist, char c, string const & data, bool = false, tex_accent = TEX_NOACCENT); /// - void FreeException(keyexc & exclist); + void FreeException(KmodException & exclist); /// string name_; +#if 0 /// - char * keymap_[256]; + string keymap_[256]; +#else + std::map keymap_; +#endif +#if 0 /// kmod_list_decl * kmod_list_[TEX_MAX_ACCENT+1]; - +#else + /// + //KmodInfo * kmod_list_[TEX_MAX_ACCENT+1]; + std::map kmod_list_; +#endif }; -char * Trans::Match(char c) +/// +string const & Trans::Match(unsigned char c) { - return keymap_[static_cast(c)]; +#if 0 + return keymap_[c]; +#else + std::map::iterator it = keymap_.find(c); + if (it != keymap_.end()) { + return it->second; + } + static string dummy; + return dummy; +#endif } #endif