semf
semf::esh::ArrowControl Class Reference

Detect up-arrow and down-arrow key strokes via the Printer. More...

#include <arrowcontrol.h>

Collaboration diagram for semf::esh::ArrowControl:
Collaboration graph

Public Types

enum class  ErrorCode : uint8_t { Start_IsBusy = 0 , OnSecondChar_UnexpectedChar , OnThirdChar_UnexpectedChar }
 Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring). More...
 

Public Member Functions

 ArrowControl (Printer &printer, const int &count, bool echo)
 Constructor. More...
 
 ArrowControl (const ArrowControl &other)=delete
 
virtual ~ArrowControl ()=default
 
void start ()
 Starts the reading process. More...
 
 SEMF_SIGNAL (up)
 
 SEMF_SIGNAL (down)
 
 SEMF_SIGNAL (error, Error)
 

Detailed Description

Detect up-arrow and down-arrow key strokes via the Printer.

Definition at line 22 of file arrowcontrol.h.

Member Enumeration Documentation

◆ ErrorCode

enum class semf::esh::ArrowControl::ErrorCode : uint8_t
strong

Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring).

Enumerator
Start_IsBusy 
OnSecondChar_UnexpectedChar 
OnThirdChar_UnexpectedChar 

Definition at line 28 of file arrowcontrol.h.

Constructor & Destructor Documentation

◆ ArrowControl() [1/2]

semf::esh::ArrowControl::ArrowControl ( Printer printer,
const int &  count,
bool  echo 
)

Constructor.

Parameters
printerPrinter to read from
countReference on a variable holding the currently available char. Necessarry for cleanup.
echoIndicated wether the shell echos its input.

Definition at line 14 of file arrowcontrol.cpp.

◆ ArrowControl() [2/2]

semf::esh::ArrowControl::ArrowControl ( const ArrowControl other)
delete

◆ ~ArrowControl()

virtual semf::esh::ArrowControl::~ArrowControl ( )
virtualdefault

Member Function Documentation

◆ SEMF_SIGNAL() [1/3]

semf::esh::ArrowControl::SEMF_SIGNAL ( down  )

Emitted after down-error was pressed.

◆ SEMF_SIGNAL() [2/3]

semf::esh::ArrowControl::SEMF_SIGNAL ( error  ,
Error   
)

Emited on error.

◆ SEMF_SIGNAL() [3/3]

semf::esh::ArrowControl::SEMF_SIGNAL ( up  )

Emitted after up-arrow was pressed.

◆ start()

void semf::esh::ArrowControl::start ( )

Starts the reading process.

Note
This implementation expects that this function is called after receiving an ESC charcter ( '\33' ).
Exceptions
Start_IsBusyIf object is busy
OnSecondChar_UnexpectedCharIf second received character is not ’[’
OnThirdChar_UnexpectedCharIf third received character is not 'A' nor 'B'.

Definition at line 21 of file arrowcontrol.cpp.

Here is the call graph for this function: