An output stream. More...
#include <stream.h>
Public Member Functions | |
void | close () |
Close the output stream, waiting on the pager process if necessary. | |
void | flush () |
Flushing function. | |
void | initialize (const optional< path > &output_file=none, const optional< path > &pager_path=none) |
Initialize the output stream object. | |
operator std::ostream & () | |
Converter to a standard ostream. | |
output_stream_t () | |
Construct a new output_stream_t. | |
output_stream_t (const output_stream_t &) | |
When copy-constructed, make the copy just be a new output stream. | |
~output_stream_t () | |
Destroys an output_stream_t. | |
Public Attributes | |
std::ostream * | os |
A pointer to the ostream. | |
An output stream.
A stream to output in Ledger may be going to one of three places: to stdout, to a file, or to a pager. Construct an output_stream_t and the stream will automatically be cleaned up upon destruction.
This class suffers from "else-if-heimer's disease," see Marshall Cline's "C++ FAQ Lite". Arguably this should be three different classes, but that introduces additional unneeded complications.
|
inline |
|
inline |
When copy-constructed, make the copy just be a new output stream.
This allows large classes to rely on their default copy-constructor without worrying about pointer copying within output_stream_t.
Definition at line 91 of file stream.h.
References TRACE_CTOR.
|
inline |
Destroys an output_stream_t.
This deletes the dynamically allocated ostream, if necessary. It also closes output file descriptor, if necessary.
Definition at line 101 of file stream.h.
References close(), and TRACE_DTOR.
void ledger::output_stream_t::close | ( | ) |
Close the output stream, waiting on the pager process if necessary.
Referenced by ledger::report_t::quick_close(), ~output_stream_t(), and ledger::report_t::~report_t().
|
inline |
void ledger::output_stream_t::initialize | ( | const optional< path > & | output_file = none, |
const optional< path > & | pager_path = none ) |
Initialize the output stream object.
output_file | File to which to send output. If both this and pager are set, output_file takes priority. |
pager_path | Path to a pager. To not use a pager, leave this empty. |
|
inline |
Converter to a standard ostream.
This is used so that we can stream directly to an object of type output_stream_t.
Definition at line 122 of file stream.h.
References os.
std::ostream* ledger::output_stream_t::os |
A pointer to the ostream.
Don't delete this; the output_stream_t class takes care of this.
Definition at line 77 of file stream.h.
Referenced by flush(), and operator std::ostream &().