From 2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 11 May 2010 12:20:11 +0200 Subject: Add support for custom allocators New example: examples/cxx/hybrid/allocator. --- xsde/cxx/serializer/serializer-header.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'xsde/cxx/serializer/serializer-header.cxx') 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 " << endl - << endl; + if (ctx.custom_alloc) + ctx.os << "#include " << endl + << endl; // std::string or xsde::cxx::string is used in wildcard API. // -- cgit v1.1