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-extraction-map.hxx | 97 +++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 libxsd/xsd/cxx/tree/stream-extraction-map.hxx (limited to 'libxsd/xsd/cxx/tree/stream-extraction-map.hxx') diff --git a/libxsd/xsd/cxx/tree/stream-extraction-map.hxx b/libxsd/xsd/cxx/tree/stream-extraction-map.hxx new file mode 100644 index 0000000..14a5423 --- /dev/null +++ b/libxsd/xsd/cxx/tree/stream-extraction-map.hxx @@ -0,0 +1,97 @@ +// file : xsd/cxx/tree/stream-extraction-map.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_EXTRACTION_MAP_HXX +#define XSD_CXX_TREE_STREAM_EXTRACTION_MAP_HXX + +#include +#include // std::auto_ptr +#include // std::size_t + +#include +#include +#include + +namespace xsd +{ + namespace cxx + { + namespace tree + { + template + struct stream_extraction_map + { + typedef xml::qualified_name qualified_name; + typedef std::auto_ptr (*extractor) ( + istream&, flags, container*); + + public: + stream_extraction_map (); + + void + register_type (const qualified_name& name, + extractor, + bool override = true); + + std::auto_ptr + extract (istream&, flags, container*); + + public: + extractor + find (const qualified_name& name) const; + + private: + typedef std::map type_map; + + type_map type_map_; + }; + + // + // + template + struct stream_extraction_plate + { + static stream_extraction_map* map; + static std::size_t count; + + stream_extraction_plate (); + ~stream_extraction_plate (); + }; + + template + stream_extraction_map* stream_extraction_plate::map = 0; + + template + std::size_t stream_extraction_plate::count = 0; + + + // + // + template + inline stream_extraction_map& + stream_extraction_map_instance () + { + return *stream_extraction_plate::map; + } + + // + // + template + std::auto_ptr + extractor_impl (istream&, flags, container*); + + + template + struct stream_extraction_initializer + { + stream_extraction_initializer (const C* name, const C* ns); + }; + } + } +} + +#include + +#endif // XSD_CXX_TREE_STREAM_EXTRACTION_MAP_HXX -- cgit v1.1