summaryrefslogtreecommitdiffstats
path: root/src/terminal/parseraction.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal/parseraction.h')
-rw-r--r--src/terminal/parseraction.h248
1 files changed, 129 insertions, 119 deletions
diff --git a/src/terminal/parseraction.h b/src/terminal/parseraction.h
index bb36980..a24e881 100644
--- a/src/terminal/parseraction.h
+++ b/src/terminal/parseraction.h
@@ -38,128 +38,138 @@
#include <vector>
namespace Terminal {
- class Emulator;
+class Emulator;
}
namespace Parser {
- class Action
- {
- public:
- wchar_t ch;
- bool char_present;
-
- virtual std::string name( void ) = 0;
-
- virtual void act_on_terminal( Terminal::Emulator * ) const {};
-
- virtual bool ignore() const { return false; }
-
- Action() : ch( -1 ), char_present( false ) {};
- virtual ~Action() {};
- };
-
- using ActionPointer = std::shared_ptr<Action>;
- using Actions = std::vector<ActionPointer>;
-
- class Ignore : public Action {
- public:
- std::string name( void ) { return std::string( "Ignore" ); }
- bool ignore() const { return true; }
- };
- class Print : public Action {
- public:
- std::string name( void ) { return std::string( "Print" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class Execute : public Action {
- public:
- std::string name( void ) { return std::string( "Execute" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class Clear : public Action {
- public:
- std::string name( void ) { return std::string( "Clear" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class Collect : public Action {
- public:
- std::string name( void ) { return std::string( "Collect" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class Param : public Action {
- public:
- std::string name( void ) { return std::string( "Param" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class Esc_Dispatch : public Action {
- public:
- std::string name( void ) { return std::string( "Esc_Dispatch" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class CSI_Dispatch : public Action {
- public:
- std::string name( void ) { return std::string( "CSI_Dispatch" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class Hook : public Action {
- public: std::string name( void ) { return std::string( "Hook" ); }
- };
- class Put : public Action {
- public: std::string name( void ) { return std::string( "Put" ); }
- };
- class Unhook : public Action {
- public: std::string name( void ) { return std::string( "Unhook" ); }
- };
- class OSC_Start : public Action {
- public:
- std::string name( void ) { return std::string( "OSC_Start" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class OSC_Put : public Action {
- public:
- std::string name( void ) { return std::string( "OSC_Put" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
- class OSC_End : public Action {
- public:
- std::string name( void ) { return std::string( "OSC_End" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
- };
-
- class UserByte : public Action {
- /* user keystroke -- not part of the host-source state machine*/
- public:
- char c; /* The user-source byte. We don't try to interpret the charset */
-
- std::string name( void ) { return std::string( "UserByte" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
-
- UserByte( int s_c ) : c( s_c ) {}
-
- bool operator==( const UserByte &other ) const
- {
- return c == other.c;
- }
- };
-
- class Resize : public Action {
- /* resize event -- not part of the host-source state machine*/
- public:
- size_t width, height;
-
- std::string name( void ) { return std::string( "Resize" ); }
- void act_on_terminal( Terminal::Emulator *emu ) const;
-
- Resize( size_t s_width, size_t s_height )
- : width( s_width ),
- height( s_height )
- {}
-
- bool operator==( const Resize &other ) const
- {
- return ( width == other.width ) && ( height == other.height );
- }
- };
+class Action
+{
+public:
+ wchar_t ch;
+ bool char_present;
+
+ virtual std::string name( void ) = 0;
+
+ virtual void act_on_terminal( Terminal::Emulator* ) const {};
+
+ virtual bool ignore() const { return false; }
+
+ Action() : ch( -1 ), char_present( false ) {};
+ virtual ~Action() {};
+};
+
+using ActionPointer = std::shared_ptr<Action>;
+using Actions = std::vector<ActionPointer>;
+
+class Ignore : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Ignore" ); }
+ bool ignore() const { return true; }
+};
+class Print : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Print" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class Execute : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Execute" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class Clear : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Clear" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class Collect : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Collect" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class Param : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Param" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class Esc_Dispatch : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Esc_Dispatch" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class CSI_Dispatch : public Action
+{
+public:
+ std::string name( void ) { return std::string( "CSI_Dispatch" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class Hook : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Hook" ); }
+};
+class Put : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Put" ); }
+};
+class Unhook : public Action
+{
+public:
+ std::string name( void ) { return std::string( "Unhook" ); }
+};
+class OSC_Start : public Action
+{
+public:
+ std::string name( void ) { return std::string( "OSC_Start" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class OSC_Put : public Action
+{
+public:
+ std::string name( void ) { return std::string( "OSC_Put" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+class OSC_End : public Action
+{
+public:
+ std::string name( void ) { return std::string( "OSC_End" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+};
+
+class UserByte : public Action
+{
+ /* user keystroke -- not part of the host-source state machine*/
+public:
+ char c; /* The user-source byte. We don't try to interpret the charset */
+
+ std::string name( void ) { return std::string( "UserByte" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+
+ UserByte( int s_c ) : c( s_c ) {}
+
+ bool operator==( const UserByte& other ) const { return c == other.c; }
+};
+
+class Resize : public Action
+{
+ /* resize event -- not part of the host-source state machine*/
+public:
+ size_t width, height;
+
+ std::string name( void ) { return std::string( "Resize" ); }
+ void act_on_terminal( Terminal::Emulator* emu ) const;
+
+ Resize( size_t s_width, size_t s_height ) : width( s_width ), height( s_height ) {}
+
+ bool operator==( const Resize& other ) const { return ( width == other.width ) && ( height == other.height ); }
+};
}
#endif