JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwColor.h File Reference

ANSI color codes and color management for terminal output. More...

#include <map>
#include <cstdio>
#include <iostream>
+ Include dependency graph for QwColor.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  QwColor
 A color changing class for the output stream. More...
 

Namespaces

namespace  Qw
 

Macros

#define BLACK   "\033[30m"
 
#define RED   "\033[31m"
 
#define GREEN   "\033[32m"
 
#define BROWN   "\033[33m"
 
#define BLUE   "\033[34m"
 
#define MAGENTA   "\033[35m"
 
#define CYAN   "\033[36m"
 
#define WHITE   "\033[37m"
 
#define BOLD   "\033[1m"
 
#define BOLDRED   "\033[31;1m"
 
#define BOLDGREEN   "\033[32;1m"
 
#define BOLDBROWN   "\033[33;1m"
 
#define BOLDBLUE   "\033[34;1m"
 
#define BOLDMAGENTA   "\033[35;1m"
 
#define BOLDCYAN   "\033[36;1m"
 
#define BOLDWHITE   "\033[37;1m"
 
#define BACKRED   "\033[41m"
 
#define BACKGREEN   "\033[42m"
 
#define BACKBLUE   "\033[44m"
 
#define NORMAL   "\033[0m"
 

Typedefs

typedef std::map< Qw::EQwColor, std::string > QwColorMap
 

Enumerations

enum  Qw::EQwColor {
  Qw::kBlack , Qw::kRed , Qw::kGreen , Qw::kBrown ,
  Qw::kBlue , Qw::kMagenta , Qw::kCyan , Qw::kWhite ,
  Qw::kDefaultForeground , Qw::kBold , Qw::kBoldRed , Qw::kBoldGreen ,
  Qw::kBoldBrown , Qw::kBoldBlue , Qw::kBoldMagenta , Qw::kBoldCyan ,
  Qw::kBoldWhite , Qw::kBackRed , Qw::kBackGreen , Qw::kBackBlue ,
  Qw::kDefaultBackground , Qw::kNormal
}
 

Functions

std::ostream & operator<< (std::ostream &out, const QwColor &color)
 Output stream operator which uses the enum-to-escape-code mapping.
 

Detailed Description

ANSI color codes and color management for terminal output.

Definition in file QwColor.h.

Macro Definition Documentation

◆ BACKBLUE

#define BACKBLUE   "\033[44m"

Definition at line 61 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BACKGREEN

#define BACKGREEN   "\033[42m"

Definition at line 60 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BACKRED

#define BACKRED   "\033[41m"

Definition at line 59 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BLACK

#define BLACK   "\033[30m"

Definition at line 32 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BLUE

#define BLUE   "\033[34m"

Definition at line 36 of file QwColor.h.

Referenced by QwColor::CreateColorMap(), and QwDatabase::PrintServerInfo().

◆ BOLD

#define BOLD   "\033[1m"

Definition at line 41 of file QwColor.h.

Referenced by QwColor::CreateColorMap(), and QwDatabase::PrintServerInfo().

◆ BOLDBLUE

#define BOLDBLUE   "\033[34;1m"

Definition at line 54 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BOLDBROWN

#define BOLDBROWN   "\033[33;1m"

Definition at line 53 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BOLDCYAN

#define BOLDCYAN   "\033[36;1m"

Definition at line 56 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BOLDGREEN

#define BOLDGREEN   "\033[32;1m"

Definition at line 52 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BOLDMAGENTA

#define BOLDMAGENTA   "\033[35;1m"

Definition at line 55 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BOLDRED

#define BOLDRED   "\033[31;1m"

Definition at line 51 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BOLDWHITE

#define BOLDWHITE   "\033[37;1m"

Definition at line 57 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ BROWN

#define BROWN   "\033[33m"

Definition at line 35 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ CYAN

#define CYAN   "\033[36m"

Definition at line 38 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ GREEN

#define GREEN   "\033[32m"

Definition at line 34 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ MAGENTA

#define MAGENTA   "\033[35m"

Definition at line 37 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

◆ NORMAL

#define NORMAL   "\033[0m"

Definition at line 65 of file QwColor.h.

Referenced by QwColor::CreateColorMap(), and QwDatabase::PrintServerInfo().

◆ RED

#define RED   "\033[31m"

Definition at line 33 of file QwColor.h.

Referenced by QwColor::CreateColorMap(), and QwDatabase::PrintServerInfo().

◆ WHITE

#define WHITE   "\033[37m"

Definition at line 39 of file QwColor.h.

Referenced by QwColor::CreateColorMap().

Typedef Documentation

◆ QwColorMap

typedef std::map<Qw::EQwColor, std::string> QwColorMap

Definition at line 87 of file QwColor.h.

Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream & out,
const QwColor & color )
inline

Output stream operator which uses the enum-to-escape-code mapping.

Output stream operator.

Definition at line 156 of file QwColor.h.

157{
158 return out << color.kColorMap[color.foreground];
159}
static QwColorMap kColorMap
Definition QwColor.h:147
Qw::EQwColor foreground
Foreground color.
Definition QwColor.h:151