diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
commit | 8286ac511144e4f17d34eac9affb97e50646344a (patch) | |
tree | f1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /xsd/tests/cxx/tree | |
parent | a15cf65c44d5c224169c32ef5495b68c758134b7 (diff) |
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'xsd/tests/cxx/tree')
108 files changed, 1720 insertions, 461 deletions
diff --git a/xsd/tests/cxx/tree/any-type/driver.cxx b/xsd/tests/cxx/tree/any-type/driver.cxx new file mode 100644 index 0000000..1ac5274 --- /dev/null +++ b/xsd/tests/cxx/tree/any-type/driver.cxx @@ -0,0 +1,145 @@ +// file : tests/cxx/tree/any-type/driver.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test anyType and anySimpleType content extraction. +// + +#include <memory> // std::auto_ptr/unique_ptr +#include <utility> // std::move +#include <sstream> +#include <iostream> + +#include <xercesc/dom/DOM.hpp> +#include <xercesc/util/PlatformUtils.hpp> + +#include "test.hxx" // Get XSD_CXX11 defined. + +#include <xsd/cxx/xml/string.hxx> + +using namespace std; +using namespace test; +using namespace xercesc; + +namespace xml = xsd::cxx::xml; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + XMLPlatformUtils::Initialize (); + + try + { + // Test parsing + // + XSD_AUTO_PTR<type> r (root (argv[1])); + + // Test API. + // + { + assert (type::a_default_value ().text_content () == "default value"); + } + + { + xml_schema::simple_type x ("fox"); + assert (x.text_content () == "fox"); + x.text_content ("foo"); + assert (x.text_content () == "foo"); + x.text_content ().clear (); + assert (x.text_content () == ""); + x.text_content () = "baz"; + r->s ().push_back (x); + } + + { + xml_schema::type x; + + DOMDocument& doc (x.dom_content_document ()); + + // Copy. + // + DOMElement* e (doc.createElement (xml::string ("dummy").c_str ())); + e->setAttribute (xml::string ("x").c_str (), + xml::string ("foo").c_str ()); + e->setTextContent (xml::string ("data").c_str ()); + x.dom_content ().set (*e); + e->release (); + + r->t ().push_back (x); + } + + { + XSD_AUTO_PTR<xml_schema::type> x (new xml_schema::type); + + DOMDocument& doc (x->dom_content_document ()); + + // Assume ownership. + // + DOMElement* e (doc.createElement (xml::string ("dummy").c_str ())); + e->setAttribute (xml::string ("x").c_str (), + xml::string ("foo").c_str ()); + e->setTextContent (xml::string ("data").c_str ()); + x->dom_content ().set (e); + +#ifdef XSD_CXX11 + r->t ().push_back (std::move (x)); +#else + r->t ().push_back (x); +#endif + } + + // Test printing. + // + cout << *r << endl + << endl; + + // Test serialization. + // + xml_schema::namespace_infomap map; + + map["t"].name = "test"; + map["t"].schema = "test.xsd"; + map["o"].name = "other"; + + stringstream iostr; + root (iostr, *r, map); + + cout << iostr.str () << endl + << endl; + + { + XSD_AUTO_PTR<type> r1 (root (iostr, argv[1])); + + // Xerces-C++ mis-indentation of mixed content messes this up. + // assert (*r == *r); + + stringstream iostr; + root (iostr, *r1, map); + + cout << iostr.str () << endl + << endl; + } + + // Test comparison. + // + assert (*r == *r); + + // Test copy c-tor. + // + type copy (*r); + assert (copy == *r); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } + + XMLPlatformUtils::Terminate (); +} diff --git a/xsd/tests/cxx/tree/any-type/makefile b/xsd/tests/cxx/tree/any-type/makefile new file mode 100644 index 0000000..1d0590f --- /dev/null +++ b/xsd/tests/cxx/tree/any-type/makefile @@ -0,0 +1,87 @@ +# file : tests/cxx/tree/any-type/makefile +# 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 + +xsd := test.xsd +cxx := driver.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) + +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-any-type --generate-serialization \ +--generate-ostream --generate-comparison +$(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) + +$(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. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/xsd/tests/cxx/tree/any-type/output b/xsd/tests/cxx/tree/any-type/output new file mode 100644 index 0000000..580e7db --- /dev/null +++ b/xsd/tests/cxx/tree/any-type/output @@ -0,0 +1,73 @@ + +t: +t: +t: +t: +t: +t: +t: +t: +s: +s: simple +s: baz +l: one two three +a: any simple content + +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<t:root xmlns:t="test" a="any simple content" xmlns:o="other" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="test test.xsd"> + <t/> + <t x="x"/> + <t>any</t> + <t x="x">any</t> + <t o:y="y" x="x"> + <n1> + <n2>nested 1</n2> + <n2>nested 2</n2> + </n1> + <o:n2 o:x="x">more</o:n2> + </t><t x="x"> + <n1>mi + <n2>nested 1</n2>x + <n2>nested 2</n2>ed + </n1>content + </t> + <t x="foo">data</t> + <t x="foo">data</t> + <s/> + <s>simple</s> + <s>baz</s> + <l>one two three</l> +</t:root> + + +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<t:root xmlns:t="test" a="any simple content" xmlns:o="other" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="test test.xsd"> + <t/> + <t x="x"/> + <t>any</t> + <t x="x">any</t> + <t o:y="y" x="x"> + <n1> + <n2>nested 1</n2> + <n2>nested 2</n2> + </n1> + <o:n2 o:x="x">more</o:n2> + </t><t x="x"> + <n1>mi + + <n2>nested 1</n2>x + + <n2>nested 2</n2>ed + + </n1>content + + </t> + <t x="foo">data</t> + <t x="foo">data</t> + <s/> + <s>simple</s> + <s>baz</s> + <l>one two three</l> +</t:root> + + diff --git a/xsd/tests/cxx/tree/any-type/test.xml b/xsd/tests/cxx/tree/any-type/test.xml new file mode 100644 index 0000000..7c9035a --- /dev/null +++ b/xsd/tests/cxx/tree/any-type/test.xml @@ -0,0 +1,26 @@ +<t:root xmlns:t="test" + xmlns:o="other" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="test test.xsd" + + a="any simple content"> + + <t/> + <t x="x"/> + <t>any</t> + <t x="x">any</t> + <t x="x" o:y="y"> + <n1> + <n2>nested 1</n2> + <n2>nested 2</n2> + </n1> + <o:n2 o:x="x">more</o:n2> + </t> + <t x="x"><n1>mi<n2>nested 1</n2>x<n2>nested 2</n2>ed</n1>content</t> + + <s/> + <s>simple</s> + + <l>one two three</l> + +</t:root> diff --git a/xsd/tests/cxx/tree/any-type/test.xsd b/xsd/tests/cxx/tree/any-type/test.xsd new file mode 100644 index 0000000..37dcc8d --- /dev/null +++ b/xsd/tests/cxx/tree/any-type/test.xsd @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + + <simpleType name="any-list"> + <!--Not allowed? list itemType="anySimpleType"/--> + <list itemType="string"/> + </simpleType> + + <complexType name="type"> + <sequence> + <element name="t" type="anyType" maxOccurs="unbounded"/> + <element name="s" type="anySimpleType" maxOccurs="unbounded"/> + <element name="l" type="t:any-list" maxOccurs="unbounded"/> + </sequence> + <attribute name="a" type="anySimpleType" default="default value"/> + </complexType> + + <element name="root" type="t:type"/> +</schema> diff --git a/xsd/tests/cxx/tree/binary/cdr/driver.cxx b/xsd/tests/cxx/tree/binary/cdr/driver.cxx index 42ca181..a2d7195 100644 --- a/xsd/tests/cxx/tree/binary/cdr/driver.cxx +++ b/xsd/tests/cxx/tree/binary/cdr/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/binary/cdr/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 non-polymorphic binary serialization to ACE CDR. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <cassert> #include <iostream> @@ -26,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); // Save to a CDR stream. // @@ -38,7 +37,7 @@ main (int argc, char* argv[]) // ACE_InputCDR ace_icdr (ace_ocdr); xml_schema::istream<ACE_InputCDR> icdr (ace_icdr); - auto_ptr<type> c (new type (icdr)); + XSD_AUTO_PTR<type> c (new type (icdr)); // Compare the two. // @@ -128,6 +127,14 @@ main (int argc, char* argv[]) assert (r->time () == c->time ()); assert (r->date_time () == c->date_time ()); assert (r->duration () == c->duration ()); + + // anySimpleType + // + assert (!r->any_simple_type_attr ().text_content ().empty ()); + assert (r->any_simple_type_attr () == c->any_simple_type_attr ()); + + assert (!r->any_simple_type ().text_content ().empty ()); + assert (r->any_simple_type () == c->any_simple_type ()); } catch (xml_schema::exception const& e) { diff --git a/xsd/tests/cxx/tree/binary/cdr/makefile b/xsd/tests/cxx/tree/binary/cdr/makefile index 67437dc..eb80d35 100644 --- a/xsd/tests/cxx/tree/binary/cdr/makefile +++ b/xsd/tests/cxx/tree/binary/cdr/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/binary/cdr/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 @@ -30,18 +29,18 @@ $(call import,\ # $(driver): $(obj) $(xerces_c.l) $(ace.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) $(ace.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-insertion ACE_OutputCDR \ ---generate-extraction ACE_InputCDR +$(gen): xsd_options += --generate-insertion ACE_OutputCDR \ +--generate-extraction ACE_InputCDR --generate-comparison $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -78,7 +77,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/binary/cdr/test.xml b/xsd/tests/cxx/tree/binary/cdr/test.xml index 928b4cf..5cedd98 100644 --- a/xsd/tests/cxx/tree/binary/cdr/test.xml +++ b/xsd/tests/cxx/tree/binary/cdr/test.xml @@ -1,6 +1,7 @@ <t:root xmlns:t="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="test test.xsd"> + xsi:schemaLocation="test test.xsd" + any_simple_type_attr="any simple content"> <list>1 2 3</list> @@ -87,5 +88,6 @@ <year_month>2001-11+02:00</year_month> <time>21:32:52+02:00</time> + <any_simple_type>any simple content in element</any_simple_type> </t:root> diff --git a/xsd/tests/cxx/tree/binary/cdr/test.xsd b/xsd/tests/cxx/tree/binary/cdr/test.xsd index e593f64..0629e94 100644 --- a/xsd/tests/cxx/tree/binary/cdr/test.xsd +++ b/xsd/tests/cxx/tree/binary/cdr/test.xsd @@ -112,7 +112,10 @@ <element name="year" type="gYear"/> <element name="year_month" type="gYearMonth"/> <element name="time" type="time"/> + + <element name="any_simple_type" type="anySimpleType"/> </sequence> + <attribute name="any_simple_type_attr" type="anySimpleType" use="required"/> </complexType> <element name="root" type="t:type"/> diff --git a/xsd/tests/cxx/tree/binary/makefile b/xsd/tests/cxx/tree/binary/makefile index 8a242c7..7ec2f6a 100644 --- a/xsd/tests/cxx/tree/binary/makefile +++ b/xsd/tests/cxx/tree/binary/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/binary/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/binary/polymorphic/driver.cxx b/xsd/tests/cxx/tree/binary/polymorphic/driver.cxx index 3c3e057..8e7256e 100644 --- a/xsd/tests/cxx/tree/binary/polymorphic/driver.cxx +++ b/xsd/tests/cxx/tree/binary/polymorphic/driver.cxx @@ -1,16 +1,17 @@ // file : tests/cxx/tree/binary/polymorphic/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 polymorphic binary serialization. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <cassert> #include <iostream> #include <typeinfo> +#include <ace/Log_Msg.h> // ACE_HEX_DUMP + #include "test.hxx" using namespace std; @@ -27,7 +28,7 @@ main (int argc, char* argv[]) try { - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); // Save to a CDR stream. // @@ -35,11 +36,24 @@ main (int argc, char* argv[]) xml_schema::ostream<ACE_OutputCDR> ocdr (ace_ocdr); ocdr << *r; + /* + // Print the binary representation. + // + cerr << "binary representation size: " << ace_ocdr.total_length () << endl; + + for (const ACE_Message_Block* mb = ace_ocdr.begin (); + mb != 0; + mb = mb->cont ()) + { + ACE_HEX_DUMP ((LM_DEBUG, mb->rd_ptr (), mb->length ())); + } + */ + // Load from a CDR stream. // ACE_InputCDR ace_icdr (ace_ocdr); xml_schema::istream<ACE_InputCDR> icdr (ace_icdr); - auto_ptr<type> c (new type (icdr)); + XSD_AUTO_PTR<type> c (new type (icdr)); // Compare the two. // diff --git a/xsd/tests/cxx/tree/binary/polymorphic/makefile b/xsd/tests/cxx/tree/binary/polymorphic/makefile index 7e97e00..05c5186 100644 --- a/xsd/tests/cxx/tree/binary/polymorphic/makefile +++ b/xsd/tests/cxx/tree/binary/polymorphic/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/binary/polymorphic/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 @@ -30,18 +29,19 @@ $(call import,\ # $(driver): $(obj) $(xerces_c.l) $(ace.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) $(ace.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 --root-element-last \ ---generate-insertion ACE_OutputCDR --generate-extraction ACE_InputCDR +$(gen): xsd_options += --generate-polymorphic --root-element-last \ +--generate-insertion ACE_OutputCDR --generate-extraction ACE_InputCDR \ + --generate-comparison $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -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/xsd/tests/cxx/tree/binary/xdr/driver.cxx b/xsd/tests/cxx/tree/binary/xdr/driver.cxx index cf2a264..623a953 100644 --- a/xsd/tests/cxx/tree/binary/xdr/driver.cxx +++ b/xsd/tests/cxx/tree/binary/xdr/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/binary/xdr/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 non-polymorphic binary serialization to XDR. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <cstring> // std::memcpy #include <cassert> #include <iostream> @@ -17,15 +16,15 @@ using namespace std; using namespace test; extern "C" int -overflow (char* p, char* buf, int n) +overflow (char* p, char* buf, int in) { xml_schema::buffer* dst (reinterpret_cast<xml_schema::buffer*> (p)); - std::size_t size (dst->size ()); + size_t n (static_cast<size_t> (in)), size (dst->size ()); dst->size (size + n); memcpy (dst->data () + size, buf, n); - return n; + return static_cast<int> (n); } struct underflow_info @@ -35,17 +34,17 @@ struct underflow_info }; extern "C" int -underflow (char* p, char* buf, int n) +underflow (char* p, char* buf, int in) { underflow_info* ui (reinterpret_cast<underflow_info*> (p)); - std::size_t size (ui->buf->size () - ui->pos); + size_t n (static_cast<size_t> (in)), size (ui->buf->size () - ui->pos); n = size > n ? n : size; memcpy (buf, ui->buf->data () + ui->pos, n); ui->pos += n; - return n; + return static_cast<int> (n); } int @@ -59,7 +58,7 @@ main (int argc, char* argv[]) try { - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); // Save to an XDR stream. // @@ -81,7 +80,7 @@ main (int argc, char* argv[]) xdr.x_op = XDR_DECODE; xdrrec_skiprecord (&xdr); xsd::cxx::tree::istream<XDR> ixdr (xdr); - auto_ptr<type> c (new type (ixdr)); + XSD_AUTO_PTR<type> c (new type (ixdr)); xdr_destroy (&xdr); // Compare the two. @@ -172,6 +171,14 @@ main (int argc, char* argv[]) assert (r->year () == c->year ()); assert (r->year_month () == c->year_month ()); assert (r->time () == c->time ()); + + // anySimpleType + // + assert (!r->any_simple_type_attr ().text_content ().empty ()); + assert (r->any_simple_type_attr () == c->any_simple_type_attr ()); + + assert (!r->any_simple_type ().text_content ().empty ()); + assert (r->any_simple_type () == c->any_simple_type ()); } catch (xml_schema::exception const& e) { diff --git a/xsd/tests/cxx/tree/binary/xdr/makefile b/xsd/tests/cxx/tree/binary/xdr/makefile index 7b3089b..2994134 100644 --- a/xsd/tests/cxx/tree/binary/xdr/makefile +++ b/xsd/tests/cxx/tree/binary/xdr/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/binary/xdr/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 @@ -26,17 +25,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-insertion XDR --generate-extraction XDR +$(gen): xsd_options += --generate-insertion XDR --generate-extraction XDR \ +--generate-comparison $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -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/xsd/tests/cxx/tree/binary/xdr/test.xml b/xsd/tests/cxx/tree/binary/xdr/test.xml index 928b4cf..5cedd98 100644 --- a/xsd/tests/cxx/tree/binary/xdr/test.xml +++ b/xsd/tests/cxx/tree/binary/xdr/test.xml @@ -1,6 +1,7 @@ <t:root xmlns:t="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="test test.xsd"> + xsi:schemaLocation="test test.xsd" + any_simple_type_attr="any simple content"> <list>1 2 3</list> @@ -87,5 +88,6 @@ <year_month>2001-11+02:00</year_month> <time>21:32:52+02:00</time> + <any_simple_type>any simple content in element</any_simple_type> </t:root> diff --git a/xsd/tests/cxx/tree/binary/xdr/test.xsd b/xsd/tests/cxx/tree/binary/xdr/test.xsd index e593f64..0629e94 100644 --- a/xsd/tests/cxx/tree/binary/xdr/test.xsd +++ b/xsd/tests/cxx/tree/binary/xdr/test.xsd @@ -112,7 +112,10 @@ <element name="year" type="gYear"/> <element name="year_month" type="gYearMonth"/> <element name="time" type="time"/> + + <element name="any_simple_type" type="anySimpleType"/> </sequence> + <attribute name="any_simple_type_attr" type="anySimpleType" use="required"/> </complexType> <element name="root" type="t:type"/> diff --git a/xsd/tests/cxx/tree/built-in/driver.cxx b/xsd/tests/cxx/tree/built-in/driver.cxx index a41e4f3..f60ac16 100644 --- a/xsd/tests/cxx/tree/built-in/driver.cxx +++ b/xsd/tests/cxx/tree/built-in/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/built-in/driver.cxx -// author : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file // Test built-in type mapping. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <sstream> #include <iostream> @@ -15,7 +14,6 @@ using std::cerr; using std::endl; -using std::auto_ptr; int main (int argc, char* argv[]) @@ -26,12 +24,13 @@ main (int argc, char* argv[]) return 1; } - auto_ptr<xmlns::test::Elements> elements (xmlns::test::elements (argv[1])); + XSD_AUTO_PTR<xmlns::test::Elements> elements ( + xmlns::test::elements (argv[1])); - auto_ptr<xmlns::test::Attributes> attributes ( + XSD_AUTO_PTR<xmlns::test::Attributes> attributes ( xmlns::test::attributes (argv[2])); - auto_ptr<xmlns::test::Inherited> inherited ( + XSD_AUTO_PTR<xmlns::test::Inherited> inherited ( xmlns::test::inherited (argv[3])); cerr << "elements: " << *elements << endl @@ -53,13 +52,14 @@ main (int argc, char* argv[]) xmlns::test::elements (ostr, *elements, map); std::istringstream istr (ostr.str ()); - auto_ptr<xmlns::test::Elements> elements1 (xmlns::test::elements (istr)); + XSD_AUTO_PTR<xmlns::test::Elements> 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 +67,7 @@ main (int argc, char* argv[]) xmlns::test::attributes (ostr, *attributes, map); std::istringstream istr (ostr.str ()); - auto_ptr<xmlns::test::Attributes> attributes1 ( + XSD_AUTO_PTR<xmlns::test::Attributes> attributes1 ( xmlns::test::attributes (istr)); std::ostringstream ostr1; @@ -82,7 +82,7 @@ main (int argc, char* argv[]) xmlns::test::inherited (ostr, *inherited, map); std::istringstream istr (ostr.str ()); - auto_ptr<xmlns::test::Inherited> inherited1 ( + XSD_AUTO_PTR<xmlns::test::Inherited> inherited1 ( xmlns::test::inherited (istr)); std::ostringstream ostr1; diff --git a/xsd/tests/cxx/tree/built-in/makefile b/xsd/tests/cxx/tree/built-in/makefile index bf6301b..3df37c3 100644 --- a/xsd/tests/cxx/tree/built-in/makefile +++ b/xsd/tests/cxx/tree/built-in/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/built-in/makefile -# author : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC # license : GNU GPL v2 + exceptions; see accompanying LICENSE file include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make @@ -27,7 +26,7 @@ $(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) @@ -35,7 +34,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options := \ +$(gen): xsd_options += \ --char-type char \ --generate-inline \ --generate-ostream \ @@ -44,10 +43,9 @@ $(gen): xsd_options := \ --generate-from-base-ctor \ --root-element-all -$(gen): $(src_root)/xsd/xsd - -$(call include-dep,$(dep)) +$(gen): $(out_root)/xsd/xsd +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -90,7 +88,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/chameleon/driver.cxx b/xsd/tests/cxx/tree/chameleon/driver.cxx index 6dae28e..80c67da 100644 --- a/xsd/tests/cxx/tree/chameleon/driver.cxx +++ b/xsd/tests/cxx/tree/chameleon/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/chameleon/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 chameleon inclusion. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <iostream> #include "includer.hxx" @@ -25,7 +24,7 @@ main (int argc, char* argv[]) try { - auto_ptr<root_t> r (root (argv[1])); + XSD_AUTO_PTR<root_t> r (root (argv[1])); cout << *r << endl; } diff --git a/xsd/tests/cxx/tree/chameleon/makefile b/xsd/tests/cxx/tree/chameleon/makefile index 890de3f..4ae7eb7 100644 --- a/xsd/tests/cxx/tree/chameleon/makefile +++ b/xsd/tests/cxx/tree/chameleon/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/chameleon/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,17 +26,17 @@ $(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 := --root-element root --generate-ostream +$(gen): xsd_options += --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. # @@ -74,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/xsd/tests/cxx/tree/comparison/driver.cxx b/xsd/tests/cxx/tree/comparison/driver.cxx index 07ed7a6..e685050 100644 --- a/xsd/tests/cxx/tree/comparison/driver.cxx +++ b/xsd/tests/cxx/tree/comparison/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/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 generated comparison operators. // -#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])); type::complex_sequence s (r->complex ()); diff --git a/xsd/tests/cxx/tree/comparison/makefile b/xsd/tests/cxx/tree/comparison/makefile index 5d8721a..82cb7b0 100644 --- a/xsd/tests/cxx/tree/comparison/makefile +++ b/xsd/tests/cxx/tree/comparison/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/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,17 +26,17 @@ $(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-comparison +$(gen): xsd_options += --generate-comparison $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/compilation/driver.cxx b/xsd/tests/cxx/tree/compilation/driver.cxx index 8135c9b..c2e6298 100644 --- a/xsd/tests/cxx/tree/compilation/driver.cxx +++ b/xsd/tests/cxx/tree/compilation/driver.cxx @@ -1,13 +1,11 @@ // file : tests/cxx/tree/compilation/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 // Make sure the runtime library compiles by explicitly instantiating // all the types. // -#include <memory> // std::auto_ptr #include <iostream> #include "test.hxx" @@ -15,7 +13,7 @@ using namespace std; using namespace test; -template class xsd::cxx::tree::simple_type<xml_schema::type>; +template class xsd::cxx::tree::simple_type<char, xml_schema::type>; // String types. // diff --git a/xsd/tests/cxx/tree/compilation/makefile b/xsd/tests/cxx/tree/compilation/makefile index 93b88db..16dbb91 100644 --- a/xsd/tests/cxx/tree/compilation/makefile +++ b/xsd/tests/cxx/tree/compilation/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/compilation/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,17 +26,17 @@ $(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-serialization +$(gen): xsd_options += --generate-serialization $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/complex/ctor/driver.cxx b/xsd/tests/cxx/tree/complex/ctor/driver.cxx index 55044a3..8ea8c87 100644 --- a/xsd/tests/cxx/tree/complex/ctor/driver.cxx +++ b/xsd/tests/cxx/tree/complex/ctor/driver.cxx @@ -1,6 +1,5 @@ // file : tests/cxx/tree/complex/ctor/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 generation of varous complex type constructors. @@ -11,6 +10,13 @@ #include "test.hxx" +#ifdef XSD_CXX11 +# include <utility> // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + using namespace std; using namespace test; @@ -64,12 +70,12 @@ main () // e_base b1 (1, "foo", e_complex_type ("bar")); - auto_ptr<e_complex_type> c2 (new e_complex_type ("bar")); - e_base b2 (1, "foo", c2); + XSD_AUTO_PTR<e_complex_type> c2 (new e_complex_type ("bar")); + e_base b2 (1, "foo", XSD_MOVE (c2)); - auto_ptr<e_simple_type> s3 (new e_simple_type ("foo")); - auto_ptr<e_complex_type> c3 (new e_complex_type ("bar")); - e_base b3 (1, s3, c3); + XSD_AUTO_PTR<e_simple_type> s3 (new e_simple_type ("foo")); + XSD_AUTO_PTR<e_complex_type> c3 (new e_complex_type ("bar")); + e_base b3 (1, XSD_MOVE (s3), XSD_MOVE (c3)); assert (b1 == b2); assert (b1 == b3); @@ -79,15 +85,20 @@ main () e_derived d1 (1, "foo", e_complex_type ("bar"), true, "baz", e_complex_type ("biz")); - auto_ptr<e_complex_type> c2a (new e_complex_type ("bar")); - auto_ptr<e_complex_type> c2b (new e_complex_type ("biz")); - e_derived d2 (1, "foo", c2a, true, "baz", c2b); - - auto_ptr<e_simple_type> s3a (new e_simple_type ("foo")); - auto_ptr<xml_schema::string> s3b (new xml_schema::string ("baz")); - auto_ptr<e_complex_type> c3a (new e_complex_type ("bar")); - auto_ptr<e_complex_type> c3b (new e_complex_type ("biz")); - e_derived d3 (1, s3a, c3a, true, s3b, c3b); + XSD_AUTO_PTR<e_complex_type> c2a (new e_complex_type ("bar")); + XSD_AUTO_PTR<e_complex_type> c2b (new e_complex_type ("biz")); + e_derived d2 (1, "foo", XSD_MOVE (c2a), true, "baz", XSD_MOVE (c2b)); + + XSD_AUTO_PTR<e_simple_type> s3a (new e_simple_type ("foo")); + XSD_AUTO_PTR<xml_schema::string> s3b (new xml_schema::string ("baz")); + XSD_AUTO_PTR<e_complex_type> c3a (new e_complex_type ("bar")); + XSD_AUTO_PTR<e_complex_type> 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 +110,12 @@ main () { f_type f1 (xml_schema::type (), 1, "foo", f_complex_type ("bar")); - auto_ptr<f_complex_type> c2 (new f_complex_type ("bar")); - f_type f2 (1, "foo", c2); + XSD_AUTO_PTR<f_complex_type> c2 (new f_complex_type ("bar")); + f_type f2 (1, "foo", XSD_MOVE (c2)); - auto_ptr<f_simple_type> s3 (new f_simple_type ("foo")); - auto_ptr<f_complex_type> c3 (new f_complex_type ("bar")); - f_type f3 (1, s3, c3); + XSD_AUTO_PTR<f_simple_type> s3 (new f_simple_type ("foo")); + XSD_AUTO_PTR<f_complex_type> 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/xsd/tests/cxx/tree/complex/ctor/makefile b/xsd/tests/cxx/tree/complex/ctor/makefile index 66558f5..ffc82b0 100644 --- a/xsd/tests/cxx/tree/complex/ctor/makefile +++ b/xsd/tests/cxx/tree/complex/ctor/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/complex/ctor/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,19 +26,19 @@ $(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-default-ctor --generate-from-base-ctor \ +$(gen): xsd_options += --generate-default-ctor --generate-from-base-ctor \ --generate-doxygen --generate-polymorphic --polymorphic-type-all \ --generate-comparison $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -76,8 +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,$(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/xsd/tests/cxx/tree/complex/makefile b/xsd/tests/cxx/tree/complex/makefile index a0b3294..db6e6a8 100644 --- a/xsd/tests/cxx/tree/complex/makefile +++ b/xsd/tests/cxx/tree/complex/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/complex/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/containment/driver.cxx b/xsd/tests/cxx/tree/containment/driver.cxx index cb6c76e..f019de8 100644 --- a/xsd/tests/cxx/tree/containment/driver.cxx +++ b/xsd/tests/cxx/tree/containment/driver.cxx @@ -1,16 +1,22 @@ // file : tests/cxx/tree/containment/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 tree node containment. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <cassert> #include "test.hxx" +#ifdef XSD_CXX11 +# include <utility> // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + using namespace std; using namespace test; @@ -20,11 +26,11 @@ main () // Change of a container in a sub-tree without ID. // { - auto_ptr<inner> i (new inner ()); + XSD_AUTO_PTR<inner> 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 +40,14 @@ main () // Change of container in a sub-tree with ID inside. // { - auto_ptr<inner> i (new inner ()); + XSD_AUTO_PTR<inner> 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 +57,10 @@ main () // Change of a container in ID. // { - auto_ptr<xml_schema::id> id (new xml_schema::id ("foo")); + XSD_AUTO_PTR<xml_schema::id> 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 +68,12 @@ main () // Change of a container in a type derived from ID with ID inside. // { - auto_ptr<id_ex> id (new id_ex ("foo")); + XSD_AUTO_PTR<id_ex> 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 +87,28 @@ main () { id i1 ("a"), i2 ("b"); - auto_ptr<ids> ic (new ids); + XSD_AUTO_PTR<ids> ic (new ids); ic->id ().push_back (i1); ic->id ().push_back (i2); - auto_ptr<xml_schema::idrefs> r1 (new xml_schema::idrefs); + XSD_AUTO_PTR<xml_schema::idrefs> r1 (new xml_schema::idrefs); r1->push_back (xml_schema::idref ("a")); r1->push_back (xml_schema::idref ("b")); - auto_ptr<idref_list> r2 (new idref_list); + XSD_AUTO_PTR<idref_list> r2 (new idref_list); r2->push_back (xml_schema::idref ("a")); r2->push_back (xml_schema::idref ("b")); - auto_ptr<idrefs1> rc1 (new idrefs1); - auto_ptr<idrefs2> rc2 (new idrefs2); + XSD_AUTO_PTR<idrefs1> rc1 (new idrefs1); + XSD_AUTO_PTR<idrefs2> 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/xsd/tests/cxx/tree/containment/makefile b/xsd/tests/cxx/tree/containment/makefile index fcdd792..d181fb5 100644 --- a/xsd/tests/cxx/tree/containment/makefile +++ b/xsd/tests/cxx/tree/containment/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/containment/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,17 +26,17 @@ $(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-default-ctor +$(gen): xsd_options += --generate-default-ctor $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/default/general/driver.cxx b/xsd/tests/cxx/tree/default/general/driver.cxx index a48650f..b0df8ba 100644 --- a/xsd/tests/cxx/tree/default/general/driver.cxx +++ b/xsd/tests/cxx/tree/default/general/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/default/general/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 default attribute/element values. // -#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], xml_schema::flags::dont_validate)); + XSD_AUTO_PTR<type> r (root (argv[1], xml_schema::flags::dont_validate)); xml_schema::namespace_infomap map; map["t"].name = "test"; diff --git a/xsd/tests/cxx/tree/default/general/makefile b/xsd/tests/cxx/tree/default/general/makefile index b1b7fca..6c2dfe6 100644 --- a/xsd/tests/cxx/tree/default/general/makefile +++ b/xsd/tests/cxx/tree/default/general/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/default/general/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-serialization \ +$(gen): xsd_options += --generate-ostream --generate-serialization \ --generate-default-ctor --generate-from-base-ctor $(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/default/general/output b/xsd/tests/cxx/tree/default/general/output index 72a8fa4..396a698 100644 --- a/xsd/tests/cxx/tree/default/general/output +++ b/xsd/tests/cxx/tree/default/general/output @@ -1,28 +1,15 @@ <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <t:root xmlns:t="test" base64_bin1="" base64_bin2="YmFzZTY0IGJpbmFyeQ==
" bool1="true" bool2="true" bool3="false" bool4="false" byte="-99" decimal1="1.12345" decimal2="-0.456" double1="1.12345" double2="1123.45" double3="-0.00012345" double4="NaN" double5="-INF" fix1="123" fix2="123" fix3="abc" fix4="abc" fix5="aaa bbb ccc" fix6="aaa bbb ccc" float1="1.123" float2="1123" float3="-0.000123" float4="NaN" float5="-INF" hex_bin1="" hex_bin2="6865782052696E617279" id="this" idref="this" idrefs="this" int="-99999" integer="-99999" language="en-us" long="-99999" ncname="abcd" ninteger="-99999" nmtoken="ab:cd" nmtokens1="a:b efg aaa" nmtokens2="abc" nninteger="99999" npinteger="-99999" nstring=" a b " pinteger="99999" qname1="foo" qname2="t:bar" short="-999" string1="" string2=" a b " token="a b" ubyte="99" uint="99999" ulong="99999" uri="http://example.com" ushort="999"> - <union a="abc"/> - <list a="123 345 678" b="ab cd ef" c="abc" d="abc def"/> - <simple a="123" b="abc" c="123" d="abc" e="abc" f="abc 123"/> - <date a="2009-03-31" b="2009-03-31Z" c="2009-03-31Z" d="2009-03-31Z" e="2009-03-31+12:30" f="2009-03-31-12:30" g="2002009-03-31-12:30"/> - <time a="12:03:45" b="12:03:45.123Z" c="12:03:05.123Z" d="12:03:45.123Z" e="12:03:45.123+12:30" f="12:03:45-12:30"/> - <date-time a="2009-03-31T12:03:45" b="2009-03-31T12:03:45.123Z" c="2002009-03-31T12:03:05.123-12:30"/> - <duration a="P100Y" b="P100M" c="P100D" d="PT12H" e="PT12M" f="PT12.123S" g="-P100Y10M20DT12H12M1.123S"/> - <day a="---02" b="---22Z" c="---22-12:30"/> - <month a="--02" b="--12Z" c="--12+12:30"/> - <year a="2009" b="-2002009Z" c="2009-12:30"/> - <month-day a="--02-02" b="--12-22Z" c="--12-22+12:30"/> - <year-month a="2009-02" b="-2002009-12Z" c="2009-12-12:30"/> - </t:root> diff --git a/xsd/tests/cxx/tree/default/makefile b/xsd/tests/cxx/tree/default/makefile index 218e69c..56fa53d 100644 --- a/xsd/tests/cxx/tree/default/makefile +++ b/xsd/tests/cxx/tree/default/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/default/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/default/omit/driver.cxx b/xsd/tests/cxx/tree/default/omit/driver.cxx index cbf69b5..6a074c1 100644 --- a/xsd/tests/cxx/tree/default/omit/driver.cxx +++ b/xsd/tests/cxx/tree/default/omit/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/default/omit/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 default attribute omission from the output. // -#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], xml_schema::flags::dont_validate)); + XSD_AUTO_PTR<type> r (root (argv[1], xml_schema::flags::dont_validate)); cout << *r << endl << "default x: " << derived::x_default_value () << endl diff --git a/xsd/tests/cxx/tree/default/omit/makefile b/xsd/tests/cxx/tree/default/omit/makefile index e0cce27..caaec12 100644 --- a/xsd/tests/cxx/tree/default/omit/makefile +++ b/xsd/tests/cxx/tree/default/omit/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/default/omit/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-serialization \ +$(gen): xsd_options += --generate-ostream --generate-serialization \ --generate-default-ctor --generate-from-base-ctor --omit-default-attributes $(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/default/omit/output b/xsd/tests/cxx/tree/default/omit/output index eef99a3..150ad58 100644 --- a/xsd/tests/cxx/tree/default/omit/output +++ b/xsd/tests/cxx/tree/default/omit/output @@ -13,9 +13,7 @@ fixed q1: 1 fixed q2: 2 <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <t:root xmlns:t="test"> - <derived q1="1" q2="2"> <a>a</a> </derived> - </t:root> diff --git a/xsd/tests/cxx/tree/detach/driver.cxx b/xsd/tests/cxx/tree/detach/driver.cxx index afcb90d..cabd9ea 100644 --- a/xsd/tests/cxx/tree/detach/driver.cxx +++ b/xsd/tests/cxx/tree/detach/driver.cxx @@ -1,22 +1,30 @@ // file : tests/cxx/tree/detach/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 the detach functionality. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <cassert> #include "test.hxx" +#ifdef XSD_CXX11 +# include <utility> // 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 +65,22 @@ main () // Detach one. // - auto_ptr<subtree> p (m.detach_one ()); + XSD_AUTO_PTR<subtree> 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 +90,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 +99,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/xsd/tests/cxx/tree/detach/makefile b/xsd/tests/cxx/tree/detach/makefile index 938fba2..64def55 100644 --- a/xsd/tests/cxx/tree/detach/makefile +++ b/xsd/tests/cxx/tree/detach/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/detach/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,17 +26,17 @@ $(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-detach --generate-default-ctor +$(gen): xsd_options += --generate-detach --generate-default-ctor $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/dom-association/dom-parse.cxx b/xsd/tests/cxx/tree/dom-association/dom-parse.cxx new file mode 100644 index 0000000..c065d19 --- /dev/null +++ b/xsd/tests/cxx/tree/dom-association/dom-parse.cxx @@ -0,0 +1,96 @@ +// file : tests/cxx/tree/dom-association/dom-parse.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include "dom-parse.hxx" + +#include <istream> + +#include <xercesc/dom/DOM.hpp> +#include <xercesc/util/XMLUniDefs.hpp> // chLatin_* +#include <xercesc/framework/Wrapper4InputSource.hpp> + +#include <xsd/cxx/xml/sax/std-input-source.hxx> +#include <xsd/cxx/xml/dom/bits/error-handler-proxy.hxx> + +#include <xsd/cxx/tree/exceptions.hxx> +#include <xsd/cxx/tree/error-handler.hxx> + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +XSD_DOM_AUTO_PTR<DOMDocument> +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<DOMLSParser> 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<char> eh; + xml::dom::bits::error_handler_proxy<char> 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<DOMDocument> doc (parser->parse (&wrap)); + + eh.throw_if_failed<tree::parsing<char> > (); + + return doc; +} diff --git a/xsd/tests/cxx/tree/dom-association/dom-parse.hxx b/xsd/tests/cxx/tree/dom-association/dom-parse.hxx new file mode 100644 index 0000000..2c3bd3f --- /dev/null +++ b/xsd/tests/cxx/tree/dom-association/dom-parse.hxx @@ -0,0 +1,24 @@ +// file : tests/cxx/tree/dom-association/dom-parse.hxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef DOM_PARSE +#define DOM_PARSE + +#include <string> +#include <iosfwd> + +#include <xercesc/dom/DOMDocument.hpp> + +#include <xsd/cxx/xml/dom/auto-ptr.hxx> + +// 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<xercesc::DOMDocument> +parse (std::istream& is, + const std::string& id, + bool validate); + +#endif // DOM_PARSE diff --git a/xsd/tests/cxx/tree/dom-association/driver.cxx b/xsd/tests/cxx/tree/dom-association/driver.cxx new file mode 100644 index 0000000..edcda50 --- /dev/null +++ b/xsd/tests/cxx/tree/dom-association/driver.cxx @@ -0,0 +1,72 @@ +// file : tests/cxx/tree/dom-association/driver.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test DOM association/ownership. +// + +#include <memory> // std::auto_ptr/unique_ptr +#include <fstream> +#include <iostream> + +#include <xercesc/dom/DOM.hpp> + +#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<DOMDocument> doc (parse (ifs, argv[1], true)); + ptr = doc.get (); + unique_ptr<type> r ( + root (std::move (doc), + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); +#else + xml_schema::dom::auto_ptr<DOMDocument> doc (parse (ifs, argv[1], true)); + ptr = doc.get (); + auto_ptr<type> 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/xsd/tests/cxx/tree/dom-association/makefile b/xsd/tests/cxx/tree/dom-association/makefile new file mode 100644 index 0000000..4a05d45 --- /dev/null +++ b/xsd/tests/cxx/tree/dom-association/makefile @@ -0,0 +1,92 @@ +# file : tests/cxx/tree/dom-association/makefile +# 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 + +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/xsd/tests/cxx/tree/dom-association/output b/xsd/tests/cxx/tree/dom-association/output new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/xsd/tests/cxx/tree/dom-association/output diff --git a/xsd/tests/cxx/tree/dom-association/test.xml b/xsd/tests/cxx/tree/dom-association/test.xml new file mode 100644 index 0000000..624a80c --- /dev/null +++ b/xsd/tests/cxx/tree/dom-association/test.xml @@ -0,0 +1,7 @@ +<t:root xmlns:t="test" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="test test.xsd"> + + <a>a</a> + +</t:root> diff --git a/xsd/tests/cxx/tree/dom-association/test.xsd b/xsd/tests/cxx/tree/dom-association/test.xsd new file mode 100644 index 0000000..07bebc7 --- /dev/null +++ b/xsd/tests/cxx/tree/dom-association/test.xsd @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + + <complexType name="type"> + <sequence> + <element name="a" type="string"/> + </sequence> + </complexType> + + <element name="root" type="t:type"/> + +</schema> diff --git a/xsd/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx b/xsd/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx index 56b2df8..6a92ae0 100644 --- a/xsd/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx +++ b/xsd/tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/encoding/char/iso-8859-1/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 ISO-8859-1 encoding. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <fstream> #include <iostream> @@ -36,7 +35,7 @@ main (int argc, char* argv[]) } xsd::cxx::xml::char_transcoder::unrep_char ('?'); - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); { type::a_sequence const& s (r->a ()); diff --git a/xsd/tests/cxx/tree/encoding/char/iso-8859-1/makefile b/xsd/tests/cxx/tree/encoding/char/iso-8859-1/makefile index 967357f..8a952f7 100644 --- a/xsd/tests/cxx/tree/encoding/char/iso-8859-1/makefile +++ b/xsd/tests/cxx/tree/encoding/char/iso-8859-1/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/encoding/char/iso-8859-1/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 := --char-encoding iso8859-1 --generate-serialization \ +$(gen): xsd_options += --char-encoding iso8859-1 --generate-serialization \ --generate-doxygen $(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/encoding/char/iso-8859-1/test.std b/xsd/tests/cxx/tree/encoding/char/iso-8859-1/test.std index ca6297f..d26b30f 100644 --- a/xsd/tests/cxx/tree/encoding/char/iso-8859-1/test.std +++ b/xsd/tests/cxx/tree/encoding/char/iso-8859-1/test.std @@ -1,18 +1,10 @@ <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?> <t:root xmlns:t="test"> - <a>abc</a> - <a>æ</a> - <a>¢£¤¥</a> - <a>???</a> - <b>abc</b> - <b>aâc</b> - <b>âòbc</b> - </t:root> diff --git a/xsd/tests/cxx/tree/encoding/char/lcp/driver.cxx b/xsd/tests/cxx/tree/encoding/char/lcp/driver.cxx index 2fb13a3..d44d0fe 100644 --- a/xsd/tests/cxx/tree/encoding/char/lcp/driver.cxx +++ b/xsd/tests/cxx/tree/encoding/char/lcp/driver.cxx @@ -1,13 +1,12 @@ // file : tests/cxx/tree/encoding/char/lcp/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 local code page encoding (--char-encoding lcp). // The test just makes sure it still compiles and works. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <fstream> #include <iostream> @@ -27,7 +26,7 @@ main (int argc, char* argv[]) try { - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); xml_schema::namespace_infomap map; map["t"].name = "test"; diff --git a/xsd/tests/cxx/tree/encoding/char/lcp/makefile b/xsd/tests/cxx/tree/encoding/char/lcp/makefile index 518c514..9dc599d 100644 --- a/xsd/tests/cxx/tree/encoding/char/lcp/makefile +++ b/xsd/tests/cxx/tree/encoding/char/lcp/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/encoding/char/lcp/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,17 +26,17 @@ $(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-serialization --char-encoding lcp +$(gen): xsd_options += --generate-serialization --char-encoding lcp $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/encoding/char/lcp/test.std b/xsd/tests/cxx/tree/encoding/char/lcp/test.std index cc20ef7..368826d 100644 --- a/xsd/tests/cxx/tree/encoding/char/lcp/test.std +++ b/xsd/tests/cxx/tree/encoding/char/lcp/test.std @@ -1,6 +1,4 @@ <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <t:root xmlns:t="test"> - <a>abcd</a> - </t:root> diff --git a/xsd/tests/cxx/tree/encoding/char/makefile b/xsd/tests/cxx/tree/encoding/char/makefile index 3e64dd9..587eeb1 100644 --- a/xsd/tests/cxx/tree/encoding/char/makefile +++ b/xsd/tests/cxx/tree/encoding/char/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/encoding/char/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/encoding/char/utf-8/driver.cxx b/xsd/tests/cxx/tree/encoding/char/utf-8/driver.cxx index 0842203..9d12659 100644 --- a/xsd/tests/cxx/tree/encoding/char/utf-8/driver.cxx +++ b/xsd/tests/cxx/tree/encoding/char/utf-8/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/encoding/char/utf-8/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 UTF-8 encoding. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <fstream> #include <iostream> @@ -26,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); { type::a_sequence const& s (r->a ()); @@ -57,7 +56,7 @@ main (int argc, char* argv[]) xml_schema::namespace_infomap map; map["t"].name = "test"; - root (std::cout, *r, map, "UCS-4LE"); + root (std::cout, *r, map, "ASCII"); } catch (xml_schema::exception const& e) { diff --git a/xsd/tests/cxx/tree/encoding/char/utf-8/makefile b/xsd/tests/cxx/tree/encoding/char/utf-8/makefile index 8c0256e..e2bbdfc 100644 --- a/xsd/tests/cxx/tree/encoding/char/utf-8/makefile +++ b/xsd/tests/cxx/tree/encoding/char/utf-8/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/encoding/char/utf-8/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,17 +26,17 @@ $(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-serialization --generate-doxygen +$(gen): xsd_options += --generate-serialization --generate-doxygen $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/encoding/char/utf-8/test.std b/xsd/tests/cxx/tree/encoding/char/utf-8/test.std Binary files differindex 328fe6d..ffce337 100644 --- a/xsd/tests/cxx/tree/encoding/char/utf-8/test.std +++ b/xsd/tests/cxx/tree/encoding/char/utf-8/test.std diff --git a/xsd/tests/cxx/tree/encoding/makefile b/xsd/tests/cxx/tree/encoding/makefile index fcadb8c..2108fa2 100644 --- a/xsd/tests/cxx/tree/encoding/makefile +++ b/xsd/tests/cxx/tree/encoding/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/encoding/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/encoding/wchar/driver.cxx b/xsd/tests/cxx/tree/encoding/wchar/driver.cxx index 22cbfb4..6b8d51e 100644 --- a/xsd/tests/cxx/tree/encoding/wchar/driver.cxx +++ b/xsd/tests/cxx/tree/encoding/wchar/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/encoding/wchar/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 the wide character mapping. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <fstream> #include <iostream> @@ -29,7 +28,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<type> r (root (ifs, xml_schema::flags::dont_validate)); + XSD_AUTO_PTR<type> r (root (ifs, xml_schema::flags::dont_validate)); { type::b_sequence const& s (r->b ()); @@ -47,7 +46,7 @@ main (int argc, char* argv[]) xml_schema::namespace_infomap map; map[L"t"].name = L"test"; - root (std::cout, *r, map, L"UCS-4LE"); + root (std::cout, *r, map, L"ASCII"); } catch (xml_schema::exception const& e) { diff --git a/xsd/tests/cxx/tree/encoding/wchar/makefile b/xsd/tests/cxx/tree/encoding/wchar/makefile index fb2faed..e66d3a5 100644 --- a/xsd/tests/cxx/tree/encoding/wchar/makefile +++ b/xsd/tests/cxx/tree/encoding/wchar/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/encoding/wchar/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-serialization --generate-doxygen \ +$(gen): xsd_options += --generate-serialization --generate-doxygen \ --char-type wchar_t $(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/encoding/wchar/test.std b/xsd/tests/cxx/tree/encoding/wchar/test.std Binary files differindex 93d4561..815ba6c 100644 --- a/xsd/tests/cxx/tree/encoding/wchar/test.std +++ b/xsd/tests/cxx/tree/encoding/wchar/test.std diff --git a/xsd/tests/cxx/tree/enumeration/ctor/driver.cxx b/xsd/tests/cxx/tree/enumeration/ctor/driver.cxx index 114b7b7..bd2589f 100644 --- a/xsd/tests/cxx/tree/enumeration/ctor/driver.cxx +++ b/xsd/tests/cxx/tree/enumeration/ctor/driver.cxx @@ -1,6 +1,5 @@ // file : tests/cxx/tree/enumeration/ctor/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 enumeration constructors. diff --git a/xsd/tests/cxx/tree/enumeration/ctor/makefile b/xsd/tests/cxx/tree/enumeration/ctor/makefile index b33ab94..2fae138 100644 --- a/xsd/tests/cxx/tree/enumeration/ctor/makefile +++ b/xsd/tests/cxx/tree/enumeration/ctor/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/enumeration/ctor/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-default-ctor --generate-from-base-ctor \ +$(gen): xsd_options += --generate-default-ctor --generate-from-base-ctor \ --generate-doxygen $(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/enumeration/inheritance/driver.cxx b/xsd/tests/cxx/tree/enumeration/inheritance/driver.cxx index 358f61d..0a6d5d2 100644 --- a/xsd/tests/cxx/tree/enumeration/inheritance/driver.cxx +++ b/xsd/tests/cxx/tree/enumeration/inheritance/driver.cxx @@ -1,12 +1,12 @@ // file : tests/cxx/tree/enumeration/inheritance/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 // Insert test description here. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr +#include <cassert> #include <iostream> #include "test.hxx" @@ -25,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr<top_bottom> r (root (argv[1])); + XSD_AUTO_PTR<top_bottom> r (root (argv[1])); switch (*r) { @@ -39,6 +39,11 @@ main (int argc, char* argv[]) cout << "bottom" << endl; break; } + default: // Suppress warning. + { + assert (false); + break; + } } } catch (xml_schema::exception const& e) diff --git a/xsd/tests/cxx/tree/enumeration/inheritance/makefile b/xsd/tests/cxx/tree/enumeration/inheritance/makefile index c29b0f8..77df855 100644 --- a/xsd/tests/cxx/tree/enumeration/inheritance/makefile +++ b/xsd/tests/cxx/tree/enumeration/inheritance/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/enumeration/inheritance/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,17 +26,17 @@ $(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 +$(gen): xsd_options += --generate-ostream $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/enumeration/makefile b/xsd/tests/cxx/tree/enumeration/makefile index 5730a08..8f55b20 100644 --- a/xsd/tests/cxx/tree/enumeration/makefile +++ b/xsd/tests/cxx/tree/enumeration/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/enumeration/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/float/driver.cxx b/xsd/tests/cxx/tree/float/driver.cxx index d2ec1dd..a71d2f3 100644 --- a/xsd/tests/cxx/tree/float/driver.cxx +++ b/xsd/tests/cxx/tree/float/driver.cxx @@ -1,13 +1,12 @@ // file : tests/cxx/tree/float/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 floating point (xsd:{float, double, decimal}) type parsing // and serialization. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <iostream> #include "test.hxx" @@ -26,7 +25,7 @@ main (int argc, char* argv[]) try { - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); r->simple ().push_back (12.129456); r->simple ().push_back (123.129456); diff --git a/xsd/tests/cxx/tree/float/makefile b/xsd/tests/cxx/tree/float/makefile index 21966ba..a585afb 100644 --- a/xsd/tests/cxx/tree/float/makefile +++ b/xsd/tests/cxx/tree/float/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/float/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,17 +26,17 @@ $(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-serialization --root-element-all +$(gen): xsd_options += --generate-serialization --root-element-all $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/float/test.std b/xsd/tests/cxx/tree/float/test.std index 44264c2..399e28c 100644 --- a/xsd/tests/cxx/tree/float/test.std +++ b/xsd/tests/cxx/tree/float/test.std @@ -1,68 +1,35 @@ <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <t:root xmlns:t="test" de="0" do="0" f="0" s="12.13"> - <float>0</float> - <float>1</float> - <float>1e+06</float> - <float>1e-07</float> - <float-list>0 1 1e+06 1e-07</float-list> - <double>0</double> - <double>1</double> - <double>100000000000000</double> - <double>1e-15</double> - <double-list>0 1 100000000000000 1e-15</double-list> - <decimal>0</decimal> - <decimal>1</decimal> - <decimal>10000</decimal> - <decimal>100000000000000</decimal> - <decimal>0.000000000000001</decimal> - <decimal-list>0 1 100000000000000 0.000000000000001</decimal-list> - <simple>0</simple> - <simple>1</simple> - <simple>12.34</simple> - <simple>0.12</simple> - <simple>12.13</simple> - <simple>123.1</simple> - <simple>1234</simple> - <complex>0</complex> - <complex>1</complex> - <complex>12.34</complex> - <complex>0.12</complex> - <complex>12.13</complex> - <complex>123.1</complex> - <complex>1234</complex> - <complex>-12.12</complex> - <complex>-123.1</complex> - </t:root> diff --git a/xsd/tests/cxx/tree/list/ctor/driver.cxx b/xsd/tests/cxx/tree/list/ctor/driver.cxx index 81743e8..784ae01 100644 --- a/xsd/tests/cxx/tree/list/ctor/driver.cxx +++ b/xsd/tests/cxx/tree/list/ctor/driver.cxx @@ -1,6 +1,5 @@ // file : tests/cxx/tree/list/ctor/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 list constructors. diff --git a/xsd/tests/cxx/tree/list/ctor/makefile b/xsd/tests/cxx/tree/list/ctor/makefile index cfda43a..4115606 100644 --- a/xsd/tests/cxx/tree/list/ctor/makefile +++ b/xsd/tests/cxx/tree/list/ctor/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/list/ctor/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-default-ctor --generate-from-base-ctor \ +$(gen): xsd_options += --generate-default-ctor --generate-from-base-ctor \ --generate-doxygen $(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/list/makefile b/xsd/tests/cxx/tree/list/makefile index ae6bb0a..4af3e22 100644 --- a/xsd/tests/cxx/tree/list/makefile +++ b/xsd/tests/cxx/tree/list/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/list/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/makefile b/xsd/tests/cxx/tree/makefile index 9b79424..7fd9f63 100644 --- a/xsd/tests/cxx/tree/makefile +++ b/xsd/tests/cxx/tree/makefile @@ -1,30 +1,32 @@ # file : tests/cxx/tree/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 -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 := \ +any-type \ +built-in \ +chameleon \ +comparison \ +compilation \ +complex \ +containment \ +default \ +detach \ +dom-association \ +encoding \ +enumeration \ +float \ +list \ +name-clash \ +naming \ +order \ +polymorphism \ +prefix \ +test-template \ +types-only \ +union \ wildcard ifeq ($(xsd_with_ace),y) diff --git a/xsd/tests/cxx/tree/name-clash/inheritance/driver.cxx b/xsd/tests/cxx/tree/name-clash/inheritance/driver.cxx index 70e6fc6..07e0c00 100644 --- a/xsd/tests/cxx/tree/name-clash/inheritance/driver.cxx +++ b/xsd/tests/cxx/tree/name-clash/inheritance/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/name-clash/inheritance/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 for name clashes across inheritance hierarchy. // -#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<derived> r (root (argv[1])); + XSD_AUTO_PTR<derived> r (root (argv[1])); cout << *r << endl; } diff --git a/xsd/tests/cxx/tree/name-clash/inheritance/makefile b/xsd/tests/cxx/tree/name-clash/inheritance/makefile index b983d91..ea05693 100644 --- a/xsd/tests/cxx/tree/name-clash/inheritance/makefile +++ b/xsd/tests/cxx/tree/name-clash/inheritance/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/name-clash/inheritance/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,17 +26,17 @@ $(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 +$(gen): xsd_options += --generate-ostream $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/name-clash/makefile b/xsd/tests/cxx/tree/name-clash/makefile index ef2fdf0..c9a4d0f 100644 --- a/xsd/tests/cxx/tree/name-clash/makefile +++ b/xsd/tests/cxx/tree/name-clash/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/name-clash/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/naming/camel/driver.cxx b/xsd/tests/cxx/tree/naming/camel/driver.cxx index 96b88d5..716a544 100644 --- a/xsd/tests/cxx/tree/naming/camel/driver.cxx +++ b/xsd/tests/cxx/tree/naming/camel/driver.cxx @@ -1,12 +1,10 @@ // file : tests/cxx/tree/naming/camel/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 camel case (upper for types, lower for functions) naming style. // -#include <memory> // std::auto_ptr #include <sstream> #include <iostream> @@ -29,6 +27,7 @@ main () { Gender::Value v; v = Gender::female; + XSD_UNUSED (v); } // Anonymous type. @@ -49,6 +48,8 @@ main () // { Type::FooType* p = 0; + XSD_UNUSED (p); + Type::FooOptional o; if (t.foo ().present ()) @@ -61,6 +62,7 @@ main () // { Type::BarType* p = 0; + XSD_UNUSED (p); if (t.bar () != "bar") return 1; @@ -72,9 +74,13 @@ main () // { Type::BazType* p = 0; + XSD_UNUSED (p); + Type::BazSequence s; Type::BazIterator i (s.begin ()); Type::BazConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.baz () != s) return 1; @@ -88,6 +94,8 @@ main () Type::AnySequence s (t.domDocument ()); Type::AnyIterator i (s.begin ()); Type::AnyConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.any () != s) return 1; @@ -112,6 +120,8 @@ main () Type::AnyAttributeSet s (t.domDocument ()); Type::AnyAttributeIterator i (s.begin ()); Type::AnyAttributeConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.anyAttribute () != s) return 1; diff --git a/xsd/tests/cxx/tree/naming/camel/makefile b/xsd/tests/cxx/tree/naming/camel/makefile index e9ce149..6364196 100644 --- a/xsd/tests/cxx/tree/naming/camel/makefile +++ b/xsd/tests/cxx/tree/naming/camel/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/naming/camel/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,7 +26,7 @@ $(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) @@ -35,7 +34,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options := \ +$(gen): xsd_options += \ --type-naming ucc \ --function-naming lcc \ --generate-ostream \ @@ -45,7 +44,7 @@ $(gen): xsd_options := \ $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -82,7 +81,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/naming/java/driver.cxx b/xsd/tests/cxx/tree/naming/java/driver.cxx index 843acff..f35607a 100644 --- a/xsd/tests/cxx/tree/naming/java/driver.cxx +++ b/xsd/tests/cxx/tree/naming/java/driver.cxx @@ -1,12 +1,10 @@ // file : tests/cxx/tree/naming/java/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 Java naming style. // -#include <memory> // std::auto_ptr #include <sstream> #include <iostream> @@ -29,6 +27,7 @@ main () { Gender::Value v; v = Gender::female; + XSD_UNUSED (v); } // Anonymous type. @@ -49,6 +48,7 @@ main () // { Type::FooType* p = 0; + XSD_UNUSED (p); Type::FooOptional o; if (t.getFoo ().present ()) @@ -61,6 +61,7 @@ main () // { Type::BarType* p = 0; + XSD_UNUSED (p); if (t.getBar () != "bar") return 1; @@ -72,9 +73,13 @@ main () // { Type::BazType* p = 0; + XSD_UNUSED (p); + Type::BazSequence s; Type::BazIterator i (s.begin ()); Type::BazConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.getBaz () != s) return 1; @@ -88,6 +93,8 @@ main () Type::AnySequence s (t.getDomDocument ()); Type::AnyIterator i (s.begin ()); Type::AnyConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.getAny () != s) return 1; @@ -112,6 +119,8 @@ main () Type::AnyAttributeSet s (t.getDomDocument ()); Type::AnyAttributeIterator i (s.begin ()); Type::AnyAttributeConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.getAnyAttribute () != s) return 1; diff --git a/xsd/tests/cxx/tree/naming/java/makefile b/xsd/tests/cxx/tree/naming/java/makefile index f8e7d04..83d73e1 100644 --- a/xsd/tests/cxx/tree/naming/java/makefile +++ b/xsd/tests/cxx/tree/naming/java/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/naming/java/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,7 +26,7 @@ $(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) @@ -35,7 +34,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options := \ +$(gen): xsd_options += \ --type-naming java \ --function-naming java \ --generate-ostream \ @@ -45,7 +44,7 @@ $(gen): xsd_options := \ $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -82,7 +81,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/naming/knr/driver.cxx b/xsd/tests/cxx/tree/naming/knr/driver.cxx index fff944b..5038d7b 100644 --- a/xsd/tests/cxx/tree/naming/knr/driver.cxx +++ b/xsd/tests/cxx/tree/naming/knr/driver.cxx @@ -1,12 +1,10 @@ // file : tests/cxx/tree/naming/knr/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 K&R naming style. // -#include <memory> // std::auto_ptr #include <sstream> #include <iostream> @@ -29,6 +27,7 @@ main () { gender::value v; v = gender::female; + XSD_UNUSED (v); } // Anonymous type. @@ -49,6 +48,8 @@ main () // { type::foo_type* p = 0; + XSD_UNUSED (p); + type::foo_optional o; if (t.foo ().present ()) @@ -61,6 +62,7 @@ main () // { type::bar_type* p = 0; + XSD_UNUSED (p); if (t.bar () != "bar") return 1; @@ -72,9 +74,13 @@ main () // { type::baz_type* p = 0; + XSD_UNUSED (p); + type::baz_sequence s; type::baz_iterator i (s.begin ()); type::baz_const_iterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.baz () != s) return 1; @@ -88,6 +94,8 @@ main () type::any_sequence s (t.dom_document ()); type::any_iterator i (s.begin ()); type::any_const_iterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.any () != s) return 1; @@ -112,6 +120,8 @@ main () type::any_attribute_set s (t.dom_document ()); type::any_attribute_iterator i (s.begin ()); type::any_attribute_const_iterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); if (t.any_attribute () != s) return 1; diff --git a/xsd/tests/cxx/tree/naming/knr/makefile b/xsd/tests/cxx/tree/naming/knr/makefile index ac9e75e..d8ecbab 100644 --- a/xsd/tests/cxx/tree/naming/knr/makefile +++ b/xsd/tests/cxx/tree/naming/knr/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/naming/knr/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,7 +26,7 @@ $(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) @@ -35,7 +34,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options := \ +$(gen): xsd_options += \ --type-naming knr \ --function-naming knr \ --generate-ostream \ @@ -45,7 +44,7 @@ $(gen): xsd_options := \ $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -82,7 +81,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/naming/makefile b/xsd/tests/cxx/tree/naming/makefile index 90bd7d3..60ac63b 100644 --- a/xsd/tests/cxx/tree/naming/makefile +++ b/xsd/tests/cxx/tree/naming/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/naming/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/order/driver.cxx b/xsd/tests/cxx/tree/order/driver.cxx new file mode 100644 index 0000000..01d8d9f --- /dev/null +++ b/xsd/tests/cxx/tree/order/driver.cxx @@ -0,0 +1,65 @@ +// file : tests/cxx/tree/order/driver.cxx +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test ordered type support. +// + +#include <memory> // std::auto_ptr/unique_ptr +#include <cassert> +#include <iostream> + +#include <xercesc/dom/DOM.hpp> +#include <xercesc/util/PlatformUtils.hpp> + +#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; + } + + XMLPlatformUtils::Initialize (); + + try + { + XSD_AUTO_PTR<root> r (root_ (argv[1], xml_schema::flags::dont_initialize)); + + root c (*r); + assert (c == *r); + + for (root::t1_const_iterator j (r->t1 ().begin ()); + j != r->t1 ().end (); ++j) + { + const t1_derived& d (*j); + + for (t1_derived::content_order_const_iterator i ( + d.content_order ().begin ()); i != d.content_order ().end (); ++i) + { + cout << i->id << ' ' << i->index << endl; + } + } + + xml_schema::namespace_infomap map; + + map["t"].name = "test"; + map["t1"].name = "test1"; + + root_ (cout, *r, map, "UTF-8", xml_schema::flags::dont_initialize); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } + + XMLPlatformUtils::Terminate (); +} diff --git a/xsd/tests/cxx/tree/order/makefile b/xsd/tests/cxx/tree/order/makefile new file mode 100644 index 0000000..0dff0f9 --- /dev/null +++ b/xsd/tests/cxx/tree/order/makefile @@ -0,0 +1,94 @@ +# file : tests/cxx/tree/order/makefile +# 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 + +xsd := test.xsd +cxx := driver.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) + +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-serialization --generate-wildcard \ +--generate-comparison \ +--ordered-type t1_base --ordered-type t1_derived \ +--ordered-type t2_base --ordered-type t2_derived \ +--ordered-type t3_type \ +--ordered-type t4_base --ordered-type t4_derived \ +--ordered-type t5_base --ordered-type t5_derived \ +--ordered-type t6_base --ordered-type t6_derived \ +--ordered-type t7_type +$(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) + +$(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. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/xsd/tests/cxx/tree/order/output b/xsd/tests/cxx/tree/order/output new file mode 100644 index 0000000..73442fe --- /dev/null +++ b/xsd/tests/cxx/tree/order/output @@ -0,0 +1,92 @@ +2 0 +1 0 +1 1 +2 1 +3 0 +4 0 +3 1 +4 1 +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<t:root xmlns:t="test" xmlns:t1="test1"> + <t1> + <b>b1</b> + <a>a1</a> + <a>a2</a> + <b>b2</b> + <c>c1</c> + <d>d1</d> + <t1:e>e1</t1:e> + <d>d2</d> + <t1:f>f1</t1:f> + </t1> + <t2> + <b>b1</b> + <a>a1</a> + <b>b2</b> + <a>a2</a> + </t2> + <t3> + <a>a1</a> + <b>b1</b> + <c>c1</c> + <c>c2</c> + </t3> + <t3> + <a>a1</a> + <c>c1</c> + </t3> + <t4> + t1 + + <b>b1</b> + t2 + + <a>a1</a> + t3 + + <b>b2</b> + t4 + + <a>a2</a> + t5 + + <t1:d>d1</t1:d> + t6 + + <c>c1</c> + t7 + + </t4> + <t5a> + t5a + </t5a> + <t5b> + t1 + + <b>b1</b> + t2 + + <a>a1</a> + t3 + + <a>a2</a> + t4 + + <b>b2</b> + t5 + + </t5b> + <t6> + t6 + </t6> + <t7> + t1 + + <t1:a>a1</t1:a> + t2 + + <t1:b>b1</t1:b> + t3 + + </t7> +</t:root> diff --git a/xsd/tests/cxx/tree/order/test.xml b/xsd/tests/cxx/tree/order/test.xml new file mode 100644 index 0000000..cd82936 --- /dev/null +++ b/xsd/tests/cxx/tree/order/test.xml @@ -0,0 +1,71 @@ +<t:root xmlns:t="test" + xmlns:t1="test1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="test test.xsd"> + <t1> + <b>b1</b> + <a>a1</a> + <a>a2</a> + <b>b2</b> + <c>c1</c> + <d>d1</d> + <t1:e>e1</t1:e> + <d>d2</d> + <t1:f>f1</t1:f> + </t1> + <t2> + <b>b1</b> + <a>a1</a> + <b>b2</b> + <a>a2</a> + </t2> + <t3> + <a>a1</a> + <b>b1</b> + <c>c1</c> + <c>c2</c> + </t3> + <t3> + <a>a1</a> + <c>c1</c> + </t3> + <t4> + t1 + <b>b1</b> + t2 + <a>a1</a> + t3 + <b>b2</b> + t4 + <a>a2</a> + t5 + <t1:d>d1</t1:d> + t6 + <c>c1</c> + t7 + </t4> + <t5a> + t5a + </t5a> + <t5b> + t1 + <b>b1</b> + t2 + <a>a1</a> + t3 + <a>a2</a> + t4 + <b>b2</b> + t5 + </t5b> + <t6> + t6 + </t6> + <t7> + t1 + <t1:a>a1</t1:a> + t2 + <t1:b>b1</t1:b> + t3 + </t7> +</t:root> diff --git a/xsd/tests/cxx/tree/order/test.xsd b/xsd/tests/cxx/tree/order/test.xsd new file mode 100644 index 0000000..c30c027 --- /dev/null +++ b/xsd/tests/cxx/tree/order/test.xsd @@ -0,0 +1,130 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + + <!-- Test 1: general, with non-ordered intermediate. --> + + <complexType name="t1_base"> + <choice minOccurs="0" maxOccurs="unbounded"> + <element name="a" type="string"/> + <element name="b" type="string"/> + </choice> + </complexType> + + <complexType name="t1_interm"> + <complexContent> + <extension base="t:t1_base"> + <sequence> + <element name="c" type="string" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + </extension> + </complexContent> + </complexType> + + <complexType name="t1_derived"> + <complexContent> + <extension base="t:t1_interm"> + <choice minOccurs="0" maxOccurs="unbounded"> + <element name="d" type="string"/> + <any namespace="##other" processContents="lax"/> + </choice> + </extension> + </complexContent> + </complexType> + + <!-- Test 2: empty base. --> + + <complexType name="t2_base"/> + + <complexType name="t2_derived"> + <complexContent> + <extension base="t:t2_base"> + <choice minOccurs="0" maxOccurs="unbounded"> + <element name="a" type="string"/> + <element name="b" type="string"/> + </choice> + </extension> + </complexContent> + </complexType> + + <!-- Test 3: element cardinalities. --> + + <complexType name="t3_type"> + <sequence> + <element name="a" type="string"/> + <element name="b" type="string" minOccurs="0"/> + <element name="c" type="string" maxOccurs="unbounded"/> + </sequence> + </complexType> + + + <!-- Test 4: mixed content, general. --> + + <complexType name="t4_base" mixed="true"> + <choice minOccurs="0" maxOccurs="unbounded"> + <element name="a" type="string"/> + <element name="b" type="string"/> + </choice> + </complexType> + + <complexType name="t4_derived"> + <complexContent mixed="true"> + <extension base="t:t4_base"> + <choice minOccurs="0" maxOccurs="unbounded"> + <element name="c" type="string"/> + <any namespace="##other" processContents="lax"/> + </choice> + </extension> + </complexContent> + </complexType> + + <!-- Test 5: mixed content, empty base. --> + + <complexType name="t5_base" mixed="true"/> + + <complexType name="t5_derived"> + <complexContent mixed="true"> + <extension base="t:t5_base"> + <choice minOccurs="0" maxOccurs="unbounded"> + <element name="a" type="string"/> + <element name="b" type="string"/> + </choice> + </extension> + </complexContent> + </complexType> + + <!-- Test 6: mixed content, empty base and derived. --> + + <complexType name="t6_base" mixed="true"/> + + <complexType name="t6_derived"> + <complexContent mixed="true"> + <extension base="t:t6_base"/> + </complexContent> + </complexType> + + <!-- Test 7: mixed content wildcard only. --> + + <complexType name="t7_type" mixed="true"> + <sequence> + <any namespace="##other" processContents="lax" maxOccurs="unbounded"/> + </sequence> + </complexType> + + <!-- Root --> + + <complexType name="root"> + <sequence> + <element name="t1" type="t:t1_derived" maxOccurs="unbounded"/> + <element name="t2" type="t:t2_derived" maxOccurs="unbounded"/> + <element name="t3" type="t:t3_type" maxOccurs="unbounded"/> + <element name="t4" type="t:t4_derived" maxOccurs="unbounded"/> + <element name="t5a" type="t:t5_base" maxOccurs="unbounded"/> + <element name="t5b" type="t:t5_derived" maxOccurs="unbounded"/> + <element name="t6" type="t:t6_derived" maxOccurs="unbounded"/> + <element name="t7" type="t:t7_type" maxOccurs="unbounded"/> + </sequence> + </complexType> + + <element name="root" type="t:root"/> + +</schema> 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. diff --git a/xsd/tests/cxx/tree/prefix/driver.cxx b/xsd/tests/cxx/tree/prefix/driver.cxx index 3ce9832..244f815 100644 --- a/xsd/tests/cxx/tree/prefix/driver.cxx +++ b/xsd/tests/cxx/tree/prefix/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/prefix/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 automatic prefix assignment. // -#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])); root (std::cout, *r); } catch (xml_schema::exception const& e) diff --git a/xsd/tests/cxx/tree/prefix/makefile b/xsd/tests/cxx/tree/prefix/makefile index 3317161..688111e 100644 --- a/xsd/tests/cxx/tree/prefix/makefile +++ b/xsd/tests/cxx/tree/prefix/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/prefix/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-serialization --generate-polymorphic \ ---polymorphic-type foo\\\#base --root-element root +$(gen): xsd_options += --generate-serialization --generate-polymorphic \ +--polymorphic-type foo\#base --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. diff --git a/xsd/tests/cxx/tree/prefix/output b/xsd/tests/cxx/tree/prefix/output index 4f40f49..9801a23 100644 --- a/xsd/tests/cxx/tree/prefix/output +++ b/xsd/tests/cxx/tree/prefix/output @@ -1,22 +1,18 @@ <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <p1:root xmlns:p1="test"> - <a xmlns:p3="bar" p3:abar="456" xmlns:p2="foo"> <p2:efoo>123</p2:efoo> </a> - <b xmlns:p2="bar"> <p2:derived> <x>1</x> <y>2</y> </p2:derived> </b> - <c xmlns:p2="foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <p2:base xmlns:p3="bar" xsi:type="p3:derived2"> <x>1</x> <z>2</z> </p2:base> </c> - </p1:root> diff --git a/xsd/tests/cxx/tree/test-template/driver.cxx b/xsd/tests/cxx/tree/test-template/driver.cxx index f36cc10..f28e501 100644 --- a/xsd/tests/cxx/tree/test-template/driver.cxx +++ b/xsd/tests/cxx/tree/test-template/driver.cxx @@ -1,12 +1,11 @@ // file : tests/cxx/tree/test-template/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 // Insert test description here. // -#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/test-template/makefile b/xsd/tests/cxx/tree/test-template/makefile index f94665a..32af96b 100644 --- a/xsd/tests/cxx/tree/test-template/makefile +++ b/xsd/tests/cxx/tree/test-template/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/test-template/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,17 +26,17 @@ $(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 +$(gen): xsd_options += --generate-ostream $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/types-only/driver.cxx b/xsd/tests/cxx/tree/types-only/driver.cxx index b0caf72..8ba7500 100644 --- a/xsd/tests/cxx/tree/types-only/driver.cxx +++ b/xsd/tests/cxx/tree/types-only/driver.cxx @@ -1,13 +1,11 @@ // file : tests/cxx/tree/types-only/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 that code generated without parsing and serialization functions // still compiles. // -#include <memory> // std::auto_ptr #include <iostream> #include "test.hxx" diff --git a/xsd/tests/cxx/tree/types-only/makefile b/xsd/tests/cxx/tree/types-only/makefile index 972de5a..25520a4 100644 --- a/xsd/tests/cxx/tree/types-only/makefile +++ b/xsd/tests/cxx/tree/types-only/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/types-only/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,17 +26,17 @@ $(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 := --suppress-parsing +$(gen): xsd_options += --suppress-parsing $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen)) # Convenience alias for default target. # @@ -74,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/xsd/tests/cxx/tree/union/ctor/driver.cxx b/xsd/tests/cxx/tree/union/ctor/driver.cxx index 0aa22ab..14a8565 100644 --- a/xsd/tests/cxx/tree/union/ctor/driver.cxx +++ b/xsd/tests/cxx/tree/union/ctor/driver.cxx @@ -1,6 +1,5 @@ // file : tests/cxx/tree/union/ctor/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 union constructors. diff --git a/xsd/tests/cxx/tree/union/ctor/makefile b/xsd/tests/cxx/tree/union/ctor/makefile index 234ee45..1edd762 100644 --- a/xsd/tests/cxx/tree/union/ctor/makefile +++ b/xsd/tests/cxx/tree/union/ctor/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/union/ctor/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-default-ctor --generate-from-base-ctor \ +$(gen): xsd_options += --generate-default-ctor --generate-from-base-ctor \ --generate-doxygen $(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/union/makefile b/xsd/tests/cxx/tree/union/makefile index 5d61aa7..59abec6 100644 --- a/xsd/tests/cxx/tree/union/makefile +++ b/xsd/tests/cxx/tree/union/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/union/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/wildcard/driver.cxx b/xsd/tests/cxx/tree/wildcard/driver.cxx index 5bd8229..e2db827 100644 --- a/xsd/tests/cxx/tree/wildcard/driver.cxx +++ b/xsd/tests/cxx/tree/wildcard/driver.cxx @@ -1,18 +1,20 @@ // file : tests/cxx/tree/wildcard/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 wildcard (any & anyAttribute) mapping. // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr #include <sstream> #include <iostream> -#include <xsd/cxx/xml/string.hxx> +#include <xercesc/dom/DOM.hpp> +#include <xercesc/util/PlatformUtils.hpp> + +#include "test.hxx" // Get XSD_CXX11 defined. -#include "test.hxx" +#include <xsd/cxx/xml/string.hxx> using namespace std; using namespace test; @@ -170,7 +172,7 @@ main (int argc, char* argv[]) // Test parsing // - auto_ptr<type> r (root (argv[1])); + XSD_AUTO_PTR<type> r (root (argv[1])); print (*r); // Test serialization. @@ -187,7 +189,7 @@ main (int argc, char* argv[]) // cout << iostr.str () << endl // << endl; - auto_ptr<type> copy (root (iostr, argv[1])); + XSD_AUTO_PTR<type> copy (root (iostr, argv[1])); assert (*copy == *r); print (*copy); diff --git a/xsd/tests/cxx/tree/wildcard/makefile b/xsd/tests/cxx/tree/wildcard/makefile index b7b114f..b86c34a 100644 --- a/xsd/tests/cxx/tree/wildcard/makefile +++ b/xsd/tests/cxx/tree/wildcard/makefile @@ -1,6 +1,5 @@ # file : tests/cxx/tree/wildcard/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-wildcard --generate-default-ctor \ +$(gen): xsd_options += --generate-wildcard --generate-default-ctor \ --generate-from-base-ctor --generate-serialization --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. |