8 #ifndef LARDATA_RECOBASE_DUMPERS_NEWLINE_H 9 #define LARDATA_RECOBASE_DUMPERS_NEWLINE_H 1 25 : indent(ind), appendFirst(followLine)
29 { indent += more; appendFirst =
false;
return *
this; }
32 indent.erase(
std::max(indent.length() - less.length(), size_t(0)));
73 template <
typename Stream>
108 unsigned int lines()
const {
return nLines; }
116 Stream&
newLine() {
if (!append()) forceNewLine(); ++nLines;
return out; }
144 template <
typename Stream>
150 template <
typename Stream>
160 #endif // LARDATA_RECOBASE_DUMPERS_NEWLINE_H unsigned int nLines
number of lines in output
unsigned int lines() const
Returns the number of inserted lines.
Starts a new line in a output stream.
void addIndent(std::string moreIndent)
Adds to the end to the indentation string.
IndentOptions_t(std::string ind="", bool followLine=false)
std::string indent() const
Returns the current indentation string.
Reconstruction base classes.
std::string indent
indentation string
IndentOptions_t & appendIndentation(std::string more)
void setIndent(std::string newIndent)
Replaces the indentation string.
NewLine(Stream &stream, std::string indent="", bool followLine=false)
Constructor: associates with the stream.
IndentOptions_t & removeIndentation(std::string less)
Stream & out
reference to the output stream
bool appendFirst
skip indentation on the first line
NewLine(Stream &stream, IndentOptions_t indentOptions)
Constructor: associates with the stream.
Structure collecting indentation options.
static int max(int a, int b)
void forceNewLine()
Starts a new line (no matter what)
Stream & newLine()
Starts a new line.
bool append() const
Returns whether newLine() will append text on the current line.
NewLine< Stream > makeNewLine(Stream &stream, std::string indent, bool followLine=false)
Convenience function to create a temporary NewLine.
IndentOptions_t options
all indentation options