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-insertion-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-insertion-map.txx')
-rw-r--r-- | libxsd/xsd/cxx/tree/stream-insertion-map.txx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libxsd/xsd/cxx/tree/stream-insertion-map.txx b/libxsd/xsd/cxx/tree/stream-insertion-map.txx index 07bfa8b..d5799c2 100644 --- a/libxsd/xsd/cxx/tree/stream-insertion-map.txx +++ b/libxsd/xsd/cxx/tree/stream-insertion-map.txx @@ -269,7 +269,24 @@ namespace xsd { const qualified_name& qn (ti->name ()); - s << qn.namespace_ () << qn.name (); + // Pool the namespace and name strings. + // + const std::basic_string<C>& ns (qn.namespace_ ()); + const std::basic_string<C>& 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<std::size_t> (ns_id); + + if (ns_id == 0) + s << ns; + + s << ostream_common::as_size<std::size_t> (n_id); + + if (n_id == 0) + s << n; + ti->inserter () (s, x); } else |