From 0fdf19714613a82a184f4f6e75fb9a4f9b62f18a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 19 Jan 2014 10:05:08 +0200 Subject: Use std::unique_ptr instead of std::auto_ptr in C++11 mode --- tests/cxx/tree/binary/cdr/driver.cxx | 6 +- tests/cxx/tree/binary/cdr/makefile | 5 ++ tests/cxx/tree/binary/polymorphic/driver.cxx | 6 +- tests/cxx/tree/binary/polymorphic/makefile | 5 ++ tests/cxx/tree/binary/xdr/driver.cxx | 6 +- tests/cxx/tree/binary/xdr/makefile | 5 ++ tests/cxx/tree/built-in/driver.cxx | 19 +++-- tests/cxx/tree/built-in/makefile | 5 ++ tests/cxx/tree/chameleon/driver.cxx | 4 +- tests/cxx/tree/chameleon/makefile | 5 ++ tests/cxx/tree/comparison/driver.cxx | 4 +- tests/cxx/tree/comparison/makefile | 5 ++ tests/cxx/tree/compilation/driver.cxx | 1 - tests/cxx/tree/compilation/makefile | 5 ++ tests/cxx/tree/complex/ctor/driver.cxx | 50 ++++++----- tests/cxx/tree/complex/ctor/makefile | 6 +- tests/cxx/tree/containment/driver.cxx | 45 +++++----- tests/cxx/tree/containment/makefile | 5 ++ tests/cxx/tree/default/general/driver.cxx | 4 +- tests/cxx/tree/default/general/makefile | 5 ++ tests/cxx/tree/default/omit/driver.cxx | 4 +- tests/cxx/tree/default/omit/makefile | 5 ++ tests/cxx/tree/detach/driver.cxx | 23 +++-- tests/cxx/tree/detach/makefile | 5 ++ tests/cxx/tree/dom-association/dom-parse.cxx | 97 ++++++++++++++++++++++ tests/cxx/tree/dom-association/dom-parse.hxx | 25 ++++++ tests/cxx/tree/dom-association/driver.cxx | 73 ++++++++++++++++ tests/cxx/tree/dom-association/makefile | 93 +++++++++++++++++++++ tests/cxx/tree/dom-association/output | 0 tests/cxx/tree/dom-association/test.xml | 7 ++ tests/cxx/tree/dom-association/test.xsd | 12 +++ tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx | 4 +- tests/cxx/tree/encoding/char/iso-8859-1/makefile | 5 ++ tests/cxx/tree/encoding/char/lcp/driver.cxx | 4 +- tests/cxx/tree/encoding/char/lcp/makefile | 5 ++ tests/cxx/tree/encoding/char/utf-8/driver.cxx | 4 +- tests/cxx/tree/encoding/char/utf-8/makefile | 5 ++ tests/cxx/tree/encoding/wchar/driver.cxx | 4 +- tests/cxx/tree/encoding/wchar/makefile | 5 ++ tests/cxx/tree/enumeration/ctor/makefile | 5 ++ tests/cxx/tree/enumeration/inheritance/driver.cxx | 4 +- tests/cxx/tree/enumeration/inheritance/makefile | 5 ++ tests/cxx/tree/float/driver.cxx | 4 +- tests/cxx/tree/float/makefile | 5 ++ tests/cxx/tree/list/ctor/makefile | 5 ++ tests/cxx/tree/makefile | 41 ++++----- tests/cxx/tree/name-clash/inheritance/driver.cxx | 4 +- tests/cxx/tree/name-clash/inheritance/makefile | 5 ++ tests/cxx/tree/naming/camel/driver.cxx | 1 - tests/cxx/tree/naming/camel/makefile | 5 ++ tests/cxx/tree/naming/java/driver.cxx | 1 - tests/cxx/tree/naming/java/makefile | 5 ++ tests/cxx/tree/naming/knr/driver.cxx | 1 - tests/cxx/tree/naming/knr/makefile | 5 ++ tests/cxx/tree/polymorphism/comparison/driver.cxx | 4 +- tests/cxx/tree/polymorphism/comparison/makefile | 5 ++ tests/cxx/tree/polymorphism/ostream/driver.cxx | 4 +- tests/cxx/tree/polymorphism/ostream/makefile | 5 ++ tests/cxx/tree/polymorphism/same-type/driver.cxx | 4 +- tests/cxx/tree/polymorphism/same-type/makefile | 5 ++ tests/cxx/tree/prefix/driver.cxx | 4 +- tests/cxx/tree/prefix/makefile | 5 ++ tests/cxx/tree/test-template/driver.cxx | 4 +- tests/cxx/tree/test-template/makefile | 5 ++ tests/cxx/tree/types-only/driver.cxx | 1 - tests/cxx/tree/types-only/makefile | 5 ++ tests/cxx/tree/union/ctor/makefile | 5 ++ tests/cxx/tree/wildcard/driver.cxx | 10 +-- tests/cxx/tree/wildcard/makefile | 5 ++ 69 files changed, 617 insertions(+), 126 deletions(-) create mode 100644 tests/cxx/tree/dom-association/dom-parse.cxx create mode 100644 tests/cxx/tree/dom-association/dom-parse.hxx create mode 100644 tests/cxx/tree/dom-association/driver.cxx create mode 100644 tests/cxx/tree/dom-association/makefile create mode 100644 tests/cxx/tree/dom-association/output create mode 100644 tests/cxx/tree/dom-association/test.xml create mode 100644 tests/cxx/tree/dom-association/test.xsd (limited to 'tests/cxx/tree') diff --git a/tests/cxx/tree/binary/cdr/driver.cxx b/tests/cxx/tree/binary/cdr/driver.cxx index 012c2cf..9980579 100644 --- a/tests/cxx/tree/binary/cdr/driver.cxx +++ b/tests/cxx/tree/binary/cdr/driver.cxx @@ -6,7 +6,7 @@ // Test non-polymorphic binary serialization to ACE CDR. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include @@ -26,7 +26,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); // Save to a CDR stream. // @@ -38,7 +38,7 @@ main (int argc, char* argv[]) // ACE_InputCDR ace_icdr (ace_ocdr); xml_schema::istream icdr (ace_icdr); - auto_ptr c (new type (icdr)); + XSD_AUTO_PTR c (new type (icdr)); // Compare the two. // diff --git a/tests/cxx/tree/binary/cdr/makefile b/tests/cxx/tree/binary/cdr/makefile index 0fce1e9..c77a026 100644 --- a/tests/cxx/tree/binary/cdr/makefile +++ b/tests/cxx/tree/binary/cdr/makefile @@ -78,7 +78,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/tests/cxx/tree/binary/polymorphic/driver.cxx b/tests/cxx/tree/binary/polymorphic/driver.cxx index 8aff63c..5c82b17 100644 --- a/tests/cxx/tree/binary/polymorphic/driver.cxx +++ b/tests/cxx/tree/binary/polymorphic/driver.cxx @@ -6,7 +6,7 @@ // Test polymorphic binary serialization. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include #include @@ -29,7 +29,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); // Save to a CDR stream. // @@ -54,7 +54,7 @@ main (int argc, char* argv[]) // ACE_InputCDR ace_icdr (ace_ocdr); xml_schema::istream icdr (ace_icdr); - auto_ptr c (new type (icdr)); + XSD_AUTO_PTR c (new type (icdr)); // Compare the two. // diff --git a/tests/cxx/tree/binary/polymorphic/makefile b/tests/cxx/tree/binary/polymorphic/makefile index e3abe50..dc01b6a 100644 --- a/tests/cxx/tree/binary/polymorphic/makefile +++ b/tests/cxx/tree/binary/polymorphic/makefile @@ -78,7 +78,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/tests/cxx/tree/binary/xdr/driver.cxx b/tests/cxx/tree/binary/xdr/driver.cxx index 9c1e3c2..0448240 100644 --- a/tests/cxx/tree/binary/xdr/driver.cxx +++ b/tests/cxx/tree/binary/xdr/driver.cxx @@ -6,7 +6,7 @@ // Test non-polymorphic binary serialization to XDR. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::memcpy #include #include @@ -59,7 +59,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); // Save to an XDR stream. // @@ -81,7 +81,7 @@ main (int argc, char* argv[]) xdr.x_op = XDR_DECODE; xdrrec_skiprecord (&xdr); xsd::cxx::tree::istream ixdr (xdr); - auto_ptr c (new type (ixdr)); + XSD_AUTO_PTR c (new type (ixdr)); xdr_destroy (&xdr); // Compare the two. diff --git a/tests/cxx/tree/binary/xdr/makefile b/tests/cxx/tree/binary/xdr/makefile index 476690b..f846b66 100644 --- a/tests/cxx/tree/binary/xdr/makefile +++ b/tests/cxx/tree/binary/xdr/makefile @@ -73,7 +73,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/tests/cxx/tree/built-in/driver.cxx b/tests/cxx/tree/built-in/driver.cxx index fee634a..f1d02a5 100644 --- a/tests/cxx/tree/built-in/driver.cxx +++ b/tests/cxx/tree/built-in/driver.cxx @@ -6,7 +6,7 @@ // Test built-in type mapping. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include @@ -15,7 +15,6 @@ using std::cerr; using std::endl; -using std::auto_ptr; int main (int argc, char* argv[]) @@ -26,12 +25,13 @@ main (int argc, char* argv[]) return 1; } - auto_ptr elements (xmlns::test::elements (argv[1])); + XSD_AUTO_PTR elements ( + xmlns::test::elements (argv[1])); - auto_ptr attributes ( + XSD_AUTO_PTR attributes ( xmlns::test::attributes (argv[2])); - auto_ptr inherited ( + XSD_AUTO_PTR inherited ( xmlns::test::inherited (argv[3])); cerr << "elements: " << *elements << endl @@ -53,13 +53,14 @@ main (int argc, char* argv[]) xmlns::test::elements (ostr, *elements, map); std::istringstream istr (ostr.str ()); - auto_ptr elements1 (xmlns::test::elements (istr)); + XSD_AUTO_PTR elements1 ( + xmlns::test::elements (istr)); std::ostringstream ostr1; xmlns::test::elements (ostr1, *elements1, map); if (ostr.str () != ostr1.str ()) - return 1; + return 1; } { @@ -67,7 +68,7 @@ main (int argc, char* argv[]) xmlns::test::attributes (ostr, *attributes, map); std::istringstream istr (ostr.str ()); - auto_ptr attributes1 ( + XSD_AUTO_PTR attributes1 ( xmlns::test::attributes (istr)); std::ostringstream ostr1; @@ -82,7 +83,7 @@ main (int argc, char* argv[]) xmlns::test::inherited (ostr, *inherited, map); std::istringstream istr (ostr.str ()); - auto_ptr inherited1 ( + XSD_AUTO_PTR inherited1 ( xmlns::test::inherited (istr)); std::ostringstream ostr1; diff --git a/tests/cxx/tree/built-in/makefile b/tests/cxx/tree/built-in/makefile index ad8aba1..b94930f 100644 --- a/tests/cxx/tree/built-in/makefile +++ b/tests/cxx/tree/built-in/makefile @@ -89,7 +89,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/tests/cxx/tree/chameleon/driver.cxx b/tests/cxx/tree/chameleon/driver.cxx index 1627144..8dc7bff 100644 --- a/tests/cxx/tree/chameleon/driver.cxx +++ b/tests/cxx/tree/chameleon/driver.cxx @@ -6,7 +6,7 @@ // Test chameleon inclusion. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "includer.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); cout << *r << endl; } diff --git a/tests/cxx/tree/chameleon/makefile b/tests/cxx/tree/chameleon/makefile index 77eab9b..6dc2f3f 100644 --- a/tests/cxx/tree/chameleon/makefile +++ b/tests/cxx/tree/chameleon/makefile @@ -74,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/tests/cxx/tree/comparison/driver.cxx b/tests/cxx/tree/comparison/driver.cxx index f6480bb..41e91a9 100644 --- a/tests/cxx/tree/comparison/driver.cxx +++ b/tests/cxx/tree/comparison/driver.cxx @@ -6,7 +6,7 @@ // Test generated comparison operators. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); type::complex_sequence s (r->complex ()); diff --git a/tests/cxx/tree/comparison/makefile b/tests/cxx/tree/comparison/makefile index 0ed2dd7..b88389c 100644 --- a/tests/cxx/tree/comparison/makefile +++ b/tests/cxx/tree/comparison/makefile @@ -74,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/tests/cxx/tree/compilation/driver.cxx b/tests/cxx/tree/compilation/driver.cxx index 060bf2c..71e58bc 100644 --- a/tests/cxx/tree/compilation/driver.cxx +++ b/tests/cxx/tree/compilation/driver.cxx @@ -7,7 +7,6 @@ // all the types. // -#include // std::auto_ptr #include #include "test.hxx" diff --git a/tests/cxx/tree/compilation/makefile b/tests/cxx/tree/compilation/makefile index 6c4ebd8..4d3161b 100644 --- a/tests/cxx/tree/compilation/makefile +++ b/tests/cxx/tree/compilation/makefile @@ -74,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/tests/cxx/tree/complex/ctor/driver.cxx b/tests/cxx/tree/complex/ctor/driver.cxx index ea9695d..2adeec4 100644 --- a/tests/cxx/tree/complex/ctor/driver.cxx +++ b/tests/cxx/tree/complex/ctor/driver.cxx @@ -11,6 +11,13 @@ #include "test.hxx" +#ifdef XSD_CXX11 +# include // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + using namespace std; using namespace test; @@ -64,12 +71,12 @@ main () // e_base b1 (1, "foo", e_complex_type ("bar")); - auto_ptr c2 (new e_complex_type ("bar")); - e_base b2 (1, "foo", c2); + XSD_AUTO_PTR c2 (new e_complex_type ("bar")); + e_base b2 (1, "foo", XSD_MOVE (c2)); - auto_ptr s3 (new e_simple_type ("foo")); - auto_ptr c3 (new e_complex_type ("bar")); - e_base b3 (1, s3, c3); + XSD_AUTO_PTR s3 (new e_simple_type ("foo")); + XSD_AUTO_PTR c3 (new e_complex_type ("bar")); + e_base b3 (1, XSD_MOVE (s3), XSD_MOVE (c3)); assert (b1 == b2); assert (b1 == b3); @@ -79,15 +86,20 @@ main () e_derived d1 (1, "foo", e_complex_type ("bar"), true, "baz", e_complex_type ("biz")); - auto_ptr c2a (new e_complex_type ("bar")); - auto_ptr c2b (new e_complex_type ("biz")); - e_derived d2 (1, "foo", c2a, true, "baz", c2b); - - auto_ptr s3a (new e_simple_type ("foo")); - auto_ptr s3b (new xml_schema::string ("baz")); - auto_ptr c3a (new e_complex_type ("bar")); - auto_ptr c3b (new e_complex_type ("biz")); - e_derived d3 (1, s3a, c3a, true, s3b, c3b); + XSD_AUTO_PTR c2a (new e_complex_type ("bar")); + XSD_AUTO_PTR c2b (new e_complex_type ("biz")); + e_derived d2 (1, "foo", XSD_MOVE (c2a), true, "baz", XSD_MOVE (c2b)); + + XSD_AUTO_PTR s3a (new e_simple_type ("foo")); + XSD_AUTO_PTR s3b (new xml_schema::string ("baz")); + XSD_AUTO_PTR c3a (new e_complex_type ("bar")); + XSD_AUTO_PTR c3b (new e_complex_type ("biz")); + e_derived d3 (1, + XSD_MOVE (s3a), + XSD_MOVE (c3a), + true, + XSD_MOVE (s3b), + XSD_MOVE (c3b)); assert (d1 == d2); assert (d1 == d3); @@ -99,12 +111,12 @@ main () { f_type f1 (xml_schema::type (), 1, "foo", f_complex_type ("bar")); - auto_ptr c2 (new f_complex_type ("bar")); - f_type f2 (1, "foo", c2); + XSD_AUTO_PTR c2 (new f_complex_type ("bar")); + f_type f2 (1, "foo", XSD_MOVE (c2)); - auto_ptr s3 (new f_simple_type ("foo")); - auto_ptr c3 (new f_complex_type ("bar")); - f_type f3 (1, s3, c3); + XSD_AUTO_PTR s3 (new f_simple_type ("foo")); + XSD_AUTO_PTR c3 (new f_complex_type ("bar")); + f_type f3 (1, XSD_MOVE (s3), XSD_MOVE (c3)); assert (f1 == f2); assert (f1 == f3); diff --git a/tests/cxx/tree/complex/ctor/makefile b/tests/cxx/tree/complex/ctor/makefile index 6408105..1b0bc11 100644 --- a/tests/cxx/tree/complex/ctor/makefile +++ b/tests/cxx/tree/complex/ctor/makefile @@ -76,8 +76,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,$(scf_root)/xsd/tree/xsd-cxx.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/tests/cxx/tree/containment/driver.cxx b/tests/cxx/tree/containment/driver.cxx index ac798a6..aa701ae 100644 --- a/tests/cxx/tree/containment/driver.cxx +++ b/tests/cxx/tree/containment/driver.cxx @@ -6,11 +6,18 @@ // Test tree node containment. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" +#ifdef XSD_CXX11 +# include // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + using namespace std; using namespace test; @@ -20,11 +27,11 @@ main () // Change of a container in a sub-tree without ID. // { - auto_ptr i (new inner ()); + XSD_AUTO_PTR i (new inner ()); i->ref ("foo"); outer o; - o.i (i); + o.i (XSD_MOVE (i)); o.ref ("foo"); assert (o.i ()->ref ()->get () == 0); @@ -34,14 +41,14 @@ main () // Change of container in a sub-tree with ID inside. // { - auto_ptr i (new inner ()); + XSD_AUTO_PTR i (new inner ()); inner* p (i.get ()); i->id ("foo"); i->ref ("foo"); assert (i->ref ()->get () == p); outer o; - o.i (i); + o.i (XSD_MOVE (i)); o.ref ("foo"); assert (o.i ()->ref ()->get () == p); @@ -51,10 +58,10 @@ main () // Change of a container in ID. // { - auto_ptr id (new xml_schema::id ("foo")); + XSD_AUTO_PTR id (new xml_schema::id ("foo")); inner i; - i.id (id); + i.id (XSD_MOVE (id)); i.ref ("foo"); assert (i.ref ()->get () == &i); } @@ -62,12 +69,12 @@ main () // Change of a container in a type derived from ID with ID inside. // { - auto_ptr id (new id_ex ("foo")); + XSD_AUTO_PTR id (new id_ex ("foo")); id_ex* p (id.get ()); id->id ("bar"); inner i; - i.id_ex (id); + i.id_ex (XSD_MOVE (id)); i.ref ("foo"); assert (i.ref ()->get () == &i); @@ -81,28 +88,28 @@ main () { id i1 ("a"), i2 ("b"); - auto_ptr ic (new ids); + XSD_AUTO_PTR ic (new ids); ic->id ().push_back (i1); ic->id ().push_back (i2); - auto_ptr r1 (new xml_schema::idrefs); + XSD_AUTO_PTR r1 (new xml_schema::idrefs); r1->push_back (xml_schema::idref ("a")); r1->push_back (xml_schema::idref ("b")); - auto_ptr r2 (new idref_list); + XSD_AUTO_PTR r2 (new idref_list); r2->push_back (xml_schema::idref ("a")); r2->push_back (xml_schema::idref ("b")); - auto_ptr rc1 (new idrefs1); - auto_ptr rc2 (new idrefs2); + XSD_AUTO_PTR rc1 (new idrefs1); + XSD_AUTO_PTR rc2 (new idrefs2); - rc1->idrefs (r1); - rc2->idrefs (r2); + rc1->idrefs (XSD_MOVE (r1)); + rc2->idrefs (XSD_MOVE (r2)); model m; - m.ids (ic); - m.idrefs1 (rc1); - m.idrefs2 (rc2); + m.ids (XSD_MOVE (ic)); + m.idrefs1 (XSD_MOVE (rc1)); + m.idrefs2 (XSD_MOVE (rc2)); assert (m.idrefs1 ().idrefs ()[0].get () != 0); assert (m.idrefs1 ().idrefs ()[1].get () != 0); diff --git a/tests/cxx/tree/containment/makefile b/tests/cxx/tree/containment/makefile index fb239c4..ba34bdd 100644 --- a/tests/cxx/tree/containment/makefile +++ b/tests/cxx/tree/containment/makefile @@ -74,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/tests/cxx/tree/default/general/driver.cxx b/tests/cxx/tree/default/general/driver.cxx index e9e5528..4c9cfc4 100644 --- a/tests/cxx/tree/default/general/driver.cxx +++ b/tests/cxx/tree/default/general/driver.cxx @@ -6,7 +6,7 @@ // Test default attribute/element values. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1], xml_schema::flags::dont_validate)); + XSD_AUTO_PTR r (root (argv[1], xml_schema::flags::dont_validate)); xml_schema::namespace_infomap map; map["t"].name = "test"; diff --git a/tests/cxx/tree/default/general/makefile b/tests/cxx/tree/default/general/makefile index 432c56c..045f085 100644 --- a/tests/cxx/tree/default/general/makefile +++ b/tests/cxx/tree/default/general/makefile @@ -75,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/tests/cxx/tree/default/omit/driver.cxx b/tests/cxx/tree/default/omit/driver.cxx index f01ce1a..84c30ce 100644 --- a/tests/cxx/tree/default/omit/driver.cxx +++ b/tests/cxx/tree/default/omit/driver.cxx @@ -6,7 +6,7 @@ // Test default attribute omission from the output. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1], xml_schema::flags::dont_validate)); + XSD_AUTO_PTR r (root (argv[1], xml_schema::flags::dont_validate)); cout << *r << endl << "default x: " << derived::x_default_value () << endl diff --git a/tests/cxx/tree/default/omit/makefile b/tests/cxx/tree/default/omit/makefile index 4b3b61e..710ab48 100644 --- a/tests/cxx/tree/default/omit/makefile +++ b/tests/cxx/tree/default/omit/makefile @@ -75,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/tests/cxx/tree/detach/driver.cxx b/tests/cxx/tree/detach/driver.cxx index 8317ac4..e752c13 100644 --- a/tests/cxx/tree/detach/driver.cxx +++ b/tests/cxx/tree/detach/driver.cxx @@ -6,17 +6,26 @@ // Test the detach functionality. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" +#ifdef XSD_CXX11 +# include // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + using namespace std; using namespace test; int main () { + using test::ref; + // Construct the model. // object o1 ("o1"); @@ -57,22 +66,22 @@ main () // Detach one. // - auto_ptr p (m.detach_one ()); + XSD_AUTO_PTR p (m.detach_one ()); assert (p->_container () == 0); assert (p->r ()[0].get () == &p->o ()[1]); assert (m.opt ()->r ()[1].get () == 0); - m.one (p); + m.one (XSD_MOVE (p)); assert (m.opt ()->r ()[1].get () == &m.one ().o ()[0]); p = m.detach_one (); model m1; - m1.one (p); + m1.one (XSD_MOVE (p)); m1.opt (s2); assert (m1.opt ()->r ()[1].get () == &m1.one ().o ()[0]); p = m1.detach_one (); - m.seq ().push_back (p); + m.seq ().push_back (XSD_MOVE (p)); // Detach opt. // @@ -82,7 +91,7 @@ main () assert (p->r ()[0].get () == &p->o ()[1]); assert (m.seq ()[0].r ()[1].get () == 0); - m.seq ().push_back (p); + m.seq ().push_back (XSD_MOVE (p)); // Detach seq. // @@ -91,7 +100,7 @@ main () assert (p->r ()[0].get () == &p->o ()[1]); assert (m.seq ()[0].r ()[1].get () == 0); - m.seq ().push_back (p); + m.seq ().push_back (XSD_MOVE (p)); assert (m.seq ()[0].r ()[1].get () == &m.seq ()[1].o ()[0]); m.seq ().detach (m.seq ().begin (), p); diff --git a/tests/cxx/tree/detach/makefile b/tests/cxx/tree/detach/makefile index 7689898..cf85a7a 100644 --- a/tests/cxx/tree/detach/makefile +++ b/tests/cxx/tree/detach/makefile @@ -74,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/tests/cxx/tree/dom-association/dom-parse.cxx b/tests/cxx/tree/dom-association/dom-parse.cxx new file mode 100644 index 0000000..c21a47f --- /dev/null +++ b/tests/cxx/tree/dom-association/dom-parse.cxx @@ -0,0 +1,97 @@ +// file : tests/cxx/tree/dom-association/dom-parse.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include "dom-parse.hxx" + +#include + +#include +#include // chLatin_* +#include + +#include +#include + +#include +#include + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +XSD_DOM_AUTO_PTR +parse (std::istream& is, + const std::string& id, + bool validate) +{ + const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull}; + + // Get an implementation of the Load-Store (LS) interface. + // + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation (ls_id)); + + XSD_DOM_AUTO_PTR parser ( + impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + DOMConfiguration* conf (parser->getDomConfig ()); + + // Discard comment nodes in the document. + // + conf->setParameter (XMLUni::fgDOMComments, false); + + // Enable datatype normalization. + // + conf->setParameter (XMLUni::fgDOMDatatypeNormalization, true); + + // Do not create EntityReference nodes in the DOM tree. No + // EntityReference nodes will be created, only the nodes + // corresponding to their fully expanded substitution text + // will be created. + // + conf->setParameter (XMLUni::fgDOMEntities, false); + + // Perform namespace processing. + // + conf->setParameter (XMLUni::fgDOMNamespaces, true); + + // Do not include ignorable whitespace in the DOM tree. + // + conf->setParameter (XMLUni::fgDOMElementContentWhitespace, false); + + // Enable/Disable validation. + // + conf->setParameter (XMLUni::fgDOMValidate, validate); + conf->setParameter (XMLUni::fgXercesSchema, validate); + conf->setParameter (XMLUni::fgXercesSchemaFullChecking, false); + + // Xerces-C++ 3.1.0 is the first version with working multi import + // support. + // +#if _XERCES_VERSION >= 30100 + conf->setParameter (XMLUni::fgXercesHandleMultipleImports, true); +#endif + + // We will release the DOM document ourselves. + // + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + // Set error handler. + // + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + + // Prepare input stream. + // + xml::sax::std_input_source isrc (is, id); + Wrapper4InputSource wrap (&isrc, false); + + XSD_DOM_AUTO_PTR doc (parser->parse (&wrap)); + + eh.throw_if_failed > (); + + return doc; +} diff --git a/tests/cxx/tree/dom-association/dom-parse.hxx b/tests/cxx/tree/dom-association/dom-parse.hxx new file mode 100644 index 0000000..75a5e8b --- /dev/null +++ b/tests/cxx/tree/dom-association/dom-parse.hxx @@ -0,0 +1,25 @@ +// file : tests/cxx/tree/dom-association/dom-parse.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef DOM_PARSE +#define DOM_PARSE + +#include +#include + +#include + +#include + +// Parse an XML document from the standard input stream with an +// optional resource id. Resource id is used in diagnostics as +// well as to locate schemas referenced from inside the document. +// +XSD_DOM_AUTO_PTR +parse (std::istream& is, + const std::string& id, + bool validate); + +#endif // DOM_PARSE diff --git a/tests/cxx/tree/dom-association/driver.cxx b/tests/cxx/tree/dom-association/driver.cxx new file mode 100644 index 0000000..d0fd33b --- /dev/null +++ b/tests/cxx/tree/dom-association/driver.cxx @@ -0,0 +1,73 @@ +// file : tests/cxx/tree/dom-association/driver.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test DOM association/ownership. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include + +#include "dom-parse.hxx" +#include "test.hxx" + +using namespace std; +using namespace test; +using namespace xercesc; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + int r (0); + + XMLPlatformUtils::Initialize (); + + try + { + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + DOMDocument* ptr; + +#ifdef XSD_CXX11 + xml_schema::dom::unique_ptr doc (parse (ifs, argv[1], true)); + ptr = doc.get (); + unique_ptr r ( + root (std::move (doc), + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); +#else + xml_schema::dom::auto_ptr doc (parse (ifs, argv[1], true)); + ptr = doc.get (); + auto_ptr r ( + root (doc, + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); +#endif + + assert (doc.get () == 0); + assert (r->_node ()->getOwnerDocument () == ptr); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + r = 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[1] << ": unable to open or read failure" << endl; + r = 1; + } + + XMLPlatformUtils::Terminate (); + return r; +} diff --git a/tests/cxx/tree/dom-association/makefile b/tests/cxx/tree/dom-association/makefile new file mode 100644 index 0000000..a57e5b1 --- /dev/null +++ b/tests/cxx/tree/dom-association/makefile @@ -0,0 +1,93 @@ +# file : tests/cxx/tree/dom-association/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make + +xsd := test.xsd +cxx := driver.cxx dom-parse.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +test := $(out_base)/.test +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +# Define XSD_CXX11 since we include libxsd headers directly. +# +$(call include,$(bld_root)/cxx/standard.make) # cxx_standard +ifeq ($(cxx_standard),c++11) +$(obj) $(dep): cpp_options += -DXSD_CXX11 +endif + +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 +$(gen): $(out_root)/xsd/xsd + +$(call include-dep,$(dep),$(obj),$(gen)) + +# Convenience alias for default target. +# +$(out_base)/: $(driver) + + +# Test. +# +$(test): driver := $(driver) +$(test): $(driver) $(src_base)/test.xml $(src_base)/output + $(call message,test $$1,$$1 $(src_base)/test.xml | diff -u $(src_base)/output -,$(driver)) + +# Clean. +# +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(gen): | $(out_base)/.gitignore +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := driver $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + +# How to. +# +$(call include,$(bld_root)/cxx/o-e.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/cxx-d.make) + +ifdef cxx_standard +$(gen): xsd_options += --std $(cxx_standard) +$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) +endif + + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/tests/cxx/tree/dom-association/output b/tests/cxx/tree/dom-association/output new file mode 100644 index 0000000..e69de29 diff --git a/tests/cxx/tree/dom-association/test.xml b/tests/cxx/tree/dom-association/test.xml new file mode 100644 index 0000000..624a80c --- /dev/null +++ b/tests/cxx/tree/dom-association/test.xml @@ -0,0 +1,7 @@ + + + a + + diff --git a/tests/cxx/tree/dom-association/test.xsd b/tests/cxx/tree/dom-association/test.xsd new file mode 100644 index 0000000..07bebc7 --- /dev/null +++ b/tests/cxx/tree/dom-association/test.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx b/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx index b134da2..591d73f 100644 --- a/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx +++ b/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx @@ -6,7 +6,7 @@ // Test ISO-8859-1 encoding. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include @@ -36,7 +36,7 @@ main (int argc, char* argv[]) } xsd::cxx::xml::char_transcoder::unrep_char ('?'); - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); { type::a_sequence const& s (r->a ()); diff --git a/tests/cxx/tree/encoding/char/iso-8859-1/makefile b/tests/cxx/tree/encoding/char/iso-8859-1/makefile index 00257fd..8708b49 100644 --- a/tests/cxx/tree/encoding/char/iso-8859-1/makefile +++ b/tests/cxx/tree/encoding/char/iso-8859-1/makefile @@ -75,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/tests/cxx/tree/encoding/char/lcp/driver.cxx b/tests/cxx/tree/encoding/char/lcp/driver.cxx index c33ba27..456dc09 100644 --- a/tests/cxx/tree/encoding/char/lcp/driver.cxx +++ b/tests/cxx/tree/encoding/char/lcp/driver.cxx @@ -7,7 +7,7 @@ // The test just makes sure it still compiles and works. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include @@ -27,7 +27,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); xml_schema::namespace_infomap map; map["t"].name = "test"; diff --git a/tests/cxx/tree/encoding/char/lcp/makefile b/tests/cxx/tree/encoding/char/lcp/makefile index 627ddb3..37511e0 100644 --- a/tests/cxx/tree/encoding/char/lcp/makefile +++ b/tests/cxx/tree/encoding/char/lcp/makefile @@ -74,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/tests/cxx/tree/encoding/char/utf-8/driver.cxx b/tests/cxx/tree/encoding/char/utf-8/driver.cxx index 5da863c..f580f51 100644 --- a/tests/cxx/tree/encoding/char/utf-8/driver.cxx +++ b/tests/cxx/tree/encoding/char/utf-8/driver.cxx @@ -6,7 +6,7 @@ // Test UTF-8 encoding. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include @@ -26,7 +26,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); { type::a_sequence const& s (r->a ()); diff --git a/tests/cxx/tree/encoding/char/utf-8/makefile b/tests/cxx/tree/encoding/char/utf-8/makefile index 9e51cf0..a7e94bf 100644 --- a/tests/cxx/tree/encoding/char/utf-8/makefile +++ b/tests/cxx/tree/encoding/char/utf-8/makefile @@ -74,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/tests/cxx/tree/encoding/wchar/driver.cxx b/tests/cxx/tree/encoding/wchar/driver.cxx index fde45fa..b3316d2 100644 --- a/tests/cxx/tree/encoding/wchar/driver.cxx +++ b/tests/cxx/tree/encoding/wchar/driver.cxx @@ -6,7 +6,7 @@ // Test the wide character mapping. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include @@ -29,7 +29,7 @@ main (int argc, char* argv[]) // Use dont_validate because we do not have instance's system id (path). // std::ifstream ifs (argv[1]); - auto_ptr r (root (ifs, xml_schema::flags::dont_validate)); + XSD_AUTO_PTR r (root (ifs, xml_schema::flags::dont_validate)); { type::b_sequence const& s (r->b ()); diff --git a/tests/cxx/tree/encoding/wchar/makefile b/tests/cxx/tree/encoding/wchar/makefile index af7f034..d2ce82b 100644 --- a/tests/cxx/tree/encoding/wchar/makefile +++ b/tests/cxx/tree/encoding/wchar/makefile @@ -75,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/tests/cxx/tree/enumeration/ctor/makefile b/tests/cxx/tree/enumeration/ctor/makefile index 947bdfc..9f6162c 100644 --- a/tests/cxx/tree/enumeration/ctor/makefile +++ b/tests/cxx/tree/enumeration/ctor/makefile @@ -75,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/tests/cxx/tree/enumeration/inheritance/driver.cxx b/tests/cxx/tree/enumeration/inheritance/driver.cxx index 1842982..4fb05a1 100644 --- a/tests/cxx/tree/enumeration/inheritance/driver.cxx +++ b/tests/cxx/tree/enumeration/inheritance/driver.cxx @@ -6,7 +6,7 @@ // Insert test description here. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include @@ -26,7 +26,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); switch (*r) { diff --git a/tests/cxx/tree/enumeration/inheritance/makefile b/tests/cxx/tree/enumeration/inheritance/makefile index 54f9a3c..cdce770 100644 --- a/tests/cxx/tree/enumeration/inheritance/makefile +++ b/tests/cxx/tree/enumeration/inheritance/makefile @@ -74,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/tests/cxx/tree/float/driver.cxx b/tests/cxx/tree/float/driver.cxx index 1c073d8..1277275 100644 --- a/tests/cxx/tree/float/driver.cxx +++ b/tests/cxx/tree/float/driver.cxx @@ -7,7 +7,7 @@ // and serialization. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -26,7 +26,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); r->simple ().push_back (12.129456); r->simple ().push_back (123.129456); diff --git a/tests/cxx/tree/float/makefile b/tests/cxx/tree/float/makefile index 03e0201..ebfbc7e 100644 --- a/tests/cxx/tree/float/makefile +++ b/tests/cxx/tree/float/makefile @@ -74,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/tests/cxx/tree/list/ctor/makefile b/tests/cxx/tree/list/ctor/makefile index 6b3c5e0..6131287 100644 --- a/tests/cxx/tree/list/ctor/makefile +++ b/tests/cxx/tree/list/ctor/makefile @@ -75,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/tests/cxx/tree/makefile b/tests/cxx/tree/makefile index 9825601..cfc0847 100644 --- a/tests/cxx/tree/makefile +++ b/tests/cxx/tree/makefile @@ -5,26 +5,27 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make -tests := \ -built-in \ -chameleon \ -comparison \ -compilation \ -complex \ -containment \ -default \ -detach \ -encoding \ -enumeration \ -float \ -list \ -name-clash \ -naming \ -polymorphism \ -prefix \ -test-template \ -types-only \ -union \ +tests := \ +built-in \ +chameleon \ +comparison \ +compilation \ +complex \ +containment \ +default \ +detach \ +dom-association \ +encoding \ +enumeration \ +float \ +list \ +name-clash \ +naming \ +polymorphism \ +prefix \ +test-template \ +types-only \ +union \ wildcard ifeq ($(xsd_with_ace),y) diff --git a/tests/cxx/tree/name-clash/inheritance/driver.cxx b/tests/cxx/tree/name-clash/inheritance/driver.cxx index 611d145..2ff5763 100644 --- a/tests/cxx/tree/name-clash/inheritance/driver.cxx +++ b/tests/cxx/tree/name-clash/inheritance/driver.cxx @@ -6,7 +6,7 @@ // Test for name clashes across inheritance hierarchy. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); cout << *r << endl; } diff --git a/tests/cxx/tree/name-clash/inheritance/makefile b/tests/cxx/tree/name-clash/inheritance/makefile index d45cf9c..972de44 100644 --- a/tests/cxx/tree/name-clash/inheritance/makefile +++ b/tests/cxx/tree/name-clash/inheritance/makefile @@ -74,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/tests/cxx/tree/naming/camel/driver.cxx b/tests/cxx/tree/naming/camel/driver.cxx index d3ea320..fa174d4 100644 --- a/tests/cxx/tree/naming/camel/driver.cxx +++ b/tests/cxx/tree/naming/camel/driver.cxx @@ -6,7 +6,6 @@ // Test camel case (upper for types, lower for functions) naming style. // -#include // std::auto_ptr #include #include diff --git a/tests/cxx/tree/naming/camel/makefile b/tests/cxx/tree/naming/camel/makefile index 78162db..b6c9498 100644 --- a/tests/cxx/tree/naming/camel/makefile +++ b/tests/cxx/tree/naming/camel/makefile @@ -82,7 +82,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/tests/cxx/tree/naming/java/driver.cxx b/tests/cxx/tree/naming/java/driver.cxx index 1c4bfdd..1e4adde 100644 --- a/tests/cxx/tree/naming/java/driver.cxx +++ b/tests/cxx/tree/naming/java/driver.cxx @@ -6,7 +6,6 @@ // Test Java naming style. // -#include // std::auto_ptr #include #include diff --git a/tests/cxx/tree/naming/java/makefile b/tests/cxx/tree/naming/java/makefile index 9cda154..41c5afd 100644 --- a/tests/cxx/tree/naming/java/makefile +++ b/tests/cxx/tree/naming/java/makefile @@ -82,7 +82,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/tests/cxx/tree/naming/knr/driver.cxx b/tests/cxx/tree/naming/knr/driver.cxx index 4960e04..bb980fc 100644 --- a/tests/cxx/tree/naming/knr/driver.cxx +++ b/tests/cxx/tree/naming/knr/driver.cxx @@ -6,7 +6,6 @@ // Test K&R naming style. // -#include // std::auto_ptr #include #include diff --git a/tests/cxx/tree/naming/knr/makefile b/tests/cxx/tree/naming/knr/makefile index 31836de..370055a 100644 --- a/tests/cxx/tree/naming/knr/makefile +++ b/tests/cxx/tree/naming/knr/makefile @@ -82,7 +82,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/tests/cxx/tree/polymorphism/comparison/driver.cxx b/tests/cxx/tree/polymorphism/comparison/driver.cxx index 049cc45..9a2f222 100644 --- a/tests/cxx/tree/polymorphism/comparison/driver.cxx +++ b/tests/cxx/tree/polymorphism/comparison/driver.cxx @@ -6,7 +6,7 @@ // Test comparison of polymorphic object models. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); // Equals. // diff --git a/tests/cxx/tree/polymorphism/comparison/makefile b/tests/cxx/tree/polymorphism/comparison/makefile index 91e541a..3ce8cc9 100644 --- a/tests/cxx/tree/polymorphism/comparison/makefile +++ b/tests/cxx/tree/polymorphism/comparison/makefile @@ -75,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/tests/cxx/tree/polymorphism/ostream/driver.cxx b/tests/cxx/tree/polymorphism/ostream/driver.cxx index 836c329..9ff8a5f 100644 --- a/tests/cxx/tree/polymorphism/ostream/driver.cxx +++ b/tests/cxx/tree/polymorphism/ostream/driver.cxx @@ -6,7 +6,7 @@ // Test printing of polymorphic object models. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); cout << *r << endl; } catch (xml_schema::exception const& e) diff --git a/tests/cxx/tree/polymorphism/ostream/makefile b/tests/cxx/tree/polymorphism/ostream/makefile index 4512023..2f429db 100644 --- a/tests/cxx/tree/polymorphism/ostream/makefile +++ b/tests/cxx/tree/polymorphism/ostream/makefile @@ -76,7 +76,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/tests/cxx/tree/polymorphism/same-type/driver.cxx b/tests/cxx/tree/polymorphism/same-type/driver.cxx index 59ca905..162d397 100644 --- a/tests/cxx/tree/polymorphism/same-type/driver.cxx +++ b/tests/cxx/tree/polymorphism/same-type/driver.cxx @@ -6,7 +6,7 @@ // Test substitution group and xsi:type that don't change the type. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); cout << *r << endl; } diff --git a/tests/cxx/tree/polymorphism/same-type/makefile b/tests/cxx/tree/polymorphism/same-type/makefile index 88a7f3d..407fc07 100644 --- a/tests/cxx/tree/polymorphism/same-type/makefile +++ b/tests/cxx/tree/polymorphism/same-type/makefile @@ -75,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/tests/cxx/tree/prefix/driver.cxx b/tests/cxx/tree/prefix/driver.cxx index 08c416c..5a5bfee 100644 --- a/tests/cxx/tree/prefix/driver.cxx +++ b/tests/cxx/tree/prefix/driver.cxx @@ -6,7 +6,7 @@ // Test automatic prefix assignment. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); root (std::cout, *r); } catch (xml_schema::exception const& e) diff --git a/tests/cxx/tree/prefix/makefile b/tests/cxx/tree/prefix/makefile index 815a970..c1a4703 100644 --- a/tests/cxx/tree/prefix/makefile +++ b/tests/cxx/tree/prefix/makefile @@ -75,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/tests/cxx/tree/test-template/driver.cxx b/tests/cxx/tree/test-template/driver.cxx index 1bb06cb..0cdb0e4 100644 --- a/tests/cxx/tree/test-template/driver.cxx +++ b/tests/cxx/tree/test-template/driver.cxx @@ -6,7 +6,7 @@ // Insert test description here. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); cout << *r << endl; } diff --git a/tests/cxx/tree/test-template/makefile b/tests/cxx/tree/test-template/makefile index 77c83e1..734b705 100644 --- a/tests/cxx/tree/test-template/makefile +++ b/tests/cxx/tree/test-template/makefile @@ -74,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/tests/cxx/tree/types-only/driver.cxx b/tests/cxx/tree/types-only/driver.cxx index 198d8ca..414012e 100644 --- a/tests/cxx/tree/types-only/driver.cxx +++ b/tests/cxx/tree/types-only/driver.cxx @@ -7,7 +7,6 @@ // still compiles. // -#include // std::auto_ptr #include #include "test.hxx" diff --git a/tests/cxx/tree/types-only/makefile b/tests/cxx/tree/types-only/makefile index 9cca14a..66c7a95 100644 --- a/tests/cxx/tree/types-only/makefile +++ b/tests/cxx/tree/types-only/makefile @@ -74,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/tests/cxx/tree/union/ctor/makefile b/tests/cxx/tree/union/ctor/makefile index 6bb4887..38b4354 100644 --- a/tests/cxx/tree/union/ctor/makefile +++ b/tests/cxx/tree/union/ctor/makefile @@ -75,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/tests/cxx/tree/wildcard/driver.cxx b/tests/cxx/tree/wildcard/driver.cxx index d784a97..9798159 100644 --- a/tests/cxx/tree/wildcard/driver.cxx +++ b/tests/cxx/tree/wildcard/driver.cxx @@ -6,13 +6,13 @@ // Test wildcard (any & anyAttribute) mapping. // -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include -#include +#include "test.hxx" // Get XSD_CXX11 defined. -#include "test.hxx" +#include using namespace std; using namespace test; @@ -170,7 +170,7 @@ main (int argc, char* argv[]) // Test parsing // - auto_ptr r (root (argv[1])); + XSD_AUTO_PTR r (root (argv[1])); print (*r); // Test serialization. @@ -187,7 +187,7 @@ main (int argc, char* argv[]) // cout << iostr.str () << endl // << endl; - auto_ptr copy (root (iostr, argv[1])); + XSD_AUTO_PTR copy (root (iostr, argv[1])); assert (*copy == *r); print (*copy); diff --git a/tests/cxx/tree/wildcard/makefile b/tests/cxx/tree/wildcard/makefile index 9b6a994..4adc8b9 100644 --- a/tests/cxx/tree/wildcard/makefile +++ b/tests/cxx/tree/wildcard/makefile @@ -75,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. -- cgit v1.1