From bada6666c70977a058755ccf232e7d67b24adeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:21:29 +0200 Subject: New upstream release --- xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx | 42 +++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx') diff --git a/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx b/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx index a4e429e..61dd306 100644 --- a/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx +++ b/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx @@ -1,6 +1,5 @@ // file : xsd/cxx/tree/stream-extraction-map.txx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include @@ -31,7 +30,7 @@ namespace xsd &extractor_impl, false); - typedef simple_type simple_type; + typedef simple_type simple_type; register_type ( qualified_name (bits::any_simple_type (), xsd), &extractor_impl, @@ -219,9 +218,9 @@ namespace xsd void stream_extraction_map:: register_type (const qualified_name& name, extractor e, - bool override) + bool replace) { - if (override || type_map_.find (name) == type_map_.end ()) + if (replace || type_map_.find (name) == type_map_.end ()) type_map_[name] = e; } @@ -233,11 +232,34 @@ namespace xsd } template - std::auto_ptr stream_extraction_map:: + XSD_AUTO_PTR stream_extraction_map:: extract (istream& s, flags f, container* c) { - std::basic_string name, ns; - s >> ns >> name; + std::basic_string ns, name; + + // The namespace and name strings are pooled. + // + std::size_t id; + istream_common::as_size as_size (id); + s >> as_size; + + if (id != 0) + s.pool_string (id, ns); + else + { + s >> ns; + s.pool_add (ns); + } + + s >> as_size; + + if (id != 0) + s.pool_string (id, name); + else + { + s >> name; + s.pool_add (name); + } if (extractor e = find (qualified_name (name, ns))) { @@ -280,10 +302,10 @@ namespace xsd // // template - std::auto_ptr + XSD_AUTO_PTR extractor_impl (istream& s, flags f, container* c) { - return std::auto_ptr (new T (s, f, c)); + return XSD_AUTO_PTR (new T (s, f, c)); } -- cgit v1.2.3