summaryrefslogtreecommitdiff
path: root/xsd/tests/cxx/tree/polymorphism
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/tests/cxx/tree/polymorphism')
-rw-r--r--xsd/tests/cxx/tree/polymorphism/comparison/driver.cxx7
-rw-r--r--xsd/tests/cxx/tree/polymorphism/comparison/makefile14
-rw-r--r--xsd/tests/cxx/tree/polymorphism/makefile3
-rw-r--r--xsd/tests/cxx/tree/polymorphism/ostream/driver.cxx7
-rw-r--r--xsd/tests/cxx/tree/polymorphism/ostream/makefile16
-rw-r--r--xsd/tests/cxx/tree/polymorphism/ostream/output5
-rw-r--r--xsd/tests/cxx/tree/polymorphism/ostream/test.xml13
-rw-r--r--xsd/tests/cxx/tree/polymorphism/ostream/test.xsd18
-rw-r--r--xsd/tests/cxx/tree/polymorphism/same-type/driver.cxx7
-rw-r--r--xsd/tests/cxx/tree/polymorphism/same-type/makefile14
10 files changed, 66 insertions, 38 deletions
diff --git a/xsd/tests/cxx/tree/polymorphism/comparison/driver.cxx b/xsd/tests/cxx/tree/polymorphism/comparison/driver.cxx
index 5e52e70..5394991 100644
--- a/xsd/tests/cxx/tree/polymorphism/comparison/driver.cxx
+++ b/xsd/tests/cxx/tree/polymorphism/comparison/driver.cxx
@@ -1,12 +1,11 @@
// file : tests/cxx/tree/polymorphism/comparison/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
// Test comparison of polymorphic object models.
//
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <iostream>
#include "test.hxx"
@@ -25,7 +24,7 @@ main (int argc, char* argv[])
try
{
- auto_ptr<type> r (root (argv[1]));
+ XSD_AUTO_PTR<type> r (root (argv[1]));
// Equals.
//
diff --git a/xsd/tests/cxx/tree/polymorphism/comparison/makefile b/xsd/tests/cxx/tree/polymorphism/comparison/makefile
index ad2c8ec..ef3e70a 100644
--- a/xsd/tests/cxx/tree/polymorphism/comparison/makefile
+++ b/xsd/tests/cxx/tree/polymorphism/comparison/makefile
@@ -1,6 +1,5 @@
# file : tests/cxx/tree/polymorphism/comparison/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
@@ -27,18 +26,18 @@ $(call import,\
#
$(driver): $(obj) $(xerces_c.l)
-$(obj) $(dep): cpp_options := -I$(src_root)/libxsd
+$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd
$(obj) $(dep): $(xerces_c.l.cpp-options)
genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx)
gen := $(addprefix $(out_base)/,$(genf))
$(gen): xsd := $(out_root)/xsd/xsd
-$(gen): xsd_options := --generate-polymorphic --polymorphic-type base \
+$(gen): xsd_options += --generate-polymorphic --polymorphic-type base \
--generate-comparison
$(gen): $(out_root)/xsd/xsd
-$(call include-dep,$(dep))
+$(call include-dep,$(dep),$(obj),$(gen))
# Convenience alias for default target.
#
@@ -75,7 +74,12 @@ endif
$(call include,$(bld_root)/cxx/o-e.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
$(call include,$(bld_root)/cxx/cxx-d.make)
+
+$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
+ifdef cxx_standard
+$(gen): xsd_options += --std $(cxx_standard)
$(call include,$(scf_root)/xsd/tree/xsd-cxx.make)
+endif
# Dependencies.
diff --git a/xsd/tests/cxx/tree/polymorphism/makefile b/xsd/tests/cxx/tree/polymorphism/makefile
index bca8f3f..9215e44 100644
--- a/xsd/tests/cxx/tree/polymorphism/makefile
+++ b/xsd/tests/cxx/tree/polymorphism/makefile
@@ -1,6 +1,5 @@
# file : tests/cxx/tree/polymorphism/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
diff --git a/xsd/tests/cxx/tree/polymorphism/ostream/driver.cxx b/xsd/tests/cxx/tree/polymorphism/ostream/driver.cxx
index 216c887..bfbd2d4 100644
--- a/xsd/tests/cxx/tree/polymorphism/ostream/driver.cxx
+++ b/xsd/tests/cxx/tree/polymorphism/ostream/driver.cxx
@@ -1,12 +1,11 @@
// file : tests/cxx/tree/polymorphism/ostream/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
// Test printing of polymorphic object models.
//
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <iostream>
#include "test.hxx"
@@ -25,7 +24,7 @@ main (int argc, char* argv[])
try
{
- auto_ptr<type> r (root (argv[1]));
+ XSD_AUTO_PTR<type> r (root (argv[1]));
cout << *r << endl;
}
catch (xml_schema::exception const& e)
diff --git a/xsd/tests/cxx/tree/polymorphism/ostream/makefile b/xsd/tests/cxx/tree/polymorphism/ostream/makefile
index 661ba16..76a366f 100644
--- a/xsd/tests/cxx/tree/polymorphism/ostream/makefile
+++ b/xsd/tests/cxx/tree/polymorphism/ostream/makefile
@@ -1,6 +1,5 @@
# file : tests/cxx/tree/polymorphism/ostream/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
@@ -27,18 +26,18 @@ $(call import,\
#
$(driver): $(obj) $(xerces_c.l)
-$(obj) $(dep): cpp_options := -I$(src_root)/libxsd
+$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd
$(obj) $(dep): $(xerces_c.l.cpp-options)
genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx)
gen := $(addprefix $(out_base)/,$(genf))
$(gen): xsd := $(out_root)/xsd/xsd
-$(gen): xsd_options := --generate-polymorphic --polymorphic-type-all \
---generate-ostream
+$(gen): xsd_options += --generate-polymorphic --polymorphic-type-all \
+--root-element root --generate-ostream
$(gen): $(out_root)/xsd/xsd
-$(call include-dep,$(dep))
+$(call include-dep,$(dep),$(obj),$(gen))
# Convenience alias for default target.
#
@@ -76,7 +75,12 @@ endif
$(call include,$(bld_root)/cxx/o-e.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
$(call include,$(bld_root)/cxx/cxx-d.make)
+
+$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
+ifdef cxx_standard
+$(gen): xsd_options += --std $(cxx_standard)
$(call include,$(scf_root)/xsd/tree/xsd-cxx.make)
+endif
# Dependencies.
diff --git a/xsd/tests/cxx/tree/polymorphism/ostream/output b/xsd/tests/cxx/tree/polymorphism/ostream/output
index bf0e814..e7fbd68 100644
--- a/xsd/tests/cxx/tree/polymorphism/ostream/output
+++ b/xsd/tests/cxx/tree/polymorphism/ostream/output
@@ -11,3 +11,8 @@ a: a
fund: 1
c: c1
c: c2
+base:
+a: a
+fund: 1
+d: d1
+d: d2
diff --git a/xsd/tests/cxx/tree/polymorphism/ostream/test.xml b/xsd/tests/cxx/tree/polymorphism/ostream/test.xml
index 157e15c..5409d2a 100644
--- a/xsd/tests/cxx/tree/polymorphism/ostream/test.xml
+++ b/xsd/tests/cxx/tree/polymorphism/ostream/test.xml
@@ -1,9 +1,10 @@
-<t:root xmlns:t="test"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="test test.xsd">
+<root xmlns="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
<base><a>a</a><fund>1</fund></base>
- <base xsi:type="t:derived1"><a>a</a><fund>1</fund><b>b</b></base>
- <base xsi:type="t:derived2"><a>a</a><fund>1</fund><c>c1</c><c>c2</c></base>
+ <base xsi:type="derived1"><a>a</a><fund>1</fund><b>b</b></base>
+ <base xsi:type="derived2"><a>a</a><fund>1</fund><c>c1</c><c>c2</c></base>
+ <derived3><a>a</a><fund>1</fund><d>d1</d><d>d2</d></derived3>
-</t:root>
+</root>
diff --git a/xsd/tests/cxx/tree/polymorphism/ostream/test.xsd b/xsd/tests/cxx/tree/polymorphism/ostream/test.xsd
index cc1f7a8..ddeaeae 100644
--- a/xsd/tests/cxx/tree/polymorphism/ostream/test.xsd
+++ b/xsd/tests/cxx/tree/polymorphism/ostream/test.xsd
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test"
+ targetNamespace="test" elementFormDefault="qualified">
<complexType name="base">
<sequence>
@@ -7,6 +8,7 @@
<element name="fund" type="int"/>
</sequence>
</complexType>
+ <element name="base" type="t:base"/>
<complexType name="derived1">
<complexContent>
@@ -28,9 +30,21 @@
</complexContent>
</complexType>
+ <element name="derived3" substitutionGroup="t:base">
+ <complexType>
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="d" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
<complexType name="type">
<sequence>
- <element name="base" type="t:base" maxOccurs="unbounded"/>
+ <element ref="t:base" maxOccurs="unbounded"/>
</sequence>
</complexType>
diff --git a/xsd/tests/cxx/tree/polymorphism/same-type/driver.cxx b/xsd/tests/cxx/tree/polymorphism/same-type/driver.cxx
index 441a742..0846b04 100644
--- a/xsd/tests/cxx/tree/polymorphism/same-type/driver.cxx
+++ b/xsd/tests/cxx/tree/polymorphism/same-type/driver.cxx
@@ -1,12 +1,11 @@
// file : tests/cxx/tree/polymorphism/same-type/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
// Test substitution group and xsi:type that don't change the type.
//
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <iostream>
#include "test.hxx"
@@ -25,7 +24,7 @@ main (int argc, char* argv[])
try
{
- auto_ptr<type> r (root (argv[1]));
+ XSD_AUTO_PTR<type> r (root (argv[1]));
cout << *r << endl;
}
diff --git a/xsd/tests/cxx/tree/polymorphism/same-type/makefile b/xsd/tests/cxx/tree/polymorphism/same-type/makefile
index c8e7bed..549f590 100644
--- a/xsd/tests/cxx/tree/polymorphism/same-type/makefile
+++ b/xsd/tests/cxx/tree/polymorphism/same-type/makefile
@@ -1,6 +1,5 @@
# file : tests/cxx/tree/polymorphism/same-type/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make
@@ -27,18 +26,18 @@ $(call import,\
#
$(driver): $(obj) $(xerces_c.l)
-$(obj) $(dep): cpp_options := -I$(src_root)/libxsd
+$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd
$(obj) $(dep): $(xerces_c.l.cpp-options)
genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx)
gen := $(addprefix $(out_base)/,$(genf))
$(gen): xsd := $(out_root)/xsd/xsd
-$(gen): xsd_options := --generate-ostream --generate-polymorphic \
+$(gen): xsd_options += --generate-ostream --generate-polymorphic \
--root-element root
$(gen): $(out_root)/xsd/xsd
-$(call include-dep,$(dep))
+$(call include-dep,$(dep),$(obj),$(gen))
# Convenience alias for default target.
#
@@ -75,7 +74,12 @@ endif
$(call include,$(bld_root)/cxx/o-e.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
$(call include,$(bld_root)/cxx/cxx-d.make)
+
+$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
+ifdef cxx_standard
+$(gen): xsd_options += --std $(cxx_standard)
$(call include,$(scf_root)/xsd/tree/xsd-cxx.make)
+endif
# Dependencies.