Base Framework
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
ANSIEscapeSequence Class Reference

ANSI escape sequence. More...

#include <base/string/ANSIEscapeSequence.h>

Classes

class  Escape
 
class  MoveCursor
 
class  SetAttributes
 
class  SetColor
 
class  SetCursor
 

Public Types

enum  Attributes {
  BOLD = 1, UNDERSCORE = 2, BLINK = 4, REVERSE = 8,
  CONCEAL = 16
}
 
enum  Color {
  BLACK, RED, GREEN, YELLOW,
  BLUE, MAGENTA, CYAN, WHITE
}
 

Public Member Functions

 ANSIEscapeSequence (FormatOutputStream &_stream) noexcept
 
void setCursor (unsigned int line, unsigned int column)
 
void up (unsigned int count)
 
void down (unsigned int count)
 
void forward (unsigned int count)
 
void backward (unsigned int count)
 
void setAttributes (unsigned int flags)
 
void setForeground (Color color)
 
void setBackground (Color color)
 

Static Public Member Functions

static String color (uint8 index)
 
static String color (uint8 red, uint8 green, uint8 blue)
 
static String backgroundColor (uint8 index)
 
static String backgroundColor (uint8 red, uint8 green, uint8 blue)
 

Detailed Description

ANSI escape sequence.

This class provides support for writing ANSI escape sequences to a format output stream.

Version
1.0

Member Enumeration Documentation

◆ Attributes

Text attributes.

Enumerator
BOLD 

Selects bold.

UNDERSCORE 

Selects underscore.

BLINK 

Selects blink.

REVERSE 

Selects reversed.

CONCEAL 

Selects concealed.

◆ Color

Color.

Enumerator
BLACK 

Black.

RED 

Red.

GREEN 

Green.

YELLOW 

Yellow.

BLUE 

Blue.

MAGENTA 

Magenta.

CYAN 

Cyan.

WHITE 

White.

Constructor & Destructor Documentation

◆ ANSIEscapeSequence()

ANSIEscapeSequence::ANSIEscapeSequence ( FormatOutputStream _stream)
inlinenoexcept

Initializes the ANSI escape sequence object.

Member Function Documentation

◆ backgroundColor() [1/2]

static String ANSIEscapeSequence::backgroundColor ( uint8  index)
static

Activates background color by index. Not using standard.

◆ backgroundColor() [2/2]

static String ANSIEscapeSequence::backgroundColor ( uint8  red,
uint8  green,
uint8  blue 
)
static

Activates background RGB color. Not using standard.

◆ backward()

void ANSIEscapeSequence::backward ( unsigned int  count)

Moves the cursor backward by the specified number of columns.

◆ color() [1/2]

static String ANSIEscapeSequence::color ( uint8  index)
static

Activates color by index. Not using standard.

◆ color() [2/2]

static String ANSIEscapeSequence::color ( uint8  red,
uint8  green,
uint8  blue 
)
static

Activates RGB color. Not using standard.

◆ down()

void ANSIEscapeSequence::down ( unsigned int  count)

Moves the cursor down by the specified number of lines.

◆ forward()

void ANSIEscapeSequence::forward ( unsigned int  count)

Moves the cursor forward by the specified number of columns.

◆ setAttributes()

void ANSIEscapeSequence::setAttributes ( unsigned int  flags)

Sets the text attributes.

◆ setBackground()

void ANSIEscapeSequence::setBackground ( Color  color)

Sets the background color.

◆ setCursor()

void ANSIEscapeSequence::setCursor ( unsigned int  line,
unsigned int  column 
)

Sets the cursor position.

◆ setForeground()

void ANSIEscapeSequence::setForeground ( Color  color)

Sets the foreground color.

◆ up()

void ANSIEscapeSequence::up ( unsigned int  count)

Moves the cursor up by the specified number of lines.