LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
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 37 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.
References dump::DumperBase::IndentSettings::indent.
|
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 98 of file DumperBase.h.
References dump::DumperBase::IndentSettings::firstIndent, and indentSettings().
Referenced by dump::DumperBase::Indenter< Stream >::firstIndentString().
|
inline |
Writes first line indentation into a stream, and returns it for further output.
Definition at line 120 of file DumperBase.h.
References indented().
|
inline |
Returns the indentation string currently configured for all lines.
Definition at line 95 of file DumperBase.h.
References dump::DumperBase::IndentSettings::indent, and indentSettings().
Referenced by dump::raw::OpDetWaveformDumper::dump(), and dump::DumperBase::Indenter< Stream >::indentString().
|
inline |
Writes the indentation into a stream, and returns it for further output.
Definition at line 111 of file DumperBase.h.
References dump::DumperBase::IndentSettings::firstIndent, and dump::DumperBase::IndentSettings::indent.
Referenced by firstIndented(), dump::DumperBase::Indenter< Stream >::indent(), and newline().
|
inline |
Returns an Indenter
object tied to this dumper and out
stream.
Definition at line 215 of file DumperBase.h.
Referenced by dump::raw::OpDetWaveformDumper::dump().
|
inlineprotected |
Definition at line 221 of file DumperBase.h.
Referenced by firstIndent(), indent(), restoreIndentSettings(), saveIndentSettings(), and setIndent().
|
inlineprotected |
Definition at line 222 of file DumperBase.h.
|
inline |
Initiates a new output line, including indentation, and returns the stream for further output.
Definition at line 128 of file DumperBase.h.
References indented().
|
inlineprotected |
Restores and returns the last saved settings.
Definition at line 233 of file DumperBase.h.
References indentSettings().
Referenced by dump::raw::OpDetWaveformDumper::dump().
|
inlineprotected |
Stacks a copy of the current settings, and returns the "new" ones.
Definition at line 225 of file DumperBase.h.
References indentSettings().
Referenced by dump::raw::OpDetWaveformDumper::dump().
|
inline |
Sets indentation strings to the specified values.
Definition at line 101 of file DumperBase.h.
References dump::DumperBase::IndentSettings::indent, and indentSettings().
|
inline |
Sets both indentation strings to the same specified value.
Definition at line 107 of file DumperBase.h.
References setIndent().
Referenced by setIndent().
|
private |
All indentation settings.
Definition at line 57 of file DumperBase.h.