Source-highlight Library
|
The main class for writing into the output. More...
#include <bufferedoutput.h>
Public Member Functions | |
BufferedOutput (std::ostream &os) | |
void | setAlwaysFlush (bool a=true) |
Whether to flush the output stream at each output operation. More... | |
void | output (const std::string &s) |
Writes the passed string into the output. More... | |
void | postLineInsert (const std::string &s) |
Writes the passed string into the contents to be output after the current line. More... | |
void | postDocInsert (const std::string &s) |
Writes the passed string into the contents to be output after the entire document. More... | |
template<typename T > | |
void | postLineInsertFrom (const T &s) |
Writes the elements of the passed generic collection into the contents to be output after the current line. More... | |
template<typename T > | |
void | postDocInsertFrom (const T &s) |
Writes the elements of the passed generic collection into the contents to be output after the entire document. More... | |
void | writePostLine (const std::string &prefix="") |
Writes all the (buffered) elements after the current line (and clear the buffer) More... | |
void | writePostDoc (const std::string &prefix="") |
Writes all the (buffered) elements after the current document (and clear the buffer) More... | |
Private Member Functions | |
void | writePostInfo (PostContents &post, const std::string &prefix="") |
Writes all the (buffered) elements (and clear the buffer) More... | |
Private Attributes | |
std::ostream & | outputBuff |
the stream used to output strings | |
bool | alwaysFlush |
whether to flush the output stream at each output operation | |
PostContents | postLineContents |
the contents to be output after each line | |
PostContents | postDocContents |
the contents to be output after the entire document | |
The main class for writing into the output.
It wraps an ostream object and can perform buffering. Moreover, it provides functionalities to write something after a line or after an entire document (these contents are buffered so that they can be inserted at any time, with postLineInsert and postDocInsert and will be actually inserted in the output with writePostLine and writePostDoc).
srchilite::BufferedOutput::BufferedOutput | ( | std::ostream & | os | ) |
os | the ostream where data will be written |
void srchilite::BufferedOutput::output | ( | const std::string & | s | ) |
Writes the passed string into the output.
s |
void srchilite::BufferedOutput::postDocInsert | ( | const std::string & | s | ) |
Writes the passed string into the contents to be output after the entire document.
s |
|
inline |
Writes the elements of the passed generic collection into the contents to be output after the entire document.
s |
void srchilite::BufferedOutput::postLineInsert | ( | const std::string & | s | ) |
Writes the passed string into the contents to be output after the current line.
s |
|
inline |
Writes the elements of the passed generic collection into the contents to be output after the current line.
s |
|
inline |
Whether to flush the output stream at each output operation.
a |
void srchilite::BufferedOutput::writePostDoc | ( | const std::string & | prefix = "" | ) |
Writes all the (buffered) elements after the current document (and clear the buffer)
prefix | the string to prefix all the elements |
|
private |
Writes all the (buffered) elements (and clear the buffer)
post | the buffered elements |
prefix | the string to prefix all the elements |
void srchilite::BufferedOutput::writePostLine | ( | const std::string & | prefix = "" | ) |
Writes all the (buffered) elements after the current line (and clear the buffer)
prefix | the string to prefix all the elements |