GME  13
Transcoder.h
Go to the documentation of this file.
00001 #ifndef XML_TRANS_H
00002 #define XML_TRANS_H
00003 
00004 #include <fstream> // fstream.h
00005 #include    <xercesc/sax/HandlerBase.hpp>
00006 #include    <xercesc/framework/XMLFormatter.hpp>
00007 
00008 XERCES_CPP_NAMESPACE_USE
00009 
00010 class Transcoder : private XMLFormatTarget, private std::ofstream
00011 {
00012 public:
00013     // -----------------------------------------------------------------------
00014     //  Constructors
00015     // -----------------------------------------------------------------------
00016     Transcoder();
00017     ~Transcoder();
00018 
00019         void init( const char *, const char * const);
00020         void finalize();
00021         enum Modes
00022         {
00023                 NoEscape, // normal transcoding 
00024                 StdEscape // additionally escaping special characters like &<>'"
00025         };
00026 
00027     // -----------------------------------------------------------------------
00028     //  Implementations of the format target interface
00029     // -----------------------------------------------------------------------
00030     void writeChars(const   XMLByte* const  toWrite, const XMLSize_t count, XMLFormatter* const   formatter);
00031 
00032         
00033         Transcoder& operator << ( Modes mode);
00034         Transcoder& operator << ( metaid_type toWrite);
00035         Transcoder& operator << ( const XMLCh* const toWrite);
00036         Transcoder& operator << ( const char * const toWrite);
00037         Transcoder& operator << ( const char toWrite);
00038         Transcoder& operator << ( const std::string& toWrite);
00039 
00040         bool isOpen();
00041 
00042 private :
00043     XMLFormatter* m_pFormatter;
00044 };
00045 
00046 
00047 #endif // XML_TRANS_H