diff options
author | Jörg Frings-Fürst <jff@merkur> | 2014-05-18 16:08:14 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <jff@merkur> | 2014-05-18 16:08:14 +0200 |
commit | a15cf65c44d5c224169c32ef5495b68c758134b7 (patch) | |
tree | 3419f58fc8e1b315ba8171910ee044c5d467c162 /xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx |
Imported Upstream version 3.3.0.2upstream/3.3.0.2
Diffstat (limited to 'xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx')
-rw-r--r-- | xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx | 273 |
1 files changed, 273 insertions, 0 deletions
diff --git a/xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx b/xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx new file mode 100644 index 0000000..c345e80 --- /dev/null +++ b/xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx @@ -0,0 +1,273 @@ +// file : xsd/cxx/tree/stream-insertion.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_TREE_STREAM_INSERTION_HXX +#define XSD_CXX_TREE_STREAM_INSERTION_HXX + +#include <xsd/cxx/tree/elements.hxx> +#include <xsd/cxx/tree/types.hxx> +#include <xsd/cxx/tree/list.hxx> + +#include <xsd/cxx/tree/ostream.hxx> + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // type + // + template <typename S> + inline ostream<S>& + operator<< (ostream<S>& s, const type&) + { + return s; + } + + // simple_type + // + template <typename S, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const simple_type<B>&) + { + return s; + } + + // fundamental_base + // + template <typename S, + typename T, + typename C, + typename B, + schema_type::value ST> + inline ostream<S>& + operator<< (ostream<S>& s, const fundamental_base<T, C, B, ST>& x) + { + const T& r (x); + return s << r; + } + + // list + // + template <typename S, + typename T, + typename C, + schema_type::value ST, + bool fund> + ostream<S>& + operator<< (ostream<S>& s, const list<T, C, ST, fund>& x) + { + s << ostream_common::as_size<std::size_t> (x.size ()); + + for (typename list<T, C, ST, fund>::const_iterator + i (x.begin ()), e (x.end ()); i != e; ++i) + { + s << *i; + } + + return s; + } + + + // Insertion operators for built-in types. + // + + + // string + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const string<C, B>& x) + { + const std::basic_string<C>& r (x); + return s << r; + } + + + // normalized_string + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const normalized_string<C, B>& x) + { + const B& r (x); + return s << r; + } + + + // token + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const token<C, B>& x) + { + const B& r (x); + return s << r; + } + + + // nmtoken + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const nmtoken<C, B>& x) + { + const B& r (x); + return s << r; + } + + + // nmtokens + // + template <typename S, typename C, typename B, typename nmtoken> + inline ostream<S>& + operator<< (ostream<S>& s, const nmtokens<C, B, nmtoken>& x) + { + const list<nmtoken, C>& r (x); + return s << r; + } + + + // name + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const name<C, B>& x) + { + const B& r (x); + return s << r; + } + + + // ncname + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const ncname<C, B>& x) + { + const B& r (x); + return s << r; + } + + + // language + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const language<C, B>& x) + { + const std::basic_string<C>& r (x); + return s << r; + } + + + // id + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const id<C, B>& x) + { + const std::basic_string<C>& r (x); + return s << r; + } + + + // idref + // + template <typename S, typename C, typename B, typename T> + inline ostream<S>& + operator<< (ostream<S>& s, const idref<C, B, T>& x) + { + const B& r (x); + return s << r; + } + + + // idrefs + // + template <typename S, typename C, typename B, typename idref> + inline ostream<S>& + operator<< (ostream<S>& s, const idrefs<C, B, idref>& x) + { + const list<idref, C>& r (x); + return s << r; + } + + + // uri + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const uri<C, B>& x) + { + const std::basic_string<C>& r (x); + return s << r; + } + + + // qname + // + template <typename S, + typename C, + typename B, + typename uri, + typename ncname> + inline ostream<S>& + operator<< (ostream<S>& s, const qname<C, B, uri, ncname>& x) + { + return s << x.namespace_ () << x.name (); + } + + + // base64_binary + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const base64_binary<C, B>& x) + { + const buffer<C>& r (x); + return s << r; + } + + + // hex_binary + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const hex_binary<C, B>& x) + { + const buffer<C>& r (x); + return s << r; + } + + + // entity + // + template <typename S, typename C, typename B> + inline ostream<S>& + operator<< (ostream<S>& s, const entity<C, B>& x) + { + const B& r (x); + return s << r; + } + + + // entities + // + template <typename S, typename C, typename B, typename entity> + inline ostream<S>& + operator<< (ostream<S>& s, const entities<C, B, entity>& x) + { + const list<entity, C>& r (x); + return s << r; + } + } + } +} + +#include <xsd/cxx/tree/date-time-insertion.txx> + +#endif // XSD_CXX_TREE_STREAM_INSERTION_HXX |