LLDB mainline
AnsiTerminal.h File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Locale.h"
#include <string>

Go to the source code of this file.

Namespaces

namespace  lldb_private
 A class that represents a running process on the host machine.
namespace  lldb_private::ansi

Macros

#define ANSI_FG_COLOR_BLACK   30
#define ANSI_FG_COLOR_RED   31
#define ANSI_FG_COLOR_GREEN   32
#define ANSI_FG_COLOR_YELLOW   33
#define ANSI_FG_COLOR_BLUE   34
#define ANSI_FG_COLOR_PURPLE   35
#define ANSI_FG_COLOR_CYAN   36
#define ANSI_FG_COLOR_WHITE   37
#define ANSI_FG_COLOR_BRIGHT_BLACK   90
#define ANSI_FG_COLOR_BRIGHT_RED   91
#define ANSI_FG_COLOR_BRIGHT_GREEN   92
#define ANSI_FG_COLOR_BRIGHT_YELLOW   93
#define ANSI_FG_COLOR_BRIGHT_BLUE   94
#define ANSI_FG_COLOR_BRIGHT_PURPLE   95
#define ANSI_FG_COLOR_BRIGHT_CYAN   96
#define ANSI_FG_COLOR_BRIGHT_WHITE   97
#define ANSI_BG_COLOR_BLACK   40
#define ANSI_BG_COLOR_RED   41
#define ANSI_BG_COLOR_GREEN   42
#define ANSI_BG_COLOR_YELLOW   43
#define ANSI_BG_COLOR_BLUE   44
#define ANSI_BG_COLOR_PURPLE   45
#define ANSI_BG_COLOR_CYAN   46
#define ANSI_BG_COLOR_WHITE   47
#define ANSI_BG_COLOR_BRIGHT_BLACK   100
#define ANSI_BG_COLOR_BRIGHT_RED   101
#define ANSI_BG_COLOR_BRIGHT_GREEN   102
#define ANSI_BG_COLOR_BRIGHT_YELLOW   103
#define ANSI_BG_COLOR_BRIGHT_BLUE   104
#define ANSI_BG_COLOR_BRIGHT_PURPLE   105
#define ANSI_BG_COLOR_BRIGHT_CYAN   106
#define ANSI_BG_COLOR_BRIGHT_WHITE   107
#define ANSI_SPECIAL_FRAMED   51
#define ANSI_SPECIAL_ENCIRCLED   52
#define ANSI_CTRL_NORMAL   0
#define ANSI_CTRL_BOLD   1
#define ANSI_CTRL_FAINT   2
#define ANSI_CTRL_ITALIC   3
#define ANSI_CTRL_UNDERLINE   4
#define ANSI_CTRL_SLOW_BLINK   5
#define ANSI_CTRL_FAST_BLINK   6
#define ANSI_CTRL_IMAGE_NEGATIVE   7
#define ANSI_CTRL_CONCEAL   8
#define ANSI_CTRL_CROSSED_OUT   9
#define ANSI_ESC_START   "\033["
#define ANSI_ESC_END   "m"
#define ANSI_STR(s)
#define ANSI_DEF_STR(s)
#define ANSI_ESCAPE1(s)
#define ANSI_1_CTRL(ctrl1)
#define ANSI_2_CTRL(ctrl1, ctrl2)
#define ANSI_ESC_START_LEN   2
#define _TO_STR2(_val)
#define _TO_STR(_val)

Functions

std::string lldb_private::ansi::FormatAnsiTerminalCodes (llvm::StringRef format, bool do_color=true)
std::tuple< llvm::StringRef, llvm::StringRef, llvm::StringRef > lldb_private::ansi::FindNextAnsiSequence (llvm::StringRef str)
std::string lldb_private::ansi::StripAnsiTerminalCodes (llvm::StringRef str)
std::string lldb_private::ansi::TrimAndPad (llvm::StringRef str, size_t visible_length, char padding=' ')
size_t lldb_private::ansi::ColumnWidth (llvm::StringRef str)

Macro Definition Documentation

◆ _TO_STR

#define _TO_STR ( _val)
Value:
_TO_STR2(_val)
#define _TO_STR2(_val)

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ _TO_STR2

#define _TO_STR2 ( _val)
Value:
#_val

◆ ANSI_1_CTRL

#define ANSI_1_CTRL ( ctrl1)
Value:
"\033["##ctrl1 ANSI_ESC_END
#define ANSI_ESC_END

Definition at line 70 of file AnsiTerminal.h.

◆ ANSI_2_CTRL

#define ANSI_2_CTRL ( ctrl1,
ctrl2 )
Value:
"\033["##ctrl1 ";"##ctrl2 ANSI_ESC_END

Definition at line 71 of file AnsiTerminal.h.

◆ ANSI_BG_COLOR_BLACK

#define ANSI_BG_COLOR_BLACK   40

Definition at line 30 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BLUE

#define ANSI_BG_COLOR_BLUE   44

Definition at line 34 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_BLACK

#define ANSI_BG_COLOR_BRIGHT_BLACK   100

Definition at line 39 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_BLUE

#define ANSI_BG_COLOR_BRIGHT_BLUE   104

Definition at line 43 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_CYAN

#define ANSI_BG_COLOR_BRIGHT_CYAN   106

Definition at line 45 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_GREEN

#define ANSI_BG_COLOR_BRIGHT_GREEN   102

Definition at line 41 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_PURPLE

#define ANSI_BG_COLOR_BRIGHT_PURPLE   105

Definition at line 44 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_RED

#define ANSI_BG_COLOR_BRIGHT_RED   101

Definition at line 40 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_WHITE

#define ANSI_BG_COLOR_BRIGHT_WHITE   107

Definition at line 46 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_BRIGHT_YELLOW

#define ANSI_BG_COLOR_BRIGHT_YELLOW   103

Definition at line 42 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_CYAN

#define ANSI_BG_COLOR_CYAN   46

Definition at line 36 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_GREEN

#define ANSI_BG_COLOR_GREEN   42

Definition at line 32 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_PURPLE

#define ANSI_BG_COLOR_PURPLE   45

Definition at line 35 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_RED

#define ANSI_BG_COLOR_RED   41

Definition at line 31 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_WHITE

#define ANSI_BG_COLOR_WHITE   47

Definition at line 37 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_BG_COLOR_YELLOW

#define ANSI_BG_COLOR_YELLOW   43

Definition at line 33 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_BOLD

#define ANSI_CTRL_BOLD   1

◆ ANSI_CTRL_CONCEAL

#define ANSI_CTRL_CONCEAL   8

Definition at line 59 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_CROSSED_OUT

#define ANSI_CTRL_CROSSED_OUT   9

Definition at line 60 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_FAINT

#define ANSI_CTRL_FAINT   2

Definition at line 53 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_FAST_BLINK

#define ANSI_CTRL_FAST_BLINK   6

Definition at line 57 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_IMAGE_NEGATIVE

#define ANSI_CTRL_IMAGE_NEGATIVE   7

Definition at line 58 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_ITALIC

#define ANSI_CTRL_ITALIC   3

Definition at line 54 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_NORMAL

#define ANSI_CTRL_NORMAL   0

◆ ANSI_CTRL_SLOW_BLINK

#define ANSI_CTRL_SLOW_BLINK   5

Definition at line 56 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_CTRL_UNDERLINE

#define ANSI_CTRL_UNDERLINE   4

Definition at line 55 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_DEF_STR

#define ANSI_DEF_STR ( s)
Value:
#define ANSI_STR(s)

Definition at line 66 of file AnsiTerminal.h.

◆ ANSI_ESC_END

#define ANSI_ESC_END   "m"

Definition at line 63 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_ESC_START

#define ANSI_ESC_START   "\033["

◆ ANSI_ESC_START_LEN

#define ANSI_ESC_START_LEN   2

Definition at line 73 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FindNextAnsiSequence().

◆ ANSI_ESCAPE1

#define ANSI_ESCAPE1 ( s)
Value:
#define ANSI_ESC_START
#define ANSI_DEF_STR(s)

Definition at line 68 of file AnsiTerminal.h.

Referenced by lldb_private::REPL::IOHandlerInputComplete().

◆ ANSI_FG_COLOR_BLACK

#define ANSI_FG_COLOR_BLACK   30

Definition at line 12 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BLUE

#define ANSI_FG_COLOR_BLUE   34

Definition at line 16 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_BLACK

#define ANSI_FG_COLOR_BRIGHT_BLACK   90

Definition at line 21 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_BLUE

#define ANSI_FG_COLOR_BRIGHT_BLUE   94

Definition at line 25 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_CYAN

#define ANSI_FG_COLOR_BRIGHT_CYAN   96

Definition at line 27 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_GREEN

#define ANSI_FG_COLOR_BRIGHT_GREEN   92

Definition at line 23 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_PURPLE

#define ANSI_FG_COLOR_BRIGHT_PURPLE   95

Definition at line 26 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_RED

#define ANSI_FG_COLOR_BRIGHT_RED   91

Definition at line 22 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_WHITE

#define ANSI_FG_COLOR_BRIGHT_WHITE   97

Definition at line 28 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_BRIGHT_YELLOW

#define ANSI_FG_COLOR_BRIGHT_YELLOW   93

Definition at line 24 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_CYAN

#define ANSI_FG_COLOR_CYAN   36

Definition at line 18 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_GREEN

#define ANSI_FG_COLOR_GREEN   32

Definition at line 14 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_PURPLE

#define ANSI_FG_COLOR_PURPLE   35

Definition at line 17 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_RED

#define ANSI_FG_COLOR_RED   31

◆ ANSI_FG_COLOR_WHITE

#define ANSI_FG_COLOR_WHITE   37

Definition at line 19 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_FG_COLOR_YELLOW

#define ANSI_FG_COLOR_YELLOW   33

Definition at line 15 of file AnsiTerminal.h.

Referenced by lldb_private::ansi::FormatAnsiTerminalCodes().

◆ ANSI_SPECIAL_ENCIRCLED

#define ANSI_SPECIAL_ENCIRCLED   52

Definition at line 49 of file AnsiTerminal.h.

◆ ANSI_SPECIAL_FRAMED

#define ANSI_SPECIAL_FRAMED   51

Definition at line 48 of file AnsiTerminal.h.

◆ ANSI_STR

#define ANSI_STR ( s)
Value:
#s

Definition at line 65 of file AnsiTerminal.h.