]> git.lyx.org Git - lyx.git/blobdiff - src/trans_mgr.h
update no.po
[lyx.git] / src / trans_mgr.h
index d75a56e871dd5a4cde9cf6badc9410672c30b421..2620dde25db555bc0922c773e43685c175086ed9 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
-#ifndef _Trans_Manager_h_
-#define _Trans_Manager_h_
+#ifndef TRANS_MANAGER_H
+#define TRANS_MANAGER_H
 
 #ifdef __GNUG__
 #pragma interface
@@ -8,25 +8,25 @@
 
 #include "tex-accent.h"
 #include "trans_decl.h"
+#include "chset.h"
+#include "LString.h"
 
 class LyXText;
-class LString;
-class CharacterSet;
 class Trans;
 
-/// Translation State
+/// Translation state
 class TransState {
 public:
        ///
-       virtual ~TransState();
+       virtual ~TransState() {}
        ///
-       virtual string normalkey(char,char*)=0;
+       virtual string const normalkey(char) = 0;
        ///
-       virtual bool backspace()=0;
+       virtual bool backspace() = 0;
        ///
-       virtual string deadkey(char,KmodInfo)=0;
+       virtual string const deadkey(char, KmodInfo) = 0;
        ///
-       static const char TOKEN_SEP;
+       static char const TOKEN_SEP;
 };
 
 
@@ -34,8 +34,7 @@ public:
 class TransFSMData {
 protected:
        ///
-       virtual ~TransFSMData()
-       {}
+       virtual ~TransFSMData() {}
        ///
        char deadkey_;
        ///
@@ -45,114 +44,104 @@ protected:
        ///
        KmodInfo deadkey2_info_;
        ///
-       KmodException comb_info_;
+       Keyexc comb_info_;
        ///
-       TransState* init_state_;
+       TransState * init_state_;
        ///
-       TransState* deadkey_state_;
+       TransState * deadkey_state_;
        ///
-       TransState* combined_state_;
+       TransState * combined_state_;
        ///
 public:
        ///
        TransFSMData();
        ///
-       TransState* currentState;
+       TransState * currentState;
 };
 
 
 /// Init State
-class TransInitState: 
-       virtual public TransFSMData,
-       public TransState {
+class TransInitState : virtual public TransFSMData, public TransState {
 public:
-               ///
-               TransInitState();
-               ///
-               virtual string normalkey(char,char*);
-               ///
-               virtual bool backspace() { return true; }
-               ///
-               virtual string deadkey(char,KmodInfo);
+       ///
+       TransInitState();
+       ///
+       virtual string const normalkey(char);
+       ///
+       virtual bool backspace() { return true; }
+       ///
+       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 bool backspace()
-       {
-               currentState=init_state_;
+       ///
+       TransDeadkeyState();
+       ///
+       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 bool backspace()
-       {
+       ///
+       TransCombinedState();
+       ///
+       virtual string const normalkey(char);
+       ///
+       virtual bool backspace() {
                // cancel the second deadkey
-               deadkey2_=0;
-               deadkey2_info_.accent=TEX_NOACCENT;
-               currentState=deadkey_state_;
-               
+               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();
 };
 
+
 ///
-class TransManager
-{
+class TransManager {
 private:
        ///
        TransFSM trans_fsm_;
        ///
-       Trans* active_;
+       Trans * active_;
        ///
-       Trans* t1_;
+       Trans * t1_;
        ///
-       Trans* t2_;
+       Trans * t2_;
        ///
-       static Trans* default_;
+       static Trans default_;
        ///
-       CharacterSet* chset_;
+       CharacterSet chset_;
        ///
-       void insert(string,LyXText*);
+       void insert(string const &, LyXText *);
        ///
-       void insertVerbatim(const string&,LyXText*);
+       void insertVerbatim(string const &, LyXText *);
 public:
        ///
        TransManager();
@@ -169,33 +158,33 @@ public:
        ///
        void DisableKeymap();
        ///
-       bool setCharset(const char*);
+       bool setCharset(string const &);
        ///
-       bool backspace()
-       {
+       bool backspace() {
                return trans_fsm_.currentState->backspace();
        }
        ///
-       void TranslateAndInsert(char,LyXText*);
+       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*);
-    
+       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);
+       return trans_fsm_.currentState->deadkey(c, t);
 }
 
-#endif
+#endif // TRANS_MANAGER_H