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, bool use_escape_codes=false, Format emph_format=default_format) | |
constructs a Stream_printer | |
| void | operator() (std::string, bool emph=false, bool replace=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, |
| bool | use_escape_codes = false, | ||
| Format | emph_format = default_format ) |
constructs a Stream_printer
| stream | stream to print to |
| use_escape_codes | If true, ASCII escape codes will be used to apply formatting to the text and play other tricks. This is necessary for the emph and replace arguments of operator() to have any effect, but it also requires the stream to support ASCII escape codes. cout and cerr support these codes, but ASCII files do not. |
| emph_format | Formatting to apply to emphasized text. Any value other than the default will require use_escape_codes = true. |
|
overridevirtual |
| message | what you want to print |
| emph | If true, some form of emphasis formatting will be used, if possible. |
| replace | If true, message will replace the current line of text on the screen, rather than be appended to it. |
Implements hexed::Printer.