diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-26 17:09:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-26 17:09:53 +0200 |
commit | e4c22d3686da0e973e21eae0561c1169c0eeff36 (patch) | |
tree | 0a49e9167edc88938b0287949080931314e8afea /xsde/cxx/hybrid/serializer-header.cxx | |
parent | 0d62005a3ff3b62d02c2eb3fd8644e0e19b202e8 (diff) |
Implement support for XML Schema polymorphism in C++/Hybrid
examples/cxx/hybrid/polyroot/
examples/cxx/hybrid/polymorphism/: new examples
tests/cxx/hybrid/polymorphism/: new tests
Diffstat (limited to 'xsde/cxx/hybrid/serializer-header.cxx')
-rw-r--r-- | xsde/cxx/hybrid/serializer-header.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xsde/cxx/hybrid/serializer-header.cxx b/xsde/cxx/hybrid/serializer-header.cxx index 20f4e15..db0578f 100644 --- a/xsde/cxx/hybrid/serializer-header.cxx +++ b/xsde/cxx/hybrid/serializer-header.cxx @@ -343,10 +343,40 @@ namespace CXX // // + struct PreOverride: Traversal::Complex, Context + { + PreOverride (Context& c) + : Context (c) + { + } + + virtual Void + traverse (SemanticGraph::Complex& c) + { + if (c.inherits_p ()) + { + SemanticGraph::Type& b (c.inherits ().base ()); + + if (polymorphic (b)) + { + if (tiein) + dispatch (b); + + os << "virtual void" << endl + << "pre (" << sarg_type (b) << ");" + << endl; + } + } + } + }; + + // + // struct Complex : Traversal::Complex, Context { Complex (Context& c) : Context (c), + pre_override_ (c), // State. // @@ -422,6 +452,9 @@ namespace CXX // pre // + if (polymorphic (c)) + pre_override_.dispatch (c); + os << "virtual void" << endl << "pre (" << arg << ");" << endl; @@ -522,6 +555,8 @@ namespace CXX } private: + PreOverride pre_override_; + // State. // CompositorState compositor_state_; |