LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Helper class to keep track of indenting. More...
#include "DumperBase.h"
Public Types | |
using | indenter_t = Indenter< Stream > |
This type. More... | |
Public Member Functions | |
Indenter (Stream out, DumperBase const &dumper) | |
Records the underlying stream and the dumper associated. More... | |
std::string const & | indentString () const |
Returns the default indentation string. More... | |
std::string const & | firstIndentString () const |
Returns the indentation string for the first line. More... | |
template<typename T > | |
indenter_t & | operator<< (T &&v) |
Forwards data to the underlying stream. More... | |
indenter_t & | indent (bool first=false) |
Inserts an indentation and returns the indenter for further output. More... | |
indenter_t & | newline () |
Breaks the current line and returns the indenter for further output. More... | |
indenter_t & | start () |
Private Attributes | |
Stream | out |
DumperBase const & | dumper |
Helper class to keep track of indenting.
Stream | type of output stream the class is using |
This class is single use, tied to a dumper and to a stream instance. It does not attempt to keep track of whether the output line is the first or not, and it does not try to detect end-of-line characters in the passed strings to insert internal indentation.
Each object is tied to a dump::DumperBase
object and it reflects its indentation settings, i.e. if indentation settings of the dump::DumperBase
object are changed, the tied Indenter
object will reflect the new settings.
Example of usage:
Note how the manual indentation is more complicate than the "implicit" one.
Definition at line 167 of file DumperBase.h.
using dump::DumperBase::Indenter< Stream >::indenter_t = Indenter<Stream> |
This type.
Definition at line 172 of file DumperBase.h.
|
inline |
Records the underlying stream and the dumper associated.
Definition at line 175 of file DumperBase.h.
|
inline |
Returns the indentation string for the first line.
Definition at line 183 of file DumperBase.h.
References dump::DumperBase::firstIndent().
|
inline |
Inserts an indentation and returns the indenter for further output.
Definition at line 194 of file DumperBase.h.
References dump::DumperBase::indented().
|
inline |
Returns the default indentation string.
Definition at line 180 of file DumperBase.h.
References dump::DumperBase::indent().
|
inline |
Breaks the current line and returns the indenter for further output.
Definition at line 201 of file DumperBase.h.
References dump::DumperBase::IndentSettings::indent.
|
inline |
Forwards data to the underlying stream.
Definition at line 187 of file DumperBase.h.
|
inline |
Inserts a first-line indentation and returns the indenter for further output.
Definition at line 209 of file DumperBase.h.
References dump::DumperBase::IndentSettings::indent.
|
private |
Definition at line 169 of file DumperBase.h.
|
private |
Definition at line 168 of file DumperBase.h.