Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
rosmon::Terminal::Parser Class Reference

Terminal escape sequence parser. More...

#include <terminal.h>

Public Member Functions

void apply ()
 Apply the current internal state (colors) on the terminal. More...
 
bool parse (char c)
 parse single character c More...
 
void parse (const std::string &str)
 parse string More...
 
 Parser ()
 
 Parser (Terminal *terminal)
 
std::vector< std::string > wrap (const std::string &str, unsigned int columns)
 Apply line wrapping. More...
 

Private Types

enum  State { STATE_ESCAPE, STATE_TYPE, STATE_CSI }
 

Private Member Functions

void parseSetAttributes (const std::string &str)
 

Private Attributes

Color m_bgColor
 
bool m_bold = false
 
std::string m_buf
 
Color m_fgColor
 
State m_state = STATE_ESCAPE
 
Terminalm_term = nullptr
 

Detailed Description

Terminal escape sequence parser.

This class allows the user to parse Linux escape sequences (restricted to simple color sequences for now).

Definition at line 102 of file terminal.h.

Member Enumeration Documentation

Enumerator
STATE_ESCAPE 
STATE_TYPE 
STATE_CSI 

Definition at line 127 of file terminal.h.

Constructor & Destructor Documentation

rosmon::Terminal::Parser::Parser ( )
inline

Definition at line 105 of file terminal.h.

rosmon::Terminal::Parser::Parser ( Terminal terminal)

Definition at line 31 of file terminal.cpp.

Member Function Documentation

void rosmon::Terminal::Parser::apply ( )

Apply the current internal state (colors) on the terminal.

Definition at line 161 of file terminal.cpp.

bool rosmon::Terminal::Parser::parse ( char  c)

parse single character c

Definition at line 71 of file terminal.cpp.

void rosmon::Terminal::Parser::parse ( const std::string &  str)

parse string

Definition at line 111 of file terminal.cpp.

void rosmon::Terminal::Parser::parseSetAttributes ( const std::string &  str)
private

Definition at line 36 of file terminal.cpp.

std::vector< std::string > rosmon::Terminal::Parser::wrap ( const std::string &  str,
unsigned int  columns 
)

Apply line wrapping.

Each returned line contains the appropriate escape sequences to set up the current color mode.

Definition at line 120 of file terminal.cpp.

Member Data Documentation

Color rosmon::Terminal::Parser::m_bgColor
private

Definition at line 140 of file terminal.h.

bool rosmon::Terminal::Parser::m_bold = false
private

Definition at line 141 of file terminal.h.

std::string rosmon::Terminal::Parser::m_buf
private

Definition at line 137 of file terminal.h.

Color rosmon::Terminal::Parser::m_fgColor
private

Definition at line 139 of file terminal.h.

State rosmon::Terminal::Parser::m_state = STATE_ESCAPE
private

Definition at line 136 of file terminal.h.

Terminal* rosmon::Terminal::Parser::m_term = nullptr
private

Definition at line 134 of file terminal.h.


The documentation for this class was generated from the following files:


rosmon_core
Author(s): Max Schwarz
autogenerated on Sat Jan 9 2021 03:35:43