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-insertion-map.txx | 28 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx') diff --git a/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx b/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx index 07bfa8b..78fbacb 100644 --- a/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx +++ b/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx @@ -1,6 +1,5 @@ // file : xsd/cxx/tree/stream-insertion-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 @@ -32,7 +31,7 @@ namespace xsd &inserter_impl, false); - typedef simple_type simple_type; + typedef simple_type simple_type; register_type ( typeid (simple_type), qualified_name (bits::any_simple_type (), xsd), @@ -248,9 +247,9 @@ namespace xsd register_type (const type_id& tid, const qualified_name& name, inserter i, - bool override) + bool replace) { - if (override || type_map_.find (&tid) == type_map_.end ()) + if (replace || type_map_.find (&tid) == type_map_.end ()) type_map_[&tid] = type_info (name, i); } @@ -269,7 +268,24 @@ namespace xsd { const qualified_name& qn (ti->name ()); - s << qn.namespace_ () << qn.name (); + // Pool the namespace and name strings. + // + const std::basic_string& ns (qn.namespace_ ()); + const std::basic_string& n (qn.name ()); + + std::size_t ns_id (s.pool_string (ns)); + std::size_t n_id (s.pool_string (n)); + + s << ostream_common::as_size (ns_id); + + if (ns_id == 0) + s << ns; + + s << ostream_common::as_size (n_id); + + if (n_id == 0) + s << n; + ti->inserter () (s, x); } else -- cgit v1.2.3