hexed 0.3.0
 
Loading...
Searching...
No Matches
hexed::Stream_printer Class Reference

prints to a std::ostream. More...

#include <Printer.hpp>

Inheritance diagram for hexed::Stream_printer:
hexed::Printer

Classes

struct  Format
 for passing text formatting parameters to Stream_printer::Stream_printer More...
 

Public Types

enum  format_type {
  unspecified_type = -1 , default_type = 0 , bold = 1 , dim = 2 ,
  underline = 4 , blink = 5 , reverse = 7 , hidden = 8
}
 specifies the typeface (i.e. font) to print in More...
 
enum  format_color {
  unspecified_color = -1 , default_color = 9 , black = 0 , red = 1 ,
  green = 2 , yellow = 3 , blue = 4 , magenta = 5 ,
  cyan = 6 , gray = 7
}
 specifies the color to print in More...
 

Public Member Functions

 Stream_printer (std::ostream &stream=std::cout, Format emph_format=default_format)
 constructs a Stream_printer
 
void operator() (std::string, bool emph=false) override
 

Static Public Attributes

static const Format default_format
 

Detailed Description

prints to a std::ostream.

Member Enumeration Documentation

◆ format_color

specifies the color to print in

Note
unspecified_color is not the same as default_color. The latter will explicitly send an ASCII escape code which sets the color to the default. If the output stream was already printing in some non-default color, this will reset it to the default. It also requires the output stream to support colors. On the other hand, unspecified_color indicates that no escape code will be sent to specify the color
Enumerator
unspecified_color 

indicates that the text color is not specified

default_color 

explicitly indicates that the default color should be used

◆ format_type

specifies the typeface (i.e. font) to print in

Enumerator
unspecified_type 

indicates that the type is not specified

reverse 

indicates that the foreground and background colors are swapped

Constructor & Destructor Documentation

◆ Stream_printer()

hexed::Stream_printer::Stream_printer ( std::ostream & stream = std::cout,
Format emph_format = default_format )

constructs a Stream_printer

Parameters
streamstream to print to
emph_formatFormatting to apply to emphasized text. This requires stream to support ASCII formatting codes. cout and cerr support these codes, but ASCII files do not.

Member Function Documentation

◆ operator()()

void hexed::Stream_printer::operator() ( std::string message,
bool emph = false )
overridevirtual
Parameters
messagewhat you want to print
emphif true, some form of emphasis formatting will be used, if possible

Implements hexed::Printer.


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