Use shared_ptr and references for Actions.

This slows terminal emulation slightly.
This commit is contained in:
John Hood
2017-05-11 01:22:12 -04:00
parent c6c7f09954
commit 42d2b5d029
13 changed files with 104 additions and 113 deletions
+9 -9
View File
@@ -50,8 +50,8 @@ namespace Parser {
public:
void setfamily( StateFamily *s_family ) { family = s_family; }
Transition input( wchar_t ch ) const;
virtual Action *enter( void ) const { return new Ignore; }
virtual Action *exit( void ) const { return new Ignore; }
virtual ActionPointer enter( void ) const { return shared::make_shared< Ignore >(); }
virtual ActionPointer exit( void ) const { return shared::make_shared< Ignore >(); }
State() : family( NULL ) {};
virtual ~State() {};
@@ -65,7 +65,7 @@ namespace Parser {
};
class Escape : public State {
Action *enter( void ) const;
ActionPointer enter( void ) const;
Transition input_state_rule( wchar_t ch ) const;
};
@@ -74,7 +74,7 @@ namespace Parser {
};
class CSI_Entry : public State {
Action *enter( void ) const;
ActionPointer enter( void ) const;
Transition input_state_rule( wchar_t ch ) const;
};
class CSI_Param : public State {
@@ -88,7 +88,7 @@ namespace Parser {
};
class DCS_Entry : public State {
Action *enter( void ) const;
ActionPointer enter( void ) const;
Transition input_state_rule( wchar_t ch ) const;
};
class DCS_Param : public State {
@@ -98,18 +98,18 @@ namespace Parser {
Transition input_state_rule( wchar_t ch ) const;
};
class DCS_Passthrough : public State {
Action *enter( void ) const;
ActionPointer enter( void ) const;
Transition input_state_rule( wchar_t ch ) const;
Action *exit( void ) const;
ActionPointer exit( void ) const;
};
class DCS_Ignore : public State {
Transition input_state_rule( wchar_t ch ) const;
};
class OSC_String : public State {
Action *enter( void ) const;
ActionPointer enter( void ) const;
Transition input_state_rule( wchar_t ch ) const;
Action *exit( void ) const;
ActionPointer exit( void ) const;
};
class SOS_PM_APC_String : public State {
Transition input_state_rule( wchar_t ch ) const;