faudes::TokenWriter Class Reference
#include <tokenwriter.h>
List of all members.
Detailed Description
A
TokenWriter writes sequential tokens to a file, a string or stdout.
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.
Member Enumeration Documentation
Mode of operation: write to from file, string or stdout.
- Enumerator:
-
Constructor & Destructor Documentation
faudes::TokenWriter::TokenWriter |
( |
Mode |
mode |
) |
|
Console or String TokenWriter constructor.
Technical detail: the console tokenwriter holds a ref. to std::cout; it will behave strange and perhaps cause segfaults if it is instantiated befor std::cout is up; you can avoid this issue by instantiating you console tokenwriter using the new operator.
- Exceptions:
-
faudes::TokenWriter::TokenWriter |
( |
const std::string & |
rFilename, |
|
|
std::ios::openmode |
openmode = std::ios::out|std::ios::trunc | |
|
) |
| | |
File TokenWriter constructor.
- Parameters:
-
| rFilename | File to write |
| openmode | std::ios::openmode |
- Exceptions:
-
faudes::TokenWriter::~TokenWriter |
( |
void |
|
) |
|
Member Function Documentation
std::string faudes::TokenWriter::FileName |
( |
void |
|
) |
const |
Get the filename.
Return dummy values for console or string mode.
- Returns:
- Filename
Mode faudes::TokenWriter::DestMode |
( |
void |
|
) |
const [inline] |
Get file mode.
- Returns:
- Mode
std::string faudes::TokenWriter::Str |
( |
void |
|
) |
|
Retrieve output as string (if in String mode).
- Exceptions:
-
int faudes::TokenWriter::Columns |
( |
void |
|
) |
const |
Get number of columns in a line.
- Returns:
- # of columns in a line
void faudes::TokenWriter::Columns |
( |
int |
columns |
) |
|
Set number of columns in a line.
- Parameters:
-
| columns | # of columns in a line |
void faudes::TokenWriter::Endl |
( |
void |
|
) |
|
Write endl separator (obmitted in String mode).
- Exceptions:
-
void faudes::TokenWriter::Write |
( |
Token & |
rToken |
) |
|
Write next token.
- Parameters:
-
- Exceptions:
-
void faudes::TokenWriter::WriteString |
( |
const std::string & |
rString |
) |
|
Write string (may not contain any quotes.
- Parameters:
-
- Exceptions:
-
void faudes::TokenWriter::WriteInteger |
( |
Idx |
index |
) |
|
Write non negative integer.
- Parameters:
-
- Exceptions:
-
void faudes::TokenWriter::WriteFloat |
( |
const double & |
val |
) |
|
Write float.
- Parameters:
-
- Exceptions:
-
void faudes::TokenWriter::WriteInteger16 |
( |
long int |
val |
) |
|
Write integer as hex.
- Parameters:
-
- Exceptions:
-
void faudes::TokenWriter::WriteOption |
( |
const std::string & |
rOpt |
) |
|
Write option (may not contain any "+").
- Parameters:
-
- Exceptions:
-
void faudes::TokenWriter::WriteBegin |
( |
const std::string & |
rLabel |
) |
|
Write begin label.
- Parameters:
-
| rLabel | End label, e.g. "Alphabet" |
- Exceptions:
-
void faudes::TokenWriter::WriteEnd |
( |
const std::string & |
rLabel |
) |
|
Write end label.
- Parameters:
-
| rLabel | End label, e.g. "Alphabet" |
- Exceptions:
-
void faudes::TokenWriter::WriteComment |
( |
const std::string & |
rComment |
) |
|
Write comment.
- Parameters:
-
| rComment | Comment to write |
- Exceptions:
-
void faudes::TokenWriter::WriteBinary |
( |
const char * |
pData, |
|
|
long int |
len | |
|
) |
| | |
Write comment.
- Parameters:
-
| len | Number of bytes to write |
| pData | Data to write |
- Exceptions:
-
Operator for writing tokens.
- Parameters:
-
- Returns:
- Reference to this TokenWriter
- Exceptions:
-
TokenWriter& faudes::TokenWriter::operator<< |
( |
const std::string & |
rString |
) |
[inline] |
Operator for writing std::strings to a stream.
- Parameters:
-
- Returns:
- Reference to this TokenWriter
- Exceptions:
-
TokenWriter& faudes::TokenWriter::operator<< |
( |
const Idx |
index |
) |
[inline] |
Operator for writing Idxs to a stream.
- Parameters:
-
- Returns:
- Reference to this TokenWriter
- Exceptions:
-
Member Data Documentation
actual stream object, file output
actual stream object, string output
The documentation for this class was generated from the following files: