From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/tree/stream-insertion.hxx | 273 +++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 libxsd/xsd/cxx/tree/stream-insertion.hxx (limited to 'libxsd/xsd/cxx/tree/stream-insertion.hxx') diff --git a/libxsd/xsd/cxx/tree/stream-insertion.hxx b/libxsd/xsd/cxx/tree/stream-insertion.hxx new file mode 100644 index 0000000..5b65bd6 --- /dev/null +++ b/libxsd/xsd/cxx/tree/stream-insertion.hxx @@ -0,0 +1,273 @@ +// file : xsd/cxx/tree/stream-insertion.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 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 +#include +#include + +#include + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // type + // + template + inline ostream& + operator<< (ostream& s, const type&) + { + return s; + } + + // simple_type + // + template + inline ostream& + operator<< (ostream& s, const simple_type&) + { + return s; + } + + // fundamental_base + // + template + inline ostream& + operator<< (ostream& s, const fundamental_base& x) + { + const T& r (x); + return s << r; + } + + // list + // + template + ostream& + operator<< (ostream& s, const list& x) + { + s << ostream_common::as_size (x.size ()); + + for (typename list::const_iterator + i (x.begin ()), e (x.end ()); i != e; ++i) + { + s << *i; + } + + return s; + } + + + // Insertion operators for built-in types. + // + + + // string + // + template + inline ostream& + operator<< (ostream& s, const string& x) + { + const std::basic_string& r (x); + return s << r; + } + + + // normalized_string + // + template + inline ostream& + operator<< (ostream& s, const normalized_string& x) + { + const B& r (x); + return s << r; + } + + + // token + // + template + inline ostream& + operator<< (ostream& s, const token& x) + { + const B& r (x); + return s << r; + } + + + // nmtoken + // + template + inline ostream& + operator<< (ostream& s, const nmtoken& x) + { + const B& r (x); + return s << r; + } + + + // nmtokens + // + template + inline ostream& + operator<< (ostream& s, const nmtokens& x) + { + const list& r (x); + return s << r; + } + + + // name + // + template + inline ostream& + operator<< (ostream& s, const name& x) + { + const B& r (x); + return s << r; + } + + + // ncname + // + template + inline ostream& + operator<< (ostream& s, const ncname& x) + { + const B& r (x); + return s << r; + } + + + // language + // + template + inline ostream& + operator<< (ostream& s, const language& x) + { + const std::basic_string& r (x); + return s << r; + } + + + // id + // + template + inline ostream& + operator<< (ostream& s, const id& x) + { + const std::basic_string& r (x); + return s << r; + } + + + // idref + // + template + inline ostream& + operator<< (ostream& s, const idref& x) + { + const B& r (x); + return s << r; + } + + + // idrefs + // + template + inline ostream& + operator<< (ostream& s, const idrefs& x) + { + const list& r (x); + return s << r; + } + + + // uri + // + template + inline ostream& + operator<< (ostream& s, const uri& x) + { + const std::basic_string& r (x); + return s << r; + } + + + // qname + // + template + inline ostream& + operator<< (ostream& s, const qname& x) + { + return s << x.namespace_ () << x.name (); + } + + + // base64_binary + // + template + inline ostream& + operator<< (ostream& s, const base64_binary& x) + { + const buffer& r (x); + return s << r; + } + + + // hex_binary + // + template + inline ostream& + operator<< (ostream& s, const hex_binary& x) + { + const buffer& r (x); + return s << r; + } + + + // entity + // + template + inline ostream& + operator<< (ostream& s, const entity& x) + { + const B& r (x); + return s << r; + } + + + // entities + // + template + inline ostream& + operator<< (ostream& s, const entities& x) + { + const list& r (x); + return s << r; + } + } + } +} + +#include + +#endif // XSD_CXX_TREE_STREAM_INSERTION_HXX -- cgit v1.1