Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages

# xerces_serializer.h

Go to the documentation of this file.

    00001 /* -*- c++ -*- */
    00002 #ifndef AKAXISO2_XML_XERCES_XERCES_SERIALIZER_H__
    00003 #define AKAXISO2_XML_XERCES_XERCES_SERIALIZER_H__
    00004
    00010 #include <akaxiso2/configuration.h>
    00011
    00012 #ifdef AKAXISO2_USE_XERCESC
    00013
    00014 #include <memory.h> /* {BCB6} */
    00015 #include <akaxiso2/util/scoped_ptr.h>
    00016 #include <akaxiso2/XML/serializer/formatter_base.h>
    00017 #include <akaxiso2/XML/serializer/xml_serializer_base.h>
    00018 #include <xercesc/util/TransService.hpp>
    00019
    00020 namespace aka2 {
    00021
    00023   class xerces_formatter : public formatter_base {
    00024   public:
    00025     xerces_formatter()
    00026       : in_transcoder_(0), out_transcoder_(0) {};
    00027     virtual ~xerces_formatter() {}
    00028
    00029   private:
    00030     virtual void set_encoding(const std::string &encoding);
    00031     virtual ustring lcp_to_ucs2(const std::string &source);
    00032     virtual void write(const ustring &entity);
    00033     void set_bom(const std::string &encoding);
    00034
    00035     scoped_ptr<xercesc::XMLLCPTranscoder> in_transcoder_;
    00036     scoped_ptr<xercesc::XMLTranscoder> out_transcoder_;
    00037   };
    00038
    00040   class xerces_serializer : public xml_serializer_base {
    00041   public:
    00042     xerces_serializer(const std::string &encoding = AKAXISO2_DEFAULT_ENCODING)
    00043     : xml_serializer_base(encoding) {
    00044       formatter_ = shared_ptr<formatter_base>(new xerces_formatter());
    00045       formatter_->set_encoding(encoding);
    00046     }
    00047   };
    00048
    00049 } // namespace aka2
    00050
    00051 #endif // AKAXISO2_USE_XERCESC
    00052
    00053
    00054 #endif