]> git.lyx.org Git - lyx.git/blobdiff - src/trans_mgr.h
Remove cached var from RenderPreview. Changes elsewhere to suit.
[lyx.git] / src / trans_mgr.h
index 7b7e812c328baf60eabdbacafacd89ed0fcd40fb..a9e45777eb364e0b5e26a37c0fb17054b6a696f6 100644 (file)
@@ -1,35 +1,38 @@
 // -*- C++ -*-
-#ifndef Trans_Manager_h
-#define Trans_Manager_h
+/**
+ * \file trans_mgr.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_MANAGER_H
+#define TRANS_MANAGER_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include "tex-accent.h"
-#include "trans_decl.h"
 #include "chset.h"
-#include "LString.h"
+#include "trans_decl.h"
+
+#include <boost/scoped_ptr.hpp>
 
 class LyXText;
 class Trans;
 
-/// Translation State
+/// Translation state
 class TransState {
 public:
        ///
        virtual ~TransState() {}
-#if 0
        ///
-       virtual string const normalkey(char, string const &) = 0;
-#else
-       ///
-       virtual string const normalkey(char) = 0;
-#endif
+       virtual std::string const normalkey(char) = 0;
        ///
        virtual bool backspace() = 0;
        ///
-       virtual string const deadkey(char, KmodInfo) = 0;
+       virtual std::string const deadkey(char, KmodInfo) = 0;
        ///
        static char const TOKEN_SEP;
 };
@@ -48,13 +51,8 @@ protected:
        char deadkey2_;
        ///
        KmodInfo deadkey2_info_;
-#if 0
-       ///
-       KmodException comb_info_;
-#else
        ///
        Keyexc comb_info_;
-#endif
        ///
        TransState * init_state_;
        ///
@@ -71,21 +69,16 @@ public:
 
 
 /// Init State
-class TransInitState :         virtual public TransFSMData, public TransState {
+class TransInitState :virtual public TransFSMData, public TransState {
 public:
        ///
        TransInitState();
-#if 0
-       ///
-       virtual string const normalkey(char, string const &);
-#else
        ///
-       virtual string const normalkey(char);
-#endif
+       virtual std::string const normalkey(char);
        ///
        virtual bool backspace() { return true; }
        ///
-       virtual string const deadkey(char, KmodInfo);
+       virtual std::string const deadkey(char, KmodInfo);
 };
 
 
@@ -94,20 +87,15 @@ class TransDeadkeyState : virtual public TransFSMData, public TransState {
 public:
        ///
        TransDeadkeyState();
-#if 0
        ///
-       virtual string const normalkey(char, string const &);
-#else
-       ///
-       virtual string const normalkey(char);
-#endif
+       virtual std::string const normalkey(char);
        ///
        virtual bool backspace() {
                currentState = init_state_;
                return false;
        }
        ///
-       virtual string const deadkey(char, KmodInfo);
+       virtual std::string const deadkey(char, KmodInfo);
 };
 
 
@@ -116,24 +104,19 @@ class TransCombinedState : virtual public TransFSMData, public TransState {
 public:
        ///
        TransCombinedState();
-#if 0
-       ///
-       virtual string const normalkey(char, string const &);
-#else
        ///
-       virtual string const normalkey(char);
-#endif
+       virtual std::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 const deadkey(char, KmodInfo);
+       virtual std::string const deadkey(char, KmodInfo);
 };
 
 
@@ -156,26 +139,26 @@ private:
        ///
        Trans * active_;
        ///
-       Trans * t1_;
+       boost::scoped_ptr<Trans> t1_;
        ///
-       Trans * t2_;
+       boost::scoped_ptr<Trans> t2_;
        ///
        static Trans default_;
        ///
        CharacterSet chset_;
        ///
-       void insert(string const &, LyXText *);
+       void insert(std::string const &, LyXText *);
        ///
-       void insertVerbatim(string const &, LyXText *);
+       void insertVerbatim(std::string const &, LyXText *);
 public:
        ///
        TransManager();
        ///
-       virtual ~TransManager();
+       ~TransManager();
        ///
-       int SetPrimary(string const &);
+       int SetPrimary(std::string const &);
        ///
-       int SetSecondary(string const &);
+       int SetSecondary(std::string const &);
        ///
        void EnablePrimary();
        ///
@@ -183,7 +166,7 @@ public:
        ///
        void DisableKeymap();
        ///
-       bool setCharset(string const &);
+       bool setCharset(std::string const &);
        ///
        bool backspace() {
                return trans_fsm_.currentState->backspace();
@@ -191,38 +174,25 @@ public:
        ///
        void TranslateAndInsert(char, LyXText *);
        ///
-       string const deadkey(char, KmodInfo);
-#if 0
-       ///
-       string const normalkey(char, string const &);
-#else
+       std::string const deadkey(char, KmodInfo);
        ///
-       string const normalkey(char);
-#endif
+       std::string const normalkey(char);
        ///
        void deadkey(char, tex_accent, LyXText *);
 };
 
 
-#if 0
-inline
-string const TransManager::normalkey(char c, string const & t)
-{
-       return trans_fsm_.currentState->normalkey(c, t);
-}
-#else
 inline
-string const TransManager::normalkey(char c)
+std::string const TransManager::normalkey(char c)
 {
        return trans_fsm_.currentState->normalkey(c);
 }
-#endif
 
 
 inline
-string const TransManager::deadkey(char c, KmodInfo t)
+std::string const TransManager::deadkey(char c, KmodInfo t)
 {
        return trans_fsm_.currentState->deadkey(c, t);
 }
 
-#endif
+#endif // TRANS_MANAGER_H