// file : xsd/cxx/tree/stream-insertion.hxx // copyright : Copyright (c) 2005-2014 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&) { // Not saving DOM content even if it's there. return s; } // simple_type // template inline ostream& operator<< (ostream& s, const simple_type& x) { if (!x.null_content ()) s << x.text_content (); 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