From b7197929af1cca15e490703ba3632ae52a348b60 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 14 Oct 2010 12:21:35 +0200 Subject: New mapping for anyType with support for polymorphism --- xsde/cxx/serializer/generator.cxx | 392 +++++++++++++++++++------------------- 1 file changed, 196 insertions(+), 196 deletions(-) (limited to 'xsde/cxx/serializer/generator.cxx') diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx index 36539f4..3366ff4 100644 --- a/xsde/cxx/serializer/generator.cxx +++ b/xsde/cxx/serializer/generator.cxx @@ -1201,222 +1201,222 @@ namespace CXX << "#define " << guard << endl << endl; - // Copy prologue. + // Version check. // - hxx << "// Begin prologue." << endl - << "//" << endl; + hxx << "#include " << endl + << endl + << "#if (XSDE_INT_VERSION != " << XSDE_INT_VERSION << "L)" << endl + << "#error XSD/e runtime version mismatch" << endl + << "#endif" << endl + << endl; - append ( - hxx, ops.value (), ops.value ()); - append (hxx, ops.value (), prologue); + // Runtime/generated code compatibility checks. + // - hxx << "//" << endl - << "// End prologue." << endl + hxx << "#include " << endl << endl; + if (ops.value () == "iso8859-1") { - // Version check. - // - hxx << "#include " << endl - << endl - << "#if (XSDE_INT_VERSION != " << XSDE_INT_VERSION << "L)" << endl - << "#error XSD/e runtime version mismatch" << endl + hxx << "#ifndef XSDE_ENCODING_ISO8859_1" << endl + << "#error the generated code uses the ISO-8859-1 encoding" << + "while the XSD/e runtime does not (reconfigure the runtime " << + "or change the --char-encoding value)" << endl << "#endif" << endl << endl; + } + else + { + hxx << "#ifndef XSDE_ENCODING_UTF8" << endl + << "#error the generated code uses the UTF-8 encoding" << + "while the XSD/e runtime does not (reconfigure the runtime " << + "or change the --char-encoding value)" << endl + << "#endif" << endl + << endl; + } - // Runtime/generated code compatibility checks. - // + if (ops.value ()) + { + hxx << "#ifdef XSDE_STL" << endl + << "#error the XSD/e runtime uses STL while the " << + "generated code does not (reconfigure the runtime or " << + "remove --no-stl)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifndef XSDE_STL" << endl + << "#error the generated code uses STL while the " << + "XSD/e runtime does not (reconfigure the runtime or " << + "add --no-stl)" << endl + << "#endif" << endl + << endl; + } - hxx << "#include " << endl + if (ops.value ()) + { + hxx << "#ifdef XSDE_IOSTREAM" << endl + << "#error the XSD/e runtime uses iostream while the " << + "generated code does not (reconfigure the runtime or " << + "remove --no-iostream)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifndef XSDE_IOSTREAM" << endl + << "#error the generated code uses iostream while the " << + "XSD/e runtime does not (reconfigure the runtime or " << + "add --no-iostream)" << endl + << "#endif" << endl << endl; + } - if (ops.value () == "iso8859-1") - { - hxx << "#ifndef XSDE_ENCODING_ISO8859_1" << endl - << "#error the generated code uses the ISO-8859-1 encoding" << - "while the XSD/e runtime does not (reconfigure the runtime " << - "or change the --char-encoding value)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifndef XSDE_ENCODING_UTF8" << endl - << "#error the generated code uses the UTF-8 encoding" << - "while the XSD/e runtime does not (reconfigure the runtime " << - "or change the --char-encoding value)" << endl - << "#endif" << endl - << endl; - } + if (ops.value ()) + { + hxx << "#ifdef XSDE_EXCEPTIONS" << endl + << "#error the XSD/e runtime uses exceptions while the " << + "generated code does not (reconfigure the runtime or " << + "remove --no-exceptions)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifndef XSDE_EXCEPTIONS" << endl + << "#error the generated code uses exceptions while the " << + "XSD/e runtime does not (reconfigure the runtime or " << + "add --no-exceptions)" << endl + << "#endif" << endl + << endl; + } - if (ops.value ()) - { - hxx << "#ifdef XSDE_STL" << endl - << "#error the XSD/e runtime uses STL while the " << - "generated code does not (reconfigure the runtime or " << - "remove --no-stl)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifndef XSDE_STL" << endl - << "#error the generated code uses STL while the " << - "XSD/e runtime does not (reconfigure the runtime or " << - "add --no-stl)" << endl - << "#endif" << endl - << endl; - } + if (ops.value ()) + { + hxx << "#ifdef XSDE_LONGLONG" << endl + << "#error the XSD/e runtime uses long long while the " << + "generated code does not (reconfigure the runtime or " << + "remove --no-long-long)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifndef XSDE_LONGLONG" << endl + << "#error the generated code uses long long while the " << + "XSD/e runtime does not (reconfigure the runtime or " << + "add --no-long-long)" << endl + << "#endif" << endl + << endl; + } - if (ops.value ()) - { - hxx << "#ifdef XSDE_IOSTREAM" << endl - << "#error the XSD/e runtime uses iostream while the " << - "generated code does not (reconfigure the runtime or " << - "remove --no-iostream)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifndef XSDE_IOSTREAM" << endl - << "#error the generated code uses iostream while the " << - "XSD/e runtime does not (reconfigure the runtime or " << - "add --no-iostream)" << endl - << "#endif" << endl - << endl; - } + if (ops.value ()) + { + hxx << "#ifdef XSDE_SERIALIZER_VALIDATION" << endl + << "#error the XSD/e runtime uses validation while the " << + "generated code does not (reconfigure the runtime or " << + "remove --suppress-validation)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifndef XSDE_SERIALIZER_VALIDATION" << endl + << "#error the generated code uses validation while the " << + "XSD/e runtime does not (reconfigure the runtime or " << + "add --suppress-validation)" << endl + << "#endif" << endl + << endl; + } - if (ops.value ()) - { - hxx << "#ifdef XSDE_EXCEPTIONS" << endl - << "#error the XSD/e runtime uses exceptions while the " << - "generated code does not (reconfigure the runtime or " << - "remove --no-exceptions)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifndef XSDE_EXCEPTIONS" << endl - << "#error the generated code uses exceptions while the " << - "XSD/e runtime does not (reconfigure the runtime or " << - "add --no-exceptions)" << endl - << "#endif" << endl - << endl; - } + if (ops.value () || + ops.value ()) + { + hxx << "#ifndef XSDE_POLYMORPHIC" << endl + << "#error the generated code expects XSD/e runtime with " << + "polymorphism support (reconfigure the runtime or remove " << + "--generate-polymorphic/--runtime-polymorphic)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifdef XSDE_POLYMORPHIC" << endl + << "#error the generated code expects XSD/e runtime " << + "without polymorphism support (reconfigure the runtime or " << + "add --generate-polymorphic/--runtime-polymorphic)" << endl + << "#endif" << endl + << endl; + } - if (ops.value ()) - { - hxx << "#ifdef XSDE_LONGLONG" << endl - << "#error the XSD/e runtime uses long long while the " << - "generated code does not (reconfigure the runtime or " << - "remove --no-long-long)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifndef XSDE_LONGLONG" << endl - << "#error the generated code uses long long while the " << - "XSD/e runtime does not (reconfigure the runtime or " << - "add --no-long-long)" << endl - << "#endif" << endl - << endl; - } + if (ops.value ()) + { + hxx << "#ifndef XSDE_REUSE_STYLE_MIXIN" << endl + << "#error the generated code uses the mixin reuse style " << + "while the XSD/e runtime does not (reconfigure the runtime " << + "or remove --reuse-style-mixin)" << endl + << "#endif" << endl + << endl; + } + else if (ops.value ()) + { + hxx << "#ifndef XSDE_REUSE_STYLE_NONE" << endl + << "#error the generated code does not provide support " << + "for serializer reuse while the XSD/e runtime does (" << + "reconfigure the runtime or remove --reuse-style-none)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifndef XSDE_REUSE_STYLE_TIEIN" << endl + << "#error the generated code uses the tiein reuse style " << + "while the XSD/e runtime does not (reconfigure the runtime " << + "or add --reuse-style-mixin or --reuse-style-none)" << endl + << "#endif" << endl + << endl; + } - if (ops.value ()) - { - hxx << "#ifdef XSDE_SERIALIZER_VALIDATION" << endl - << "#error the XSD/e runtime uses validation while the " << - "generated code does not (reconfigure the runtime or " << - "remove --suppress-validation)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifndef XSDE_SERIALIZER_VALIDATION" << endl - << "#error the generated code uses validation while the " << - "XSD/e runtime does not (reconfigure the runtime or " << - "add --suppress-validation)" << endl - << "#endif" << endl - << endl; - } + if (ops.value ()) + { + hxx << "#ifndef XSDE_CUSTOM_ALLOCATOR" << endl + << "#error the generated code uses custom allocator while " << + "the XSD/e runtime does not (reconfigure the runtime or " << + "remove --custom-allocator)" << endl + << "#endif" << endl + << endl; + } + else + { + hxx << "#ifdef XSDE_CUSTOM_ALLOCATOR" << endl + << "#error the XSD/e runtime uses custom allocator while " << + "the generated code does not (reconfigure the runtime or " << + "add --custom-allocator)" << endl + << "#endif" << endl + << endl; + } - if (ops.value () || - ops.value ()) - { - hxx << "#ifndef XSDE_POLYMORPHIC" << endl - << "#error the generated code expects XSD/e runtime with " << - "polymorphism support (reconfigure the runtime or remove " << - "--generate-polymorphic/--runtime-polymorphic)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifdef XSDE_POLYMORPHIC" << endl - << "#error the generated code expects XSD/e runtime " << - "without polymorphism support (reconfigure the runtime or " << - "add --generate-polymorphic/--runtime-polymorphic)" << endl - << "#endif" << endl - << endl; - } + // + // - if (ops.value ()) - { - hxx << "#ifndef XSDE_REUSE_STYLE_MIXIN" << endl - << "#error the generated code uses the mixin reuse style " << - "while the XSD/e runtime does not (reconfigure the runtime " << - "or remove --reuse-style-mixin)" << endl - << "#endif" << endl - << endl; - } - else if (ops.value ()) - { - hxx << "#ifndef XSDE_REUSE_STYLE_NONE" << endl - << "#error the generated code does not provide support " << - "for serializer reuse while the XSD/e runtime does (" << - "reconfigure the runtime or remove --reuse-style-none)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifndef XSDE_REUSE_STYLE_TIEIN" << endl - << "#error the generated code uses the tiein reuse style " << - "while the XSD/e runtime does not (reconfigure the runtime " << - "or add --reuse-style-mixin or --reuse-style-none)" << endl - << "#endif" << endl - << endl; - } + hxx << "#include " << endl + << endl; - if (ops.value ()) - { - hxx << "#ifndef XSDE_CUSTOM_ALLOCATOR" << endl - << "#error the generated code uses custom allocator while " << - "the XSD/e runtime does not (reconfigure the runtime or " << - "remove --custom-allocator)" << endl - << "#endif" << endl - << endl; - } - else - { - hxx << "#ifdef XSDE_CUSTOM_ALLOCATOR" << endl - << "#error the XSD/e runtime uses custom allocator while " << - "the generated code does not (reconfigure the runtime or " << - "add --custom-allocator)" << endl - << "#endif" << endl - << endl; - } + // Copy prologue. + // + hxx << "// Begin prologue." << endl + << "//" << endl; - // - // + append ( + hxx, ops.value (), ops.value ()); + append (hxx, ops.value (), prologue); - hxx << "#include " << endl - << endl; + hxx << "//" << endl + << "// End prologue." << endl + << endl; + { // Set auto-indentation. // Indentation::Clip hxx_clip (hxx); @@ -1432,9 +1432,6 @@ namespace CXX if (inline_) hxx << "#include " << ctx.process_include_path (ixx_name) << endl << endl; - - hxx << "#include " << endl - << endl; } // Copy epilogue. @@ -1450,6 +1447,9 @@ namespace CXX << "// End epilogue." << endl << endl; + hxx << "#include " << endl + << endl; + hxx << "#endif // " << guard << endl; if (show_sloc) -- cgit v1.1