#include <recoder.hpp>

Public Member Functions | |
| Recoder (const std::string &_request) throw (Error) | |
| Constructor. | |
| virtual | ~Recoder (void) |
| Destructor. | |
| virtual void | translate (std::istream &inputStream, std::ostream &outputStream) const throw (Error) |
Static Public Attributes | |
| static RECODE_OUTER | outer = NULL |
Protected Attributes | |
| RECODE_REQUEST | request |
Recoder::outer = recode_new_outer( false );
ERRORMACRO( Recoder::outer != NULL, Error, ,
"Failure initialising recoder library." );
if ( Recoder::outer != NULL ) {
recoder_delete_outer( Recoder::outer );
Recoder::outer = NULL;
};
Definition at line 51 of file recoder.hpp.
| Recoder::Recoder | ( | const std::string & | _request | ) | throw (Error) |
Constructor.
Definition at line 26 of file recoder.cpp.
References ERRORMACRO.
00026 : 00027 request(NULL) 00028 { 00029 assert( outer != NULL ); 00030 request = recode_new_request( outer ); 00031 ERRORMACRO( request, Error, , "Error allocating recoding request." ); 00032 #ifndef NDEBUG 00033 request->verbose_flag = true; 00034 #endif 00035 request->ascii_graphics = true; 00036 if ( !recode_scan_request( request, _request.c_str() ) ) { 00037 recode_delete_request( request ); 00038 ERRORMACRO( false, Error, , 00039 "Error requesting " << _request << " recoder." ); 00040 }; 00041 }
| Recoder::~Recoder | ( | void | ) | [virtual] |
Destructor.
Definition at line 43 of file recoder.cpp.
References request.
00044 { 00045 recode_delete_request (request); 00046 }
| void Recoder::translate | ( | std::istream & | inputStream, | |
| std::ostream & | outputStream | |||
| ) | const throw (Error) [virtual] |
Implements Compiler.
Definition at line 48 of file recoder.cpp.
References ERRORMACRO, and request.
00051 { 00052 streampos pos = inputStream.tellg(); 00053 inputStream.seekg( 0, ios::end ); 00054 int filesize = inputStream.tellg() - pos; 00055 inputStream.seekg( pos, ios::beg ); 00056 00057 shared_array< char > inputData( new char[filesize] ); 00058 inputStream.read( inputData.get(), filesize ); 00059 00060 char *outputData = NULL; 00061 size_t 00062 outputLength = 0, 00063 outputAllocated = 0; 00064 00065 bool retVal = 00066 recode_buffer_to_buffer( request, inputData.get(), filesize, 00067 &outputData, &outputLength, &outputAllocated ); 00068 00069 inputData.reset(); 00070 00071 ERRORMACRO( retVal, Error, , "Error while recoding stream." ); 00072 outputStream.write( outputData, outputLength ); 00073 00074 if ( outputData != NULL ) 00075 free( outputData ); 00076 }
RECODE_OUTER Recoder::outer = NULL [static] |
RECODE_REQUEST Recoder::request [protected] |