#include <tokenwriter.h>
It is the counterpart of the TokenReader. Since wrtiting data comparatively straight foreward, there is no explicit support of sections etc. It is left to the calling function to organise the output.
Definition at line 38 of file tokenwriter.h.
Public Types | |
enum | Mode { File, Stdout, String } |
Mode of operation: write to from file, string or stdout. More... | |
Public Member Functions | |
TokenWriter (Mode mode) | |
Console or String TokenWriter constructor. | |
TokenWriter (const std::string &rFilename, std::ios::openmode openmode=std::ios::out|std::ios::trunc) | |
File TokenWriter constructor. | |
~TokenWriter (void) | |
Destructor. | |
std::string | Str (void) |
Retrieve output as string (if in String mode). | |
int | Columns (void) const |
Get number of columns in a line. | |
void | Columns (int columns) |
Set number of columns in a line. | |
void | Endl (void) |
Write endl separator (obmitted in String mode). | |
void | Write (Token &rToken) |
Write next token. | |
void | Write (const std::string &rString) |
Write name. | |
void | Write (Idx index) |
Write index. | |
void | WriteFloat (const double &val) |
Write float. | |
void | WriteOption (const std::string &rOpt) |
Write option. | |
void | WriteBegin (const std::string &rLabel) |
Write begin label. | |
void | WriteEnd (const std::string &rLabel) |
Write end label. | |
void | Comment (const std::string &rComment) |
Write comment. | |
void | operator<< (Token &rToken) |
Operator for writing tokens. | |
void | operator<< (const std::string &rString) |
Operator for writing std::strings to a stream. | |
void | operator<< (const Idx index) |
Operator for writing Idxs to a stream. | |
Private Attributes | |
Mode | mMode |
output mode | |
std::ostream * | mpStream |
ostream object pointer | |
std::ofstream | mFStream |
actual stream object, file output | |
std::ostringstream | mSStream |
actual stream object, string output | |
std::string | mFileName |
Filename. | |
int | mColumns |
Number of columns. | |
int | mColCount |
Column counter. |
|
Mode of operation: write to from file, string or stdout.
Definition at line 45 of file tokenwriter.h. |
|
Console or String TokenWriter constructor.
Definition at line 47 of file tokenwriter.cpp. |
|
File TokenWriter constructor.
Definition at line 29 of file tokenwriter.cpp. |
|
Destructor. Calls close Definition at line 81 of file tokenwriter.cpp. |
|
Set number of columns in a line.
Definition at line 101 of file tokenwriter.cpp. |
|
Get number of columns in a line.
Definition at line 96 of file tokenwriter.cpp. |
|
Write comment.
Definition at line 196 of file tokenwriter.cpp. |
|
Write endl separator (obmitted in String mode).
Definition at line 106 of file tokenwriter.cpp. |
|
Operator for writing Idxs to a stream.
Definition at line 215 of file tokenwriter.h. |
|
Operator for writing std::strings to a stream.
Definition at line 203 of file tokenwriter.h. |
|
Operator for writing tokens.
Definition at line 191 of file tokenwriter.h. |
|
Retrieve output as string (if in String mode).
Definition at line 86 of file tokenwriter.cpp. |
|
Write index.
Definition at line 159 of file tokenwriter.cpp. |
|
Write name.
Definition at line 146 of file tokenwriter.cpp. |
|
Write next token.
Definition at line 119 of file tokenwriter.cpp. |
|
Write begin label.
Definition at line 182 of file tokenwriter.cpp. |
|
Write end label.
Definition at line 189 of file tokenwriter.cpp. |
|
Write float.
Definition at line 166 of file tokenwriter.cpp. |
|
Write option.
Definition at line 174 of file tokenwriter.cpp. |
|
Column counter.
Definition at line 240 of file tokenwriter.h. |
|
Number of columns.
Definition at line 237 of file tokenwriter.h. |
|
Filename.
Definition at line 234 of file tokenwriter.h. |
|
actual stream object, file output
Definition at line 228 of file tokenwriter.h. |
|
output mode
Definition at line 222 of file tokenwriter.h. |
|
ostream object pointer
Definition at line 225 of file tokenwriter.h. |
|
actual stream object, string output
Definition at line 231 of file tokenwriter.h. |