hgl 0.5.42~jessie
A compiler/interpreter suite for developing images (plugin development)
Public Member Functions | List of all members
HGL::ImageOutput::Writer Class Reference

A simple exception safe writer for image output plugins. More...

#include "writer.h"

Public Member Functions

 Writer (const std::string &filename, const char *const suffix=0L) throw (ImageOutputException)
 Constructs an Writer and initializes it for use. More...
 
 ~Writer ()
 Closes the file. More...
 
void endWrite ()
 Indicates a successful end of write of the file. More...
 
void endWrite (bool noClose)
 Indicates a successful end of write of the file. More...
 
FILE * getFile () const
 Gets a pointer to the FILE structure of the file. More...
 
int getHandle () const
 Gets the file handle of the file. More...
 
 operator FILE * () const
 Gets a pointer to the FILE structure of the file. More...
 
Writeroperator<< (const std::string &s) throw (ImageOutputException)
 Writes a string into the file. More...
 
Writeroperator<< (float f) throw (ImageOutputException)
 Writes a float into the file. More...
 

Detailed Description

A simple exception safe writer for image output plugins.

Author
Heiko Schäfer heiko.nosp@m.@hgl.nosp@m..rang.nosp@m.un.d.nosp@m.e
Since
0.4.52
Examples:
exampleoutput.cpp.

Constructor & Destructor Documentation

HGL::ImageOutput::Writer::Writer ( const std::string &  filename,
const char *const  suffix = 0L 
)
throw (ImageOutputException
)

Constructs an Writer and initializes it for use.

This writer opens the file or throws an ImageOutputException if it failed.

Exceptions
ImageOutputExceptionif the file could not get created
Parameters
filenamethe filename or an empty string for output to stdout
suffixappends suffix if not NULL and not given
Since
0.4.52
HGL::ImageOutput::Writer::~Writer ( )

Closes the file.

If no call to Writer::endWrite was done, it will remove the file.

Since
0.4.52

Member Function Documentation

void HGL::ImageOutput::Writer::endWrite ( )

Indicates a successful end of write of the file.

If no call to this function is done before Writer gets destroyed it will delete the file.

Since
0.4.52
void HGL::ImageOutput::Writer::endWrite ( bool  noClose)

Indicates a successful end of write of the file.

If no call to this function is done before Writer gets destroyed it will delete the file.

Parameters
noClosetrue if the file needs not to get closed, false otherwise
Since
0.5.17
FILE* HGL::ImageOutput::Writer::getFile ( ) const

Gets a pointer to the FILE structure of the file.

Returns
a pointer to the FILE structure of the file
Since
0.4.52
int HGL::ImageOutput::Writer::getHandle ( ) const

Gets the file handle of the file.

Returns
int the file handle
Since
0.4.52
HGL::ImageOutput::Writer::operator FILE * ( ) const

Gets a pointer to the FILE structure of the file.

Returns
a pointer to the FILE structure of the file
Since
0.5.4
Writer& HGL::ImageOutput::Writer::operator<< ( const std::string &  s)
throw (ImageOutputException
)

Writes a string into the file.

Parameters
sthe string to write
Returns
reference to the Writer to concatenate this operator
Since
0.4.70
Writer& HGL::ImageOutput::Writer::operator<< ( float  f)
throw (ImageOutputException
)

Writes a float into the file.

Parameters
fthe float to write
Returns
reference to the Writer to concatenate this operator
Since
0.5.2