From 2615896faa646e5830abf2c269150e1165c66515 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- libxsd/libxsd/cxx/tree/stream-extraction.hxx | 304 +++++++++++++++++++++++++++ 1 file changed, 304 insertions(+) create mode 100644 libxsd/libxsd/cxx/tree/stream-extraction.hxx (limited to 'libxsd/libxsd/cxx/tree/stream-extraction.hxx') diff --git a/libxsd/libxsd/cxx/tree/stream-extraction.hxx b/libxsd/libxsd/cxx/tree/stream-extraction.hxx new file mode 100644 index 0000000..8c00285 --- /dev/null +++ b/libxsd/libxsd/cxx/tree/stream-extraction.hxx @@ -0,0 +1,304 @@ +// file : libxsd/cxx/tree/stream-extraction.hxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef LIBXSD_CXX_TREE_STREAM_EXTRACTION_HXX +#define LIBXSD_CXX_TREE_STREAM_EXTRACTION_HXX + +#include +#include +#include + +#include + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // type + // + template + inline _type:: + _type (istream&, flags, container* c) + : container_ (c) + { + } + + // simple_type + // + template + template + inline simple_type:: + simple_type (istream& s, flags f, container* c) + : type (s, f & ~flags::extract_content, c) + { + if (f & flags::extract_content) + { + std::basic_string t; + s >> t; + this->content_.reset (new text_content_type (t)); + } + } + + // fundamental_base + // + template + template + inline fundamental_base:: + fundamental_base (istream& s, flags f, container* c) + : B (s, f, c), facet_table_ (0) + { + T& r (*this); + s >> r; + } + + // list + // + template + template + list:: + list (istream& s, flags f, container* c) + : sequence (c) + { + std::size_t size; + istream_common::as_size as_size (size); + s >> as_size; + + if (size > 0) + { + this->reserve (size); + + while (size--) + this->push_back (traits::create (s, f, c)); + } + } + + template + template + list:: + list (istream& s, flags, container* c) + : sequence (c) + { + std::size_t size; + istream_common::as_size as_size (size); + s >> as_size; + + if (size > 0) + { + this->reserve (size); + + while (size--) + { + T x; + s >> x; + this->push_back (x); + } + } + } + + // Extraction operators for built-in types. + // + + + // string + // + template + template + inline string:: + string (istream& s, flags f, container* c) + : B (s, f, c) + { + std::basic_string& r (*this); + s >> r; + } + + + // normalized_string + // + template + template + inline normalized_string:: + normalized_string (istream& s, flags f, container* c) + : B (s, f, c) + { + } + + + // token + // + template + template + inline token:: + token (istream& s, flags f, container* c) + : B (s, f, c) + { + } + + + // nmtoken + // + template + template + inline nmtoken:: + nmtoken (istream& s, flags f, container* c) + : B (s, f, c) + { + } + + + // nmtokens + // + template + template + inline nmtokens:: + nmtokens (istream& s, flags f, container* c) + : B (s, f, c), base_type (s, f, this) + { + } + + + // name + // + template + template + inline name:: + name (istream& s, flags f, container* c) + : B (s, f, c) + { + } + + + // ncname + // + template + template + inline ncname:: + ncname (istream& s, flags f, container* c) + : B (s, f, c) + { + } + + + // language + // + template + template + inline language:: + language (istream& s, flags f, container* c) + : B (s, f, c) + { + } + + + // id + // + template + template + inline id:: + id (istream& s, flags f, container* c) + : B (s, f, c), identity_ (*this) + { + register_id (); + } + + + // idref + // + template + template + inline idref:: + idref (istream& s, flags f, container* c) + : B (s, f, c), identity_ (*this) + { + } + + + // idrefs + // + template + template + inline idrefs:: + idrefs (istream& s, flags f, container* c) + : B (s, f, c), base_type (s, f, this) + { + } + + + // uri + // + template + template + inline uri:: + uri (istream& s, flags f, container* c) + : B (s, f, c) + { + std::basic_string& r (*this); + s >> r; + } + + + // qname + // + template + template + inline qname:: + qname (istream& s, flags f, container* c) + : B (s, f, c), ns_ (s), name_ (s) + { + } + + + // base64_binary + // + template + template + inline base64_binary:: + base64_binary (istream& s, flags f, container* c) + : B (s, f, c) + { + buffer& r (*this); + s >> r; + } + + + // hex_binary + // + template + template + inline hex_binary:: + hex_binary (istream& s, flags f, container* c) + : B (s, f, c) + { + buffer& r (*this); + s >> r; + } + + + // entity + // + template + template + inline entity:: + entity (istream& s, flags f, container* c) + : B (s, f, c) + { + } + + + // entities + // + template + template + inline entities:: + entities (istream& s, flags f, container* c) + : B (s, f, c), base_type (s, f, this) + { + } + } + } +} + +#include + +#endif // LIBXSD_CXX_TREE_STREAM_EXTRACTION_HXX -- cgit v1.1