diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-05-11 12:20:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-05-11 12:20:11 +0200 |
commit | 2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 (patch) | |
tree | 49c2748443fe3c1f01108756b647440e0647a11b /xsde/cxx/serializer/serializer-header.cxx | |
parent | 161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff) |
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'xsde/cxx/serializer/serializer-header.cxx')
-rw-r--r-- | xsde/cxx/serializer/serializer-header.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/xsde/cxx/serializer/serializer-header.cxx b/xsde/cxx/serializer/serializer-header.cxx index dd20289..3a10942 100644 --- a/xsde/cxx/serializer/serializer-header.cxx +++ b/xsde/cxx/serializer/serializer-header.cxx @@ -1756,6 +1756,21 @@ namespace CXX String const c (char_type); + // Custom allocator. + // + if (custom_alloc) + { + os << "// Custom allocator." << endl + << "//" << endl + << "using ::xsde::cxx::alloc;" + << "using ::xsde::cxx::free;"; + + if (exceptions) + os << "using ::xsde::cxx::alloc_guard;"; + + os << endl; + } + os << "// Built-in XML Schema types mapping." << endl << "//" << endl << "using ::xsde::cxx::string_sequence;" @@ -1898,8 +1913,9 @@ namespace CXX } else { - ctx.os << "#include <xsde/config.h>" << endl - << endl; + if (ctx.custom_alloc) + ctx.os << "#include <xsde/cxx/allocator.hxx>" << endl + << endl; // std::string or xsde::cxx::string is used in wildcard API. // |