diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-05-21 19:18:52 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-05-21 19:18:52 +0200 |
commit | 9a764d4ed5606c5f171ae05a7409128a88184b11 (patch) | |
tree | 8f1c862354e5c6f112e7e52e3641ad87e4d276df /libxsd/xsd/cxx/tree/stream-extraction-map.txx | |
parent | efb2476d01b2bcc62569c8748327754a836195c3 (diff) |
Pool polymorphic type-id strings in binary representations
Add support for an implicit string pool in istream and ostream
templates. Use this support to pool type namespace and name
when dealing with polymorphic types.
Diffstat (limited to 'libxsd/xsd/cxx/tree/stream-extraction-map.txx')
-rw-r--r-- | libxsd/xsd/cxx/tree/stream-extraction-map.txx | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/libxsd/xsd/cxx/tree/stream-extraction-map.txx b/libxsd/xsd/cxx/tree/stream-extraction-map.txx index a4e429e..faabe7c 100644 --- a/libxsd/xsd/cxx/tree/stream-extraction-map.txx +++ b/libxsd/xsd/cxx/tree/stream-extraction-map.txx @@ -236,8 +236,31 @@ namespace xsd std::auto_ptr<type> stream_extraction_map<S, C>:: extract (istream<S>& s, flags f, container* c) { - std::basic_string<C> name, ns; - s >> ns >> name; + std::basic_string<C> ns, name; + + // The namespace and name strings are pooled. + // + std::size_t id; + istream_common::as_size<std::size_t> 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))) { |