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

# babel_serializer.h

Go to the documentation of this file.

    00001 /* -*- c++ -*- */
    00002 #ifndef AKAXISO2_XML_BABEL_BABEL_SERIALIZER_H__
    00003 #define AKAXISO2_XML_BABEL_BABEL_SERIALIZER_H__
    00004
    00005 #include <akaxiso2/configuration.h>
    00006
    00012 #ifdef AKAXISO2_USE_BABEL
    00013
    00014 #include <akaxiso2/exception.h>
    00015 #include <akaxiso2/XML/serializer/xml_serializer_base.h>
    00016 #include <akaxiso2/imported/tricklib/tricklib.h>
    00017
    00018 namespace aka2 {
    00019
    00021   class babel_formatter : public formatter_base {
    00022   public:
    00023     babel_formatter() {}
    00024     virtual ~babel_formatter() {}
    00025
    00026   private:
    00027     virtual void set_encoding(const std::string &encoding);
    00028     virtual ustring lcp_to_ucs2(const std::string &source);
    00029     virtual void write(const ustring &entity);
    00030
    00031     babel::bbl_translater<std::string, ustring> in_translator_;
    00032     babel::bbl_translater<ustring, std::string> out_translator_;
    00033   };
    00034
    00035
    00037   class babel_serializer : public xml_serializer_base {
    00038   public:
    00039     babel_serializer(const std::string &encoding = AKAXISO2_DEFAULT_ENCODING)
    00040     : xml_serializer_base(encoding) {
    00041       formatter_ = shared_ptr<formatter_base>(new babel_formatter());
    00042       formatter_->set_encoding(encoding);
    00043     }
    00044   };
    00045
    00046
    00047
    00048 } // namespace aka2
    00049
    00050 #endif
    00051
    00052 #endif