From bda619aa6ace8ed83d9888ea78f15c7c313c2044 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Apr 2013 16:47:17 +0200 Subject: Add support for polymorphic map plates --- NEWS | 4 ++ xsd/cxx/tree/elements.cxx | 3 ++ xsd/cxx/tree/elements.hxx | 1 + xsd/cxx/tree/options.cli | 8 ++++ xsd/cxx/tree/parser-source.cxx | 8 ++-- xsd/cxx/tree/serialization-source.cxx | 48 ++++++++++--------- xsd/cxx/tree/stream-extraction-source.cxx | 52 +++++++++++---------- xsd/cxx/tree/stream-insertion-source.cxx | 52 +++++++++++---------- xsd/cxx/tree/stream-source.cxx | 36 ++++++++------- xsd/cxx/tree/tree-source.cxx | 76 +++++++++++++++++-------------- 10 files changed, 164 insertions(+), 124 deletions(-) diff --git a/NEWS b/NEWS index 253bf35..5c60e5c 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,10 @@ C++/Tree strings. This can be useful if your documents contain a large number of repetitive strings. + * New option, --polymorphic-plate, allows the creation of multiple + polymorphic map plates in the same application. For details, refer + to the XSD compiler command line manual (man pages). + * To get the DOM association in the copy of an object model tree one now needs to explicitly pass the keep_dom flag as the second argument to the copy constructor or clone() function. diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx index f96c24c..87d58ca 100644 --- a/xsd/cxx/tree/elements.cxx +++ b/xsd/cxx/tree/elements.cxx @@ -71,6 +71,7 @@ namespace CXX doxygen (doxygen_), polymorphic (ops.generate_polymorphic ()), polymorphic_all (ops.polymorphic_type_all ()), + poly_plate (ops.polymorphic_plate ()), detach (ops.generate_detach ()), fwd_expr (fe), hxx_expr (he), @@ -310,6 +311,7 @@ namespace CXX doxygen (c.doxygen), polymorphic (c.polymorphic), polymorphic_all (c.polymorphic_all), + poly_plate (c.poly_plate), detach (c.detach), fwd_expr (c.fwd_expr), hxx_expr (c.hxx_expr), @@ -351,6 +353,7 @@ namespace CXX doxygen (c.doxygen), polymorphic (c.polymorphic), polymorphic_all (c.polymorphic_all), + poly_plate (c.poly_plate), detach (c.detach), fwd_expr (c.fwd_expr), hxx_expr (c.hxx_expr), diff --git a/xsd/cxx/tree/elements.hxx b/xsd/cxx/tree/elements.hxx index d02bfe7..b7d6626 100644 --- a/xsd/cxx/tree/elements.hxx +++ b/xsd/cxx/tree/elements.hxx @@ -424,6 +424,7 @@ namespace CXX bool& doxygen; bool polymorphic; bool polymorphic_all; + unsigned long poly_plate; bool detach; Regex const* fwd_expr; diff --git a/xsd/cxx/tree/options.cli b/xsd/cxx/tree/options.cli index 0d548e4..6a6b9a7 100644 --- a/xsd/cxx/tree/options.cli +++ b/xsd/cxx/tree/options.cli @@ -44,6 +44,14 @@ namespace CXX "Indicate that all types should be treated as polymorphic." }; + unsigned long --polymorphic-plate = 0 + { + "", + "Specify the polymorphic map plate the generated code should register + on. This functionality is primarily useful to segregate multiple + schemas that define the same polymorphic types." + }; + // Features. // bool --generate-serialization diff --git a/xsd/cxx/tree/parser-source.cxx b/xsd/cxx/tree/parser-source.cxx index 32491ac..881a2df 100644 --- a/xsd/cxx/tree/parser-source.cxx +++ b/xsd/cxx/tree/parser-source.cxx @@ -337,8 +337,8 @@ namespace CXX // os << "::xsd::cxx::tree::type_factory_map< " << char_type << " >& tfm (" << endl - << "::xsd::cxx::tree::type_factory_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::type_factory_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl << "::std::auto_ptr< ::xsd::cxx::tree::type > tmp (" << endl << "tfm.create (" << endl @@ -435,8 +435,8 @@ namespace CXX // os << "::xsd::cxx::tree::type_factory_map< " << char_type << " >& tfm (" << endl - << "::xsd::cxx::tree::type_factory_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::type_factory_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl << "::std::auto_ptr< ::xsd::cxx::tree::type > tmp (" << endl << "tfm.create (" << endl diff --git a/xsd/cxx/tree/serialization-source.cxx b/xsd/cxx/tree/serialization-source.cxx index 8711210..49369c8 100644 --- a/xsd/cxx/tree/serialization-source.cxx +++ b/xsd/cxx/tree/serialization-source.cxx @@ -102,8 +102,8 @@ namespace CXX String const& name (ename (l)); os << "static" << endl - << "const ::xsd::cxx::tree::type_serializer_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_serializer_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_serializer_init (" << endl << strlit (l.name ()) << "," << endl << strlit (xml_ns_name (l)) << ");" @@ -184,8 +184,8 @@ namespace CXX String const& name (ename (u)); os << "static" << endl - << "const ::xsd::cxx::tree::type_serializer_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_serializer_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_serializer_init (" << endl << strlit (u.name ()) << "," << endl << strlit (xml_ns_name (u)) << ");" @@ -268,8 +268,8 @@ namespace CXX String const& name (ename (e)); os << "static" << endl - << "const ::xsd::cxx::tree::type_serializer_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_serializer_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_serializer_init (" << endl << strlit (e.name ()) << "," << endl << strlit (xml_ns_name (e)) << ");" @@ -319,8 +319,8 @@ namespace CXX os << "{" << "::xsd::cxx::tree::type_serializer_map< " << char_type << " >& tsm (" << endl - << "::xsd::cxx::tree::type_serializer_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::type_serializer_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl; } @@ -821,8 +821,8 @@ namespace CXX String const& name (ename (c)); os << "static" << endl - << "const ::xsd::cxx::tree::type_serializer_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_serializer_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_serializer_init (" << endl << strlit (c.name ()) << "," << endl << strlit (xml_ns_name (c)) << ");" @@ -859,8 +859,8 @@ namespace CXX String const& name (ename (e)); os << "static" << endl - << "const ::xsd::cxx::tree::element_serializer_initializer< 0, " << - char_type << ", "; + << "const ::xsd::cxx::tree::element_serializer_initializer< " << + poly_plate << ", " << char_type << ", "; belongs (e, belongs_); @@ -1152,8 +1152,8 @@ namespace CXX << "{" << "::xsd::cxx::tree::type_serializer_map< " << char_type << " >& tsm (" << endl - << "::xsd::cxx::tree::type_serializer_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::type_serializer_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl << "tsm.serialize (" << endl << strlit (e.name ()) << "," << endl @@ -1196,8 +1196,8 @@ namespace CXX << "{" << "::xsd::cxx::tree::type_serializer_map< " << char_type << " >& tsm (" << endl - << "::xsd::cxx::tree::type_serializer_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::type_serializer_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl << dom_auto_ptr << "< " << xerces_ns << "::DOMDocument > r (" << endl @@ -1274,19 +1274,23 @@ namespace CXX if (export_maps) ctx.os << "template struct __declspec (dllexport) " << - "type_serializer_plate< 0, " << ctx.char_type << " >;"; + "type_serializer_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; if (import_maps) ctx.os << "template struct __declspec (dllimport) " << - "type_serializer_plate< 0, " << ctx.char_type << " >;"; + "type_serializer_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; ctx.os << "#elif defined(__GNUC__) && __GNUC__ >= 4" << endl << "template struct __attribute__ ((visibility(\"default\"))) " << - "type_serializer_plate< 0, " << ctx.char_type << " >;"; + "type_serializer_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; ctx.os << "#elif defined(XSD_MAP_VISIBILITY)" << endl << "template struct XSD_MAP_VISIBILITY " << - "type_serializer_plate< 0, " << ctx.char_type << " >;"; + "type_serializer_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; ctx.os << "#endif" << endl << "}" // tree @@ -1299,8 +1303,8 @@ namespace CXX ctx.os << "namespace _xsd" << "{" << "static" << endl - << "const ::xsd::cxx::tree::type_serializer_plate< 0, " << - ctx.char_type << " >" << endl + << "const ::xsd::cxx::tree::type_serializer_plate< " << + ctx.poly_plate << ", " << ctx.char_type << " >" << endl << "type_serializer_plate_init;" << "}"; } diff --git a/xsd/cxx/tree/stream-extraction-source.cxx b/xsd/cxx/tree/stream-extraction-source.cxx index 622056f..4704fb3 100644 --- a/xsd/cxx/tree/stream-extraction-source.cxx +++ b/xsd/cxx/tree/stream-extraction-source.cxx @@ -70,8 +70,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_extraction_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_extraction_init_" << n++ << " (" << endl << strlit (l.name ()) << "," << endl @@ -141,8 +141,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_extraction_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_extraction_init_" << n++ << " (" << endl << strlit (u.name ()) << "," << endl @@ -237,8 +237,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_extraction_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_extraction_init_" << n++ << " (" << endl << strlit (e.name ()) << "," << endl @@ -366,8 +366,9 @@ namespace CXX << "else" << "{" << "::std::auto_ptr< ::xsd::cxx::tree::type > tmp (" << endl - << "::xsd::cxx::tree::stream_extraction_map_instance< 0, " << - stream << ", " << char_type << " > ().extract (" << endl + << "::xsd::cxx::tree::stream_extraction_map_instance< " << + poly_plate << ", " << stream << ", " << char_type << + " > ().extract (" << endl << "s, f, this));" << "r.reset (dynamic_cast< " << type << "* > (tmp.get ()));" << "if (r.get ())" << endl @@ -414,8 +415,9 @@ namespace CXX << "else" << "{" << "::std::auto_ptr< ::xsd::cxx::tree::type > tmp (" << endl - << "::xsd::cxx::tree::stream_extraction_map_instance< 0, " << - stream << ", " << char_type << " > ().extract (" << endl + << "::xsd::cxx::tree::stream_extraction_map_instance< " << + poly_plate << ", " << stream << ", " << char_type << + " > ().extract (" << endl << "s, f, this));" << "r.reset (dynamic_cast< " << type << "* > (tmp.get ()));" << "if (r.get ())" << endl @@ -457,8 +459,9 @@ namespace CXX << "else" << "{" << "::std::auto_ptr< ::xsd::cxx::tree::type > tmp (" << endl - << "::xsd::cxx::tree::stream_extraction_map_instance< 0, " << - stream << ", " << char_type << " > ().extract (" << endl + << "::xsd::cxx::tree::stream_extraction_map_instance< " << + poly_plate << ", " << stream << ", " << char_type << + " > ().extract (" << endl << "s, f, this));" << "r.reset (dynamic_cast< " << type << "* > (tmp.get ()));" << "if (r.get ())" << endl @@ -674,8 +677,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_extraction_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_extraction_init_" << n++ << " (" << endl << strlit (c.name ()) << "," << endl @@ -729,22 +732,22 @@ namespace CXX if (export_maps) ctx.os << "template struct __declspec (dllexport) " << - "stream_extraction_plate< 0, " << stream << ", " << - ctx.char_type << " >;"; + "stream_extraction_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;"; if (import_maps) ctx.os << "template struct __declspec (dllimport) " << - "stream_extraction_plate< 0, " << stream << ", " << - ctx.char_type << " >;"; + "stream_extraction_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;"; ctx.os << "#elif defined(__GNUC__) && __GNUC__ >= 4" << endl << "template struct __attribute__ ((visibility(\"default\"))) " << - "stream_extraction_plate< 0, " << stream << ", " << - ctx.char_type << " >;" + "stream_extraction_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;" << "#elif defined(XSD_MAP_VISIBILITY)" << endl << "template struct XSD_MAP_VISIBILITY " << - "stream_extraction_plate< 0, " << stream << ", " << - ctx.char_type << " >;" + "stream_extraction_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;" << "#endif" << endl; } @@ -766,8 +769,9 @@ namespace CXX String stream (*i); ctx.os << "static" << endl - << "const ::xsd::cxx::tree::stream_extraction_plate< 0, " << - stream << ", " << ctx.char_type << " >" << endl + << "const ::xsd::cxx::tree::stream_extraction_plate< " << + ctx.poly_plate << ", " << stream << ", " << ctx.char_type << + " >" << endl << "stream_extraction_plate_init_" << n++ << ";"; } diff --git a/xsd/cxx/tree/stream-insertion-source.cxx b/xsd/cxx/tree/stream-insertion-source.cxx index 9c93060..b147f8f 100644 --- a/xsd/cxx/tree/stream-insertion-source.cxx +++ b/xsd/cxx/tree/stream-insertion-source.cxx @@ -69,8 +69,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_insertion_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_insertion_init_" << n++ << " (" << endl << strlit (l.name ()) << "," << endl @@ -140,8 +140,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_insertion_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_insertion_init_" << n++ << " (" << endl << strlit (u.name ()) << "," << endl @@ -230,8 +230,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_insertion_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_insertion_init_" << n++ << " (" << endl << strlit (e.name ()) << "," << endl @@ -292,8 +292,9 @@ namespace CXX << "if (!d)" << endl << "s << *i;" << "else" << endl - << "::xsd::cxx::tree::stream_insertion_map_instance< 0, " << - stream << ", " << char_type << " > ().insert (s, *i);"; + << "::xsd::cxx::tree::stream_insertion_map_instance< " << + poly_plate << ", " << stream << ", " << char_type << + " > ().insert (s, *i);"; } else os << "s << *i;"; @@ -319,8 +320,9 @@ namespace CXX << "if (!d)" << endl << "s << i;" << "else" << endl - << "::xsd::cxx::tree::stream_insertion_map_instance< 0, " << - stream << ", " << char_type << " > ().insert (s, i);" + << "::xsd::cxx::tree::stream_insertion_map_instance< " << + poly_plate << ", " << stream << ", " << char_type << + " > ().insert (s, i);" << "}"; } else @@ -342,8 +344,9 @@ namespace CXX << "if (!d)" << endl << "s << i;" << "else" << endl - << "::xsd::cxx::tree::stream_insertion_map_instance< 0, " << - stream << ", " << char_type << " > ().insert (s, i);" + << "::xsd::cxx::tree::stream_insertion_map_instance< " << + poly_plate << ", " << stream << ", " << char_type << + " > ().insert (s, i);" << "}"; } else @@ -454,8 +457,8 @@ namespace CXX os << "static" << endl << "const ::xsd::cxx::tree::stream_insertion_initializer< " << - "0, " << i->c_str () << ", " << - char_type << ", " << name << " >" << endl + poly_plate << ", " << i->c_str () << ", " << char_type << + ", " << name << " >" << endl << "_xsd_" << name << "_stream_insertion_init_" << n++ << " (" << endl << strlit (c.name ()) << "," << endl @@ -504,22 +507,22 @@ namespace CXX if (export_maps) ctx.os << "template struct __declspec (dllexport) " << - "stream_insertion_plate< 0, " << stream << ", " << - ctx.char_type << " >;"; + "stream_insertion_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;"; if (import_maps) ctx.os << "template struct __declspec (dllimport) " << - "stream_insertion_plate< 0, " << stream << ", " << - ctx.char_type << " >;"; + "stream_insertion_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;"; ctx.os << "#elif defined(__GNUC__) && __GNUC__ >= 4" << endl << "template struct __attribute__ ((visibility(\"default\"))) " << - "stream_insertion_plate< 0, " << stream << ", " << - ctx.char_type << " >;" + "stream_insertion_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;" << "#elif defined(XSD_MAP_VISIBILITY)" << endl << "template struct XSD_MAP_VISIBILITY " << - "stream_insertion_plate< 0, " << stream << ", " << - ctx.char_type << " >;" + "stream_insertion_plate< " << ctx.poly_plate << ", " << + stream << ", " << ctx.char_type << " >;" << "#endif" << endl; } @@ -540,8 +543,9 @@ namespace CXX String stream (*i); ctx.os << "static" << endl - << "const ::xsd::cxx::tree::stream_insertion_plate< 0, " << - stream << ", " << ctx.char_type << " >" << endl + << "const ::xsd::cxx::tree::stream_insertion_plate< " << + ctx.poly_plate << ", " << stream << ", " << ctx.char_type << + " >" << endl << "stream_insertion_plate_init_" << n++ << ";"; } diff --git a/xsd/cxx/tree/stream-source.cxx b/xsd/cxx/tree/stream-source.cxx index 77cfa81..a070ae7 100644 --- a/xsd/cxx/tree/stream-source.cxx +++ b/xsd/cxx/tree/stream-source.cxx @@ -61,8 +61,8 @@ namespace CXX String const& name (ename (l)); os << "static" << endl - << "const ::xsd::cxx::tree::std_ostream_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::std_ostream_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_std_ostream_init;" << endl; } @@ -118,8 +118,8 @@ namespace CXX String const& name (ename (u)); os << "static" << endl - << "const ::xsd::cxx::tree::std_ostream_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::std_ostream_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_std_ostream_init;" << endl; } @@ -198,8 +198,8 @@ namespace CXX String const& name (ename (e)); os << "static" << endl - << "const ::xsd::cxx::tree::std_ostream_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::std_ostream_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_std_ostream_init;" << endl; } @@ -241,8 +241,8 @@ namespace CXX os << "{" << "::xsd::cxx::tree::std_ostream_map< " << char_type << " >& om (" << endl - << "::xsd::cxx::tree::std_ostream_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::std_ostream_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl; } @@ -395,8 +395,8 @@ namespace CXX String const& name (ename (c)); os << "static" << endl - << "const ::xsd::cxx::tree::std_ostream_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::std_ostream_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_std_ostream_init;" << endl; } @@ -438,19 +438,23 @@ namespace CXX if (export_maps) ctx.os << "template struct __declspec (dllexport) " << - "std_ostream_plate< 0, " << ctx.char_type << " >;"; + "std_ostream_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; if (import_maps) ctx.os << "template struct __declspec (dllimport) " << - "std_ostream_plate< 0, " << ctx.char_type << " >;"; + "std_ostream_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; ctx.os << "#elif defined(__GNUC__) && __GNUC__ >= 4" << endl << "template struct __attribute__ ((visibility(\"default\"))) " << - "std_ostream_plate< 0, " << ctx.char_type << " >;"; + "std_ostream_plate< " << ctx.poly_plate << ", " << ctx.char_type << + " >;"; ctx.os << "#elif defined(XSD_MAP_VISIBILITY)" << endl << "template struct XSD_MAP_VISIBILITY " << - "std_ostream_plate< 0, " << ctx.char_type << " >;"; + "std_ostream_plate< " << ctx.poly_plate << ", " << ctx.char_type << + " >;"; ctx.os << "#endif" << endl << "}" // tree @@ -463,8 +467,8 @@ namespace CXX ctx.os << "namespace _xsd" << "{" << "static" << endl - << "const ::xsd::cxx::tree::std_ostream_plate< 0, " << - ctx.char_type << " >" << endl + << "const ::xsd::cxx::tree::std_ostream_plate< " << + ctx.poly_plate << ", " << ctx.char_type << " >" << endl << "std_ostream_plate_init;" << "}"; } diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx index fb4be66..9c40b5d 100644 --- a/xsd/cxx/tree/tree-source.cxx +++ b/xsd/cxx/tree/tree-source.cxx @@ -120,8 +120,8 @@ namespace CXX if (!anonymous_p (l) && !options.suppress_parsing ()) { os << "static" << endl - << "const ::xsd::cxx::tree::type_factory_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_factory_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_factory_init (" << endl << strlit (l.name ()) << "," << endl << strlit (xml_ns_name (l)) << ");" @@ -132,8 +132,8 @@ namespace CXX options.generate_comparison ()) { os << "static" << endl - << "const ::xsd::cxx::tree::comparison_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::comparison_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_comparison_init;" << endl; } @@ -235,8 +235,8 @@ namespace CXX if (!anonymous_p (u) && !options.suppress_parsing ()) { os << "static" << endl - << "const ::xsd::cxx::tree::type_factory_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_factory_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_factory_init (" << endl << strlit (u.name ()) << "," << endl << strlit (xml_ns_name (u)) << ");" @@ -247,8 +247,8 @@ namespace CXX options.generate_comparison ()) { os << "static" << endl - << "const ::xsd::cxx::tree::comparison_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::comparison_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_comparison_init;" << endl; } @@ -535,8 +535,8 @@ namespace CXX if (!anonymous_p (e) && !options.suppress_parsing ()) { os << "static" << endl - << "const ::xsd::cxx::tree::type_factory_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_factory_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_factory_init (" << endl << strlit (e.name ()) << "," << endl << strlit (xml_ns_name (e)) << ");" @@ -547,8 +547,8 @@ namespace CXX options.generate_comparison ()) { os << "static" << endl - << "const ::xsd::cxx::tree::comparison_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::comparison_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_comparison_init;" << endl; } @@ -725,8 +725,8 @@ namespace CXX os << "{" << "::xsd::cxx::tree::type_factory_map< " << char_type << " >& tfm (" << endl - << "::xsd::cxx::tree::type_factory_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::type_factory_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl << "::std::auto_ptr< ::xsd::cxx::tree::type > tmp (" << endl << "tfm.create (" << endl @@ -1884,8 +1884,8 @@ namespace CXX os << "{" << "::xsd::cxx::tree::comparison_map< " << char_type << " >& cm (" << endl - << "::xsd::cxx::tree::comparison_map_instance< 0, " << - char_type << " > ());" + << "::xsd::cxx::tree::comparison_map_instance< " << + poly_plate << ", " << char_type << " > ());" << endl; if (max (e) != 1) @@ -3096,8 +3096,8 @@ namespace CXX if (!anonymous_p (c) && !options.suppress_parsing ()) { os << "static" << endl - << "const ::xsd::cxx::tree::type_factory_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::type_factory_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_type_factory_init (" << endl << strlit (c.name ()) << "," << endl << strlit (xml_ns_name (c)) << ");" @@ -3108,8 +3108,8 @@ namespace CXX options.generate_comparison ()) { os << "static" << endl - << "const ::xsd::cxx::tree::comparison_initializer< 0, " << - char_type << ", " << name << " >" << endl + << "const ::xsd::cxx::tree::comparison_initializer< " << + poly_plate << ", " << char_type << ", " << name << " >" << endl << "_xsd_" << name << "_comparison_init;" << endl; } @@ -3418,8 +3418,8 @@ namespace CXX Type& r (e.substitutes ().root ()); os << "static" << endl - << "const ::xsd::cxx::tree::element_factory_initializer< 0, " << - char_type << ", "; + << "const ::xsd::cxx::tree::element_factory_initializer< " << + poly_plate << ", " << char_type << ", "; belongs (e, belongs_); @@ -3487,39 +3487,47 @@ namespace CXX if (parsing && export_maps) ctx.os << "template struct __declspec (dllexport) " << - "type_factory_plate< 0, " << ctx.char_type << " >;"; + "type_factory_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; if (parsing && import_maps) ctx.os << "template struct __declspec (dllimport) " << - "type_factory_plate< 0, " << ctx.char_type << " >;"; + "type_factory_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; if (comparison && export_maps) ctx.os << "template struct __declspec (dllexport) " << - "comparison_plate< 0, " << ctx.char_type << " >;"; + "comparison_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; if (comparison && import_maps) ctx.os << "template struct __declspec (dllimport) " << - "comparison_plate< 0, " << ctx.char_type << " >;"; + "comparison_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; ctx.os << "#elif defined(__GNUC__) && __GNUC__ >= 4" << endl; if (parsing) ctx.os << "template struct __attribute__ ((visibility(\"default\"))) " << - "type_factory_plate< 0, " << ctx.char_type << " >;"; + "type_factory_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; if (comparison) ctx.os << "template struct __attribute__ ((visibility(\"default\"))) " << - "comparison_plate< 0, " << ctx.char_type << " >;"; + "comparison_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; ctx.os << "#elif defined(XSD_MAP_VISIBILITY)" << endl; if (parsing) ctx.os << "template struct XSD_MAP_VISIBILITY " << - "type_factory_plate< 0, " << ctx.char_type << " >;"; + "type_factory_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; if (comparison) ctx.os << "template struct XSD_MAP_VISIBILITY " << - "comparison_plate< 0, " << ctx.char_type << " >;"; + "comparison_plate< " << ctx.poly_plate << ", " << + ctx.char_type << " >;"; ctx.os << "#endif" << endl << "}" // tree @@ -3534,15 +3542,15 @@ namespace CXX if (parsing) ctx.os << "static" << endl - << "const ::xsd::cxx::tree::type_factory_plate< 0, " << - ctx.char_type << " >" << endl + << "const ::xsd::cxx::tree::type_factory_plate< " << + ctx.poly_plate << ", " << ctx.char_type << " >" << endl << "type_factory_plate_init;" << endl; if (comparison) ctx.os << "static" << endl - << "const ::xsd::cxx::tree::comparison_plate< 0, " << - ctx.char_type << " >" << endl + << "const ::xsd::cxx::tree::comparison_plate< " << + ctx.poly_plate << ", " << ctx.char_type << " >" << endl << "comparison_plate_init;" << endl; -- cgit v1.1