From 3bf42ed8ccc93a3ff5fdabb9153b887018075acc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 19 Jan 2010 11:44:48 +0200 Subject: Add support for selective polymorphic in C++/Tree New options: --polymorphic-type, --polymorphic-type-all. --- xsd/cxx/tree/stream-insertion-source.cxx | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'xsd/cxx/tree/stream-insertion-source.cxx') diff --git a/xsd/cxx/tree/stream-insertion-source.cxx b/xsd/cxx/tree/stream-insertion-source.cxx index d7e721d..ae58dcc 100644 --- a/xsd/cxx/tree/stream-insertion-source.cxx +++ b/xsd/cxx/tree/stream-insertion-source.cxx @@ -60,7 +60,7 @@ namespace CXX // Register with type map. // - if (polymorphic && !l.context ().count ("anonymous")) + if (polymorphic && polymorphic_p (l) && !anonymous_p (l)) { // Note that we are using the original type name. // @@ -128,7 +128,7 @@ namespace CXX // Register with type map. // - if (polymorphic && !u.context ().count ("anonymous")) + if (polymorphic && polymorphic_p (u) && !anonymous_p (u)) { // Note that we are using the original type name. // @@ -187,7 +187,7 @@ namespace CXX // Register with type map. // - if (polymorphic && !e.context ().count ("anonymous")) + if (polymorphic && polymorphic_p (e) && !anonymous_p (e)) { // Note that we are using the original type name. // @@ -228,20 +228,12 @@ namespace CXX String type (scope + L"::" + etype (e)); // Figure out if we need to generate polymorphic code. If this - // elemen's type is anonymous or mapped to a fundamental C++ - // type then we don't need to do anything. Note that if the type - // is anonymous then it can't be derived from which makes it - // impossible to substitute or dynamically-type with xsi:type. + // elemen's type is anonymous then we don't need to do anything. + // Note that if the type is anonymous then it can't be derived + // from which makes it impossible to substitute or dynamically- + // type with xsi:type. // - Boolean poly (polymorphic && !t.context ().count ("anonymous")); - - if (poly) - { - Boolean fund (false); - IsFundamentalType traverser (fund); - traverser.dispatch (t); - poly = !fund; - } + Boolean poly (polymorphic && polymorphic_p (t) && !anonymous_p (t)); if (max (e) != 1) { @@ -416,7 +408,7 @@ namespace CXX // Register with type map. // - if (polymorphic && !c.context ().count ("anonymous")) + if (polymorphic && polymorphic_p (c) && !anonymous_p (c)) { // Note that we are using the original type name. // -- cgit v1.1