prints to a std::ostream
.
More...
#include <Printer.hpp>
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 |
prints to a std::ostream
.
specifies the color to print in
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 |
hexed::Stream_printer::Stream_printer | ( | std::ostream & | stream = std::cout, |
Format | emph_format = default_format ) |
constructs a Stream_printer
stream | stream to print to |
emph_format | Formatting to apply to emphasized text. This requires stream to support ASCII formatting codes. cout and cerr support these codes, but ASCII files do not. |
|
overridevirtual |
message | what you want to print |
emph | if true , some form of emphasis formatting will be used, if possible |
Implements hexed::Printer.