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. --- examples/cxx/tree/custom/taxonomy/README | 5 ++++- examples/cxx/tree/custom/taxonomy/makefile | 1 + .../cxx/tree/custom/taxonomy/people-custom.cxx | 23 ---------------------- .../cxx/tree/custom/taxonomy/people-custom.hxx | 6 ------ examples/cxx/tree/polymorphism/README | 6 +++++- 5 files changed, 10 insertions(+), 31 deletions(-) (limited to 'examples') diff --git a/examples/cxx/tree/custom/taxonomy/README b/examples/cxx/tree/custom/taxonomy/README index 356aef4..c2e425a 100644 --- a/examples/cxx/tree/custom/taxonomy/README +++ b/examples/cxx/tree/custom/taxonomy/README @@ -23,7 +23,10 @@ people.cxx object model. These are generated by XSD from people.xsd with the --custom-type option in order to customize the person, superman, and batman types. Generation of the people-fwd.hxx forward declaration - file is requested with the --generate-forward option. + file is requested with the --generate-forward option. Note also that + we use the --generate-polymorphic command line option as well as + --polymorphic-type to mark the type hierarchy starting with the + person type as polymorphic. people-custom-fwd.hxx Header file which forward-declares our own person, superman, and batman diff --git a/examples/cxx/tree/custom/taxonomy/makefile b/examples/cxx/tree/custom/taxonomy/makefile index 4ecb64a..ca3327c 100644 --- a/examples/cxx/tree/custom/taxonomy/makefile +++ b/examples/cxx/tree/custom/taxonomy/makefile @@ -44,6 +44,7 @@ $(gen): xsd_options := \ --generate-inline \ --generate-forward \ --generate-polymorphic \ +--polymorphic-type person \ --custom-type "person=person_impl/person_base" \ --custom-type "superman=superman_impl/superman_base" \ --custom-type "batman=batman_impl/batman_base" \ diff --git a/examples/cxx/tree/custom/taxonomy/people-custom.cxx b/examples/cxx/tree/custom/taxonomy/people-custom.cxx index 14c7087..321d2df 100644 --- a/examples/cxx/tree/custom/taxonomy/people-custom.cxx +++ b/examples/cxx/tree/custom/taxonomy/people-custom.cxx @@ -21,13 +21,6 @@ namespace people template person_impl:: - person_impl (std::auto_ptr& name) - : base (name) - { - } - - template - person_impl:: person_impl (const xercesc::DOMElement& e, xml_schema::flags f, xml_schema::container* c) @@ -74,13 +67,6 @@ namespace people template superman_impl:: - superman_impl (std::auto_ptr& name, bool can_fly) - : base (name, can_fly) - { - } - - template - superman_impl:: superman_impl (const xercesc::DOMElement& e, xml_schema::flags f, xml_schema::container* c) @@ -134,15 +120,6 @@ namespace people template batman_impl:: - batman_impl (std::auto_ptr& name, - bool can_fly, - unsigned int wing_span) - : base (name, can_fly, wing_span) - { - } - - template - batman_impl:: batman_impl (const xercesc::DOMElement& e, xml_schema::flags f, xml_schema::container* c) diff --git a/examples/cxx/tree/custom/taxonomy/people-custom.hxx b/examples/cxx/tree/custom/taxonomy/people-custom.hxx index 23e7731..c601061 100644 --- a/examples/cxx/tree/custom/taxonomy/people-custom.hxx +++ b/examples/cxx/tree/custom/taxonomy/people-custom.hxx @@ -23,7 +23,6 @@ namespace people { public: person_impl (const xml_schema::string& name); - person_impl (std::auto_ptr& name); person_impl (const xercesc::DOMElement&, xml_schema::flags = 0, @@ -50,7 +49,6 @@ namespace people { public: superman_impl (const xml_schema::string& name, bool can_fly); - superman_impl (std::auto_ptr& name, bool can_fly); superman_impl (const xercesc::DOMElement&, xml_schema::flags = 0, @@ -80,10 +78,6 @@ namespace people bool can_fly, unsigned int wing_span); - batman_impl (std::auto_ptr& name, - bool can_fly, - unsigned int wing_span); - batman_impl (const xercesc::DOMElement&, xml_schema::flags = 0, xml_schema::container* = 0); diff --git a/examples/cxx/tree/polymorphism/README b/examples/cxx/tree/polymorphism/README index 05d794f..6e54e49 100644 --- a/examples/cxx/tree/polymorphism/README +++ b/examples/cxx/tree/polymorphism/README @@ -15,7 +15,11 @@ supermen.cxx functions that convert XML instance documents to a tree-like in-memory object model, and a set of serialization functions that convert the object model back to XML. These are generated by XSD from supermen.xsd. - Note the use of the --generate-polymorphic command line option. + Note also that we use the --generate-polymorphic command line option + and that we don't need to use --polymorphic-type to explicitly mark + types as polymorphic because this is automatically deduced by the + XSD compiler from the substitution groups used in the supermen.xsd + schema. driver.cxx Driver for the example. It first calls one of the parsing functions -- cgit v1.1