clutchlog  0.9
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
clutchlog::fmt Class Reference

Color and style formatter for ANSI terminal escape sequences. More...

#include <clutchlog.h>

Public Types

enum  fg {
  black = 30, red = 31, green = 32, yellow = 33,
  blue = 34, magenta = 35, cyan = 36, white = 37,
  none
}
 Foreground color codes.
 
enum  bg {
  black = 40, red = 41, green = 42, yellow = 43,
  blue = 44, magenta = 45, cyan = 46, white = 47,
  none
}
 Background color codes.
 
enum  typo {
  reset = 0, bold = 1, underline = 4, inverse = 7,
  none
}
 Typographic style codes.
 

Public Member Functions

 fmt ()
  Empty constructor, only useful for a no-op formatter.
 
std::string operator() (const std::string &msg) const
 Format the given string with the currently encoded format. More...
 
All combination of constructors with different parameters orders.
 fmt (fg f, bg b=bg::none, typo s=typo::none)
 
 fmt (fg f, typo s, bg b=bg::none)
 
 fmt (bg b, fg f=fg::none, typo s=typo::none)
 
 fmt (bg b, typo s, fg f=fg::none)
 
 fmt (typo s, fg f=fg::none, bg b=bg::none)
 
 fmt (typo s, bg b, fg f=fg::none)
 

Public Attributes

enum clutchlog::fmt::fg fore
 Foreground color.
 
enum clutchlog::fmt::bg back
 Background color.
 
enum clutchlog::fmt::typo style
 Typographic style.
 

Protected Member Functions

std::ostream & print_on (std::ostream &os) const
 Print the currently encoded format escape code on the given output stream.
 

Friends

std::ostream & operator<< (std::ostream &os, const fmt &fmt)
 Output stream overload. More...
 

Detailed Description

Color and style formatter for ANSI terminal escape sequences.

Note
All styles may not be supported by a given terminal/operating system.

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