In the LGF file extra sections can be placed, which contain any data in arbitrary format. Such sections can be written with this class. A writing rule can be added to the class with two different functions. With the sectionLines()
function a generator can write the section line-by-line, while with the sectionStream()
member the section can be written to an output stream.
#include <lemon/lgf_writer.h>
Public Member Functions | |
SectionWriter (std::ostream &os) | |
Constructor. | |
SectionWriter (const std::string &fn) | |
Constructor. | |
SectionWriter (const char *fn) | |
Constructor. | |
~SectionWriter () | |
Destructor. | |
Section Writers | |
template<typename Functor > | |
SectionWriter & | sectionLines (const std::string &type, Functor functor) |
Add a section writer with line oriented writing. | |
template<typename Functor > | |
SectionWriter & | sectionStream (const std::string &type, Functor functor) |
Add a section writer with stream oriented writing. | |
Execution of the Writer | |
void | run () |
Start the batch processing. | |
std::ostream & | ostream () |
Give back the stream of the writer. | |
Related Functions | |
(Note that these are not member functions.) | |
SectionWriter | sectionWriter (std::ostream &os) |
Return a SectionWriter class. | |
SectionWriter | sectionWriter (const std::string &fn) |
Return a SectionWriter class. | |
SectionWriter | sectionWriter (const char *fn) |
Return a SectionWriter class. | |
|
inline |
Construct a section writer, which writes to the given output stream.
|
inline |
Construct a section writer, which writes into the given file.
|
inline |
Construct a section writer, which writes into the given file.
|
inline |
The first parameter is the type descriptor of the section, the second is a generator with std::string values. At the writing process, the returned std::string
will be written into the output file until it is an empty string.
For example, an integer vector is written into a section.
The generator is implemented as a struct.
|
inline |
The first parameter is the type of the section, the second is a functor, which takes a std::ostream&
parameter. The functor writes the section to the output stream.
|
inline |
This function starts the batch processing.
|
inline |
Returns the stream of the writer
|
related |
This function just returns a SectionWriter class.
|
related |
This function just returns a SectionWriter class.