Starts a new line in a output stream. More...
#include <NewLine.h>
Public Member Functions | |
NewLine (Stream &stream, IndentOptions_t indentOptions) | |
Constructor: associates with the stream. More... | |
NewLine (Stream &stream, std::string indent="", bool followLine=false) | |
Constructor: associates with the stream. More... | |
Stream & | newLine () |
Starts a new line. More... | |
Stream & | operator() () |
Calls and returns newLine(). Candy. More... | |
void | forceNewLine () |
Starts a new line (no matter what) More... | |
bool | append () const |
Returns whether newLine() will append text on the current line. More... | |
void | setIndent (std::string newIndent) |
Replaces the indentation string. More... | |
void | addIndent (std::string moreIndent) |
Adds to the end to the indentation string. More... | |
Accessors | |
unsigned int | lines () const |
Returns the number of inserted lines. More... | |
std::string | indent () const |
Returns the current indentation string. More... | |
Protected Attributes | |
Stream & | out |
reference to the output stream More... | |
IndentOptions_t | options |
all indentation options More... | |
unsigned int | nLines |
number of lines in output More... | |
Starts a new line in a output stream.
Stream | type of output stream |
Example of usage:
that (after flush) will result in the output
Preamble on its own line. > An indented line. > Another indented line.
Asking to consider the first line already started, instead:
will instead result in the output
Preamble on its own line. > An indented line. > Another indented line.
(note that the line that we consider started was actually an empty one).
|
inline |
Constructor: associates with the stream.
stream | a reference to the stream where to insert new lines |
indentOptions | all indentation options (will be copied) |
The constructor does not start a new line. If followLine is true, the first line is supposed to be already started and no indentation nor new line will be set on it.
Definition at line 86 of file NewLine.h.
|
inline |
Constructor: associates with the stream.
stream | a reference to the stream where to insert new lines |
indent | string used for indentation (default: none) |
followLine | whether first line is already started (default: no) |
The constructor does not start a new line. If followLine is true, the first line is supposed to be already started and no indentation nor new line will be set on it.
Definition at line 100 of file NewLine.h.
|
inline |
Adds to the end to the indentation string.
Definition at line 132 of file NewLine.h.
|
inline |
Returns whether newLine() will append text on the current line.
Definition at line 125 of file NewLine.h.
|
inline |
Starts a new line (no matter what)
Definition at line 122 of file NewLine.h.
|
inline |
Returns the current indentation string.
Definition at line 111 of file NewLine.h.
|
inline |
Returns the number of inserted lines.
Definition at line 108 of file NewLine.h.
|
inline |
Starts a new line.
Definition at line 116 of file NewLine.h.
|
inline |
|
inline |
Replaces the indentation string.
Definition at line 129 of file NewLine.h.
|
protected |
|
protected |
|
protected |