Base class for data dumpers. More...
#include <DumperBase.h>
Classes | |
class | Indenter |
Helper class to keep track of indenting. More... | |
struct | IndentSettings |
Public Member Functions | |
DumperBase () | |
Default constructor: no indentation. More... | |
DumperBase (std::string const &indent, std::string const &firstIndent) | |
Constructor: sets indentation. More... | |
DumperBase (std::string const &indent) | |
Constructor: sets indentation. More... | |
template<typename Stream > | |
decltype(auto) | indenter (Stream &&out) const |
Returns an Indenter object tied to this dumper and out stream. More... | |
Indentation. | |
Indentation strings are expected to be written by the dumping algorithms at the beginning of each output line to ensure the proper alignment of the dump. The Note that this infrastructure only keeps track of the strings needed to indent the output, but it does not provide any tool to apply the indentation. | |
std::string const & | indent () const |
Returns the indentation string currently configured for all lines. More... | |
std::string const & | firstIndent () const |
Returns the indentation string currently configured for the first line. More... | |
void | setIndent (std::string const &indent, std::string const &firstIndent) |
Sets indentation strings to the specified values. More... | |
void | setIndent (std::string const &indent) |
Sets both indentation strings to the same specified value. More... | |
template<typename Stream > | |
Stream & | indented (Stream &&out, bool first=false) const |
Writes the indentation into a stream, and returns it for further output. More... | |
template<typename Stream > | |
Stream & | firstIndented (Stream &&out) const |
template<typename Stream > | |
Stream & | newline (Stream &&out) const |
Protected Member Functions | |
IndentSettings & | indentSettings () |
IndentSettings const & | indentSettings () const |
IndentSettings & | saveIndentSettings () |
Stacks a copy of the current settings, and returns the "new" ones. More... | |
IndentSettings & | restoreIndentSettings () |
Restores and returns the last saved settings. More... | |
Private Attributes | |
std::vector< IndentSettings > | fIndentSettings |
All indentation settings. More... | |
Base class for data dumpers.
This class provides some basic and common infrastructure:
Definition at line 39 of file DumperBase.h.
|
inline |
Default constructor: no indentation.
Definition at line 61 of file DumperBase.h.
|
inline |
Constructor: sets indentation.
indent | indentation for all lines except the first one (see indent() ) |
firstIndent | indentation for the first line (see firstIndent() ) |
Definition at line 69 of file DumperBase.h.
|
inline |
Constructor: sets indentation.
indent | indentation for all lines |
Definition at line 77 of file DumperBase.h.
|
inline |
Returns the indentation string currently configured for the first line.
Definition at line 99 of file DumperBase.h.
|
inline |
Writes first line indentation into a stream, and returns it for further output.
Definition at line 118 of file DumperBase.h.
|
inline |
Returns the indentation string currently configured for all lines.
Definition at line 96 of file DumperBase.h.
|
inline |
Writes the indentation into a stream, and returns it for further output.
Definition at line 112 of file DumperBase.h.
|
inline |
Returns an Indenter
object tied to this dumper and out
stream.
Definition at line 202 of file DumperBase.h.
|
inlineprotected |
Definition at line 207 of file DumperBase.h.
|
inlineprotected |
Definition at line 208 of file DumperBase.h.
|
inline |
Initiates a new output line, including indentation, and returns the stream for further output.
Definition at line 124 of file DumperBase.h.
|
inlineprotected |
Restores and returns the last saved settings.
Definition at line 220 of file DumperBase.h.
|
inlineprotected |
Stacks a copy of the current settings, and returns the "new" ones.
Definition at line 212 of file DumperBase.h.
|
inline |
Sets indentation strings to the specified values.
Definition at line 103 of file DumperBase.h.
|
inline |
Sets both indentation strings to the same specified value.
Definition at line 107 of file DumperBase.h.
|
private |
All indentation settings.
Definition at line 56 of file DumperBase.h.