diff options
Diffstat (limited to 'xsd/cxx/tree/stream-insertion-source.cxx')
-rw-r--r-- | xsd/cxx/tree/stream-insertion-source.cxx | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/xsd/cxx/tree/stream-insertion-source.cxx b/xsd/cxx/tree/stream-insertion-source.cxx index 007e32c..e98199e 100644 --- a/xsd/cxx/tree/stream-insertion-source.cxx +++ b/xsd/cxx/tree/stream-insertion-source.cxx @@ -269,6 +269,16 @@ namespace CXX // bool poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); + // Check if this element is abstract. + // + bool abst (false); + if (poly) + { + SemanticGraph::Complex* tc; + abst = (tc = dynamic_cast<SemanticGraph::Complex*> (&t)) != 0 && + tc->abstract_p (); + } + if (max (e) != 1) { // sequence @@ -286,12 +296,14 @@ namespace CXX if (poly) { - os << "bool d (typeid (" << type << ") != typeid (*i));" - << "s << d;" - << "if (!d)" << endl - << "s << *i;" - << "else" << endl - << "::xsd::cxx::tree::stream_insertion_map_instance< " << + if (!abst) + os << "bool d (typeid (" << type << ") != typeid (*i));" + << "s << d;" + << "if (!d)" << endl + << "s << *i;" + << "else" << endl; + + os << "::xsd::cxx::tree::stream_insertion_map_instance< " << poly_plate << ", " << stream << ", " << char_type << " > ().insert (s, *i);"; } @@ -313,13 +325,16 @@ namespace CXX if (poly) { os << "{" - << "const " << type << "& i (*x." << aname << " ());" - << "bool d (typeid (" << type << ") != typeid (i));" - << "s << d;" - << "if (!d)" << endl - << "s << i;" - << "else" << endl - << "::xsd::cxx::tree::stream_insertion_map_instance< " << + << "const " << type << "& i (*x." << aname << " ());"; + + if (!abst) + os << "bool d (typeid (" << type << ") != typeid (i));" + << "s << d;" + << "if (!d)" << endl + << "s << i;" + << "else" << endl; + + os << "::xsd::cxx::tree::stream_insertion_map_instance< " << poly_plate << ", " << stream << ", " << char_type << " > ().insert (s, i);" << "}"; @@ -337,13 +352,16 @@ namespace CXX if (poly) { os << "{" - << "const " << type << "& i (x." << aname << " ());" - << "bool d (typeid (" << type << ") != typeid (i));" - << "s << d;" - << "if (!d)" << endl - << "s << i;" - << "else" << endl - << "::xsd::cxx::tree::stream_insertion_map_instance< " << + << "const " << type << "& i (x." << aname << " ());"; + + if (!abst) + os << "bool d (typeid (" << type << ") != typeid (i));" + << "s << d;" + << "if (!d)" << endl + << "s << i;" + << "else" << endl; + + os << "::xsd::cxx::tree::stream_insertion_map_instance< " << poly_plate << ", " << stream << ", " << char_type << " > ().insert (s, i);" << "}"; |