Classes | Public Types | Static Public Member Functions | List of all members
lar_content::LArFormattingHelper Class Reference

LArFormattingHelper class. More...

#include <LArFormattingHelper.h>

Classes

class  Table
 Table class. More...
 

Public Types

enum  Style : unsigned int {
  REGULAR = 0, BOLD = 1, DIM = 2, UNDERLINED = 4,
  INVERTED = 7
}
 Style code enumeration. More...
 
enum  Color : unsigned int {
  DEFAULT = 39, BLACK = 30, RED = 31, GREEN = 32,
  YELLOW = 33, BLUE = 34, MAGENTA = 35, CYAN = 36,
  LIGHT_GRAY = 37, DARK_GRAY = 90, LIGHT_RED = 91, LIGHT_GREEN = 92,
  LIGHT_YELLOW = 93, LIGHT_BLUE = 94, LIGHT_MAGENTA = 95, LIGHT_CYAN = 96,
  WHITE = 97
}
 Style code enumeration. More...
 

Static Public Member Functions

enum Color unsigned int enum static Style unsigned int void SetStyle (const Style style, std::ostream &stream=std::cout)
 Set the format style (to standard output stream) More...
 
static void SetColor (const Color color, std::ostream &stream=std::cout)
 Set the text color (of standard output stream) More...
 
static void ResetStyle (std::ostream &stream=std::cout)
 Reset the style of the standard output stream. More...
 
static void ResetColor (std::ostream &stream=std::cout)
 Reset the text color of the standard output stream. More...
 
static void Reset (std::ostream &stream=std::cout)
 Reset the formatting and text color of the standard output stream. More...
 
static void PrintFormatCharacter (const unsigned int code, std::ostream &stream=std::cout)
 Print a formatting character to the standard output stream. More...
 
static std::string GetFormatCharacter (const unsigned int code)
 Get a formatting character. More...
 
static void PrintHeader (const std::string &title="", const unsigned int width=140)
 Print a header line of a given width. More...
 
static void PrintRule (const unsigned int width=140)
 Print a horizontal rule. More...
 

Detailed Description

LArFormattingHelper class.

Definition at line 25 of file LArFormattingHelper.h.

Member Enumeration Documentation

Style code enumeration.

Enumerator
DEFAULT 
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
LIGHT_GRAY 
DARK_GRAY 
LIGHT_RED 
LIGHT_GREEN 
LIGHT_YELLOW 
LIGHT_BLUE 
LIGHT_MAGENTA 
LIGHT_CYAN 
WHITE 

Definition at line 104 of file LArFormattingHelper.h.

104  : unsigned int
105  {
106  DEFAULT = 39,
107  BLACK = 30,
108  RED = 31,
109  GREEN = 32,
110  YELLOW = 33,
111  BLUE = 34,
112  MAGENTA = 35,
113  CYAN = 36,
114  LIGHT_GRAY = 37,
115  DARK_GRAY = 90,
116  LIGHT_RED = 91,
117  LIGHT_GREEN = 92,
118  LIGHT_YELLOW = 93,
119  LIGHT_BLUE = 94,
120  LIGHT_MAGENTA = 95,
121  LIGHT_CYAN = 96,
122  WHITE = 97
123  };

Style code enumeration.

Enumerator
REGULAR 
BOLD 
DIM 
UNDERLINED 
INVERTED 

Definition at line 92 of file LArFormattingHelper.h.

Member Function Documentation

std::string lar_content::LArFormattingHelper::GetFormatCharacter ( const unsigned int  code)
static

Get a formatting character.

Parameters
codethe formatting code to output

Definition at line 62 of file LArFormattingHelper.cc.

63 {
64  const std::string startFormattingCode("\x1B[");
65  const std::string endFormattingCode("m");
66  return (startFormattingCode + std::to_string(code) + endFormattingCode);
67 }
std::string string
Definition: nybbler.cc:12
CodeOutputInterface * code
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
void lar_content::LArFormattingHelper::PrintFormatCharacter ( const unsigned int  code,
std::ostream &  stream = std::cout 
)
static

Print a formatting character to the standard output stream.

Parameters
codethe formatting code to output

Definition at line 54 of file LArFormattingHelper.cc.

55 {
57  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
58 }
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
CodeOutputInterface * code
void lar_content::LArFormattingHelper::PrintHeader ( const std::string title = "",
const unsigned int  width = 140 
)
static

Print a header line of a given width.

Parameters
titlethe title of the header
widththe width of the header line

Definition at line 71 of file LArFormattingHelper.cc.

72 {
74  std::cout << std::endl << std::string(width, '-') << "\r-" << title << std::endl;
76 }
std::string string
Definition: nybbler.cc:12
static void Reset(std::ostream &stream=std::cout)
Reset the formatting and text color of the standard output stream.
QTextStream & endl(QTextStream &s)
enum Color unsigned int enum static Style unsigned int void SetStyle(const Style style, std::ostream &stream=std::cout)
Set the format style (to standard output stream)
void lar_content::LArFormattingHelper::PrintRule ( const unsigned int  width = 140)
static

Print a horizontal rule.

Parameters
widththe width of the rule line

Definition at line 80 of file LArFormattingHelper.cc.

81 {
83 }
static void PrintHeader(const std::string &title="", const unsigned int width=140)
Print a header line of a given width.
void lar_content::LArFormattingHelper::Reset ( std::ostream &  stream = std::cout)
static

Reset the formatting and text color of the standard output stream.

Definition at line 46 of file LArFormattingHelper.cc.

47 {
50 }
static void ResetColor(std::ostream &stream=std::cout)
Reset the text color of the standard output stream.
static void ResetStyle(std::ostream &stream=std::cout)
Reset the style of the standard output stream.
void lar_content::LArFormattingHelper::ResetColor ( std::ostream &  stream = std::cout)
static

Reset the text color of the standard output stream.

Definition at line 39 of file LArFormattingHelper.cc.

40 {
42 }
static void SetColor(const Color color, std::ostream &stream=std::cout)
Set the text color (of standard output stream)
void lar_content::LArFormattingHelper::ResetStyle ( std::ostream &  stream = std::cout)
static

Reset the style of the standard output stream.

Definition at line 32 of file LArFormattingHelper.cc.

33 {
35 }
enum Color unsigned int enum static Style unsigned int void SetStyle(const Style style, std::ostream &stream=std::cout)
Set the format style (to standard output stream)
void lar_content::LArFormattingHelper::SetColor ( const Color  color,
std::ostream &  stream = std::cout 
)
static

Set the text color (of standard output stream)

Parameters
colorthe color of choice

Definition at line 25 of file LArFormattingHelper.cc.

26 {
27  LArFormattingHelper::PrintFormatCharacter(static_cast<unsigned int>(color), stream);
28 }
static void PrintFormatCharacter(const unsigned int code, std::ostream &stream=std::cout)
Print a formatting character to the standard output stream.
void lar_content::LArFormattingHelper::SetStyle ( const Style  style,
std::ostream &  stream = std::cout 
)
static

Set the format style (to standard output stream)

Parameters
stylethe style of choice

Definition at line 18 of file LArFormattingHelper.cc.

19 {
20  LArFormattingHelper::PrintFormatCharacter(static_cast<unsigned int>(style), stream);
21 }
static void PrintFormatCharacter(const unsigned int code, std::ostream &stream=std::cout)
Print a formatting character to the standard output stream.

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