X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftrans_mgr.h;h=f0126244ccee91df45d8feeb5654e0d49ab3db32;hb=09e01879979643949f1f2c7216023f1f35d5ada2;hp=93cc95adfe0c6ea49a3d8598a6777e530faac967;hpb=5f3f9ad231bc0c24d34c00e3936e226d9834589a;p=lyx.git diff --git a/src/trans_mgr.h b/src/trans_mgr.h index 93cc95adfe..f0126244cc 100644 --- a/src/trans_mgr.h +++ b/src/trans_mgr.h @@ -1,10 +1,6 @@ // -*- C++ -*- -#ifndef Trans_Manager_h -#define Trans_Manager_h - -#ifdef __GNUG__ -#pragma interface -#endif +#ifndef TRANS_MANAGER_H +#define TRANS_MANAGER_H #include "tex-accent.h" #include "trans_decl.h" @@ -14,17 +10,17 @@ class LyXText; class Trans; -/// Translation State +/// Translation state class TransState { public: /// virtual ~TransState() {} /// - virtual string normalkey(char, char *) = 0; + virtual string const normalkey(char) = 0; /// virtual bool backspace() = 0; /// - virtual string deadkey(char, KmodInfo) = 0; + virtual string const deadkey(char, KmodInfo) = 0; /// static char const TOKEN_SEP; }; @@ -44,7 +40,7 @@ protected: /// KmodInfo deadkey2_info_; /// - KmodException comb_info_; + Keyexc comb_info_; /// TransState * init_state_; /// @@ -61,70 +57,62 @@ public: /// Init State -class TransInitState : - virtual public TransFSMData, - public TransState { +class TransInitState :virtual public TransFSMData, public TransState { public: /// TransInitState(); /// - virtual string normalkey(char, char *); + virtual string const normalkey(char); /// virtual bool backspace() { return true; } /// - virtual string deadkey(char, KmodInfo); + virtual string const deadkey(char, KmodInfo); }; /// Deadkey State -class TransDeadkeyState : - virtual public TransFSMData, - public TransState { +class TransDeadkeyState : virtual public TransFSMData, public TransState { public: /// TransDeadkeyState(); /// - virtual string normalkey(char, char *); + virtual string const normalkey(char); /// virtual bool backspace() { currentState = init_state_; return false; } /// - virtual string deadkey(char, KmodInfo); + virtual string const deadkey(char, KmodInfo); }; /// Combined State -class TransCombinedState: - virtual public TransFSMData, - public TransState { +class TransCombinedState : virtual public TransFSMData, public TransState { public: /// TransCombinedState(); /// - virtual string normalkey(char, char *); + virtual string const normalkey(char); /// virtual bool backspace() { // cancel the second deadkey deadkey2_ = 0; deadkey2_info_.accent = TEX_NOACCENT; currentState = deadkey_state_; - + return false; } /// - virtual string deadkey(char, KmodInfo); + virtual string const deadkey(char, KmodInfo); }; /// -class TransFSM : - virtual public TransFSMData, - public TransInitState, - public TransDeadkeyState, - public TransCombinedState -{ +class TransFSM : virtual public TransFSMData, + public TransInitState, + public TransDeadkeyState, + public TransCombinedState { public: /// TransFSM(); @@ -143,11 +131,11 @@ private: /// Trans * t2_; /// - static Trans * default_; + static Trans default_; /// CharacterSet chset_; /// - void insert(string, LyXText *); + void insert(string const &, LyXText *); /// void insertVerbatim(string const &, LyXText *); public: @@ -166,7 +154,7 @@ public: /// void DisableKeymap(); /// - bool setCharset(const char *); + bool setCharset(string const &); /// bool backspace() { return trans_fsm_.currentState->backspace(); @@ -174,23 +162,25 @@ public: /// void TranslateAndInsert(char, LyXText *); /// - inline string deadkey(char, KmodInfo); + string const deadkey(char, KmodInfo); /// - inline string normalkey(char, char *); + string const normalkey(char); /// void deadkey(char, tex_accent, LyXText *); }; -string TransManager::normalkey(char c, char * t) +inline +string const TransManager::normalkey(char c) { - return trans_fsm_.currentState->normalkey(c, t); + return trans_fsm_.currentState->normalkey(c); } -string TransManager::deadkey(char c, KmodInfo t) +inline +string const TransManager::deadkey(char c, KmodInfo t) { return trans_fsm_.currentState->deadkey(c, t); } -#endif +#endif // TRANS_MANAGER_H