summaryrefslogtreecommitdiff
path: root/examples/cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-01-19 11:44:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-01-19 11:44:48 +0200
commit3bf42ed8ccc93a3ff5fdabb9153b887018075acc (patch)
tree19608b70275324a6e49f7f013ddff912b26128d4 /examples/cxx
parent4257e28e3bbb92042f5a1db05eba17d7b2a3b151 (diff)
Add support for selective polymorphic in C++/Tree
New options: --polymorphic-type, --polymorphic-type-all.
Diffstat (limited to 'examples/cxx')
-rw-r--r--examples/cxx/tree/custom/taxonomy/README5
-rw-r--r--examples/cxx/tree/custom/taxonomy/makefile1
-rw-r--r--examples/cxx/tree/custom/taxonomy/people-custom.cxx23
-rw-r--r--examples/cxx/tree/custom/taxonomy/people-custom.hxx6
-rw-r--r--examples/cxx/tree/polymorphism/README6
5 files changed, 10 insertions, 31 deletions
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>/person_base" \
--custom-type "superman=superman_impl<superman_base>/superman_base" \
--custom-type "batman=batman_impl<batman_base>/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 <typename base>
person_impl<base>::
- person_impl (std::auto_ptr<xml_schema::string>& name)
- : base (name)
- {
- }
-
- template <typename base>
- person_impl<base>::
person_impl (const xercesc::DOMElement& e,
xml_schema::flags f,
xml_schema::container* c)
@@ -74,13 +67,6 @@ namespace people
template <typename base>
superman_impl<base>::
- superman_impl (std::auto_ptr<xml_schema::string>& name, bool can_fly)
- : base (name, can_fly)
- {
- }
-
- template <typename base>
- superman_impl<base>::
superman_impl (const xercesc::DOMElement& e,
xml_schema::flags f,
xml_schema::container* c)
@@ -134,15 +120,6 @@ namespace people
template <typename base>
batman_impl<base>::
- batman_impl (std::auto_ptr<xml_schema::string>& name,
- bool can_fly,
- unsigned int wing_span)
- : base (name, can_fly, wing_span)
- {
- }
-
- template <typename base>
- batman_impl<base>::
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<xml_schema::string>& 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<xml_schema::string>& 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<xml_schema::string>& 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