diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-16 08:16:43 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-16 08:16:43 +0200 |
commit | bce9d5a76072ec697ef69021818aa68709036da5 (patch) | |
tree | 9ec56eff60abacaea121d1602a1e48388ca34216 /examples/cxx/hybrid/custom/wildcard/envelope-simpl.hxx | |
parent | be19f3aae4e16b4dc9c980cb9b53e807616662ef (diff) |
Add support for type customization in C++/Hybrid
examples/cxx/hybrid/custom/wildcard/: new example
Diffstat (limited to 'examples/cxx/hybrid/custom/wildcard/envelope-simpl.hxx')
-rw-r--r-- | examples/cxx/hybrid/custom/wildcard/envelope-simpl.hxx | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/custom/wildcard/envelope-simpl.hxx b/examples/cxx/hybrid/custom/wildcard/envelope-simpl.hxx new file mode 100644 index 0000000..bb2f546 --- /dev/null +++ b/examples/cxx/hybrid/custom/wildcard/envelope-simpl.hxx @@ -0,0 +1,67 @@ +// file : examples/cxx/hybrid/custom/wildcard/envelope-simpl.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#ifndef ENVELOPE_SIMPL_HXX +#define ENVELOPE_SIMPL_HXX + +namespace email +{ + // Customized envelope serializer implementation. Here we implement + // the any_next, any, and serialize_any callbacks to serialize the + // wildcard content. + // + class envelope_simpl: public envelope_base_simpl + { + public: + envelope_simpl () + : text_s_ (0), binary_s_ (0) + { + } + + // Additional serializers for the wildcard content. + // + void + text_serializer (xml_schema::string_sskel& s) + { + text_s_ = &s; + } + + void + binary_serializer (binary_sskel& s) + { + binary_s_ = &s; + } + + public: + virtual void + _pre (); + + virtual bool + any_next (); + + virtual void + any (std::string& ns, std::string& name); + + virtual void + serialize_any (); + + // If we need to be able to reset and reuse the serializer + // after an error then we also need to override _reset() and + // reset the serializers that are used to handle wildcards. + // + virtual void + _reset (); + + private: + envelope::body_const_iterator i_; + + // Serializers for the text and binary elements. + // + private: + xml_schema::string_sskel* text_s_; + binary_sskel* binary_s_; + }; +} + +#endif // ENVELOPE_SIMPL_HXX |