diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-02-24 15:16:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-02-24 15:16:26 +0200 |
commit | 707cc94fe52463870a9c6c8e2e66eaaa389e601d (patch) | |
tree | 13e10ff28bf4455d915f9d59b401bdbb62a393cb /examples/cxx/hybrid/wildcard/body.hxx |
Start tracking XSD/e with git after version 3.0.03.0.0
Diffstat (limited to 'examples/cxx/hybrid/wildcard/body.hxx')
-rw-r--r-- | examples/cxx/hybrid/wildcard/body.hxx | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/wildcard/body.hxx b/examples/cxx/hybrid/wildcard/body.hxx new file mode 100644 index 0000000..512a107 --- /dev/null +++ b/examples/cxx/hybrid/wildcard/body.hxx @@ -0,0 +1,81 @@ +// file : examples/cxx/hybrid/wildcard/body.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#ifndef BODY_HXX +#define BODY_HXX + +#include "email.hxx" + +namespace email +{ + // Custom email body type which can hold text or binary. + // + class body + { + public: + enum type + { + type_none, + type_text, + type_binary + }; + + body () + : body_type_ (type_none), binary_ (0) + { + } + + ~body () + { + body_type (type_none); + } + + type + body_type () const + { + return body_type_; + } + + const std::string& + text () const + { + return text_; + } + + void + text (const std::string& t) + { + body_type (type_text); + text_ = t; + } + + const email::binary& + binary () const + { + return *binary_; + } + + void + binary (email::binary* b) + { + body_type (type_binary); + binary_ = b; + } + + private: + void + body_type (type t); + + type body_type_; + std::string text_; + email::binary* binary_; + }; + + // Custom data destructor for body. + // + void + destroy_body (void*, size_t); +} + +#endif // BODY_HXX |