diff options
Diffstat (limited to 'xsd/tests/cxx/parser/generated-impl')
| -rw-r--r-- | xsd/tests/cxx/parser/generated-impl/makefile | 90 | ||||
| -rw-r--r-- | xsd/tests/cxx/parser/generated-impl/output | 122 | ||||
| -rw-r--r-- | xsd/tests/cxx/parser/generated-impl/test.xml | 168 | ||||
| -rw-r--r-- | xsd/tests/cxx/parser/generated-impl/test.xsd | 142 | 
4 files changed, 522 insertions, 0 deletions
| diff --git a/xsd/tests/cxx/parser/generated-impl/makefile b/xsd/tests/cxx/parser/generated-impl/makefile new file mode 100644 index 0000000..3733590 --- /dev/null +++ b/xsd/tests/cxx/parser/generated-impl/makefile @@ -0,0 +1,90 @@ +# file      : tests/cxx/parser/generated-impl/makefile +# author    : Boris Kolpackov <boris@codesynthesis.com> +# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make + +xsd := test.xsd + +obj := $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.o) $(xsd:.xsd=-pimpl.o) $(xsd:.xsd=-driver.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/$(xsd:.xsd=-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$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +genf := $(xsd:.xsd=-pskel.hxx)  \ +        $(xsd:.xsd=-pskel.ixx)  \ +        $(xsd:.xsd=-pskel.cxx)  \ +        $(xsd:.xsd=-pimpl.hxx)  \ +	$(xsd:.xsd=-pimpl.cxx)  \ +	$(xsd:.xsd=-driver.cxx) + +gen  := $(addprefix $(out_base)/,$(genf)) + + +$(gen): xsd := $(out_root)/xsd/xsd +$(gen): xsd_options := --generate-print-impl --generate-test-driver \ +--force-overwrite +$(gen): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# 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=-pskel.cxx.xsd.clean)) \ +  $(addprefix $(out_base)/,$(xsd:.xsd=-pimpl.cxx.xsd.clean)) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(gen): | $(out_base)/.gitignore +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := $(xsd:.xsd=-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) + +xsd_parser_impl_suffix := -pimpl +$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/xsd/tests/cxx/parser/generated-impl/output b/xsd/tests/cxx/parser/generated-impl/output new file mode 100644 index 0000000..7c58647 --- /dev/null +++ b/xsd/tests/cxx/parser/generated-impl/output @@ -0,0 +1,122 @@ +gender: male +foo: foo +gender: male +int: 0 +int: 1 +int: 2 +int: 3 +foo: foo +int: 3 +int: 2 +int: 1 +int: 0 +union: 9 +foo: foo +union: string +x: x +a: aaa +x: x +y: y +a: aaa +b: bbb +boolean: 1 +boolean: 0 +boolean: 1 +boolean: 0 +byte: 0 +byte: 123 +byte: -123 +unsigned-byte: 0 +unsigned-byte: 123 +short: 0 +short: -1234 +short: 1234 +unsigned-short: 0 +unsigned-short: 1234 +int: 0 +int: -12345 +int: 12345 +unsigned-int: 0 +unsigned-int: 12345 +long: 0 +long: -123456 +long: 123456 +unsigned-long: 0 +unsigned-long: 123456 +integer: 0 +integer: -123456 +integer: 123456 +negative-integer: -123456 +non-positive-integer: 0 +non-positive-integer: -123456 +positive-integer: 123456 +non-negative-integer: 0 +non-negative-integer: 123456 +float: 0 +float: 1.123 +float: -1.123 +double: 0 +double: 1.1234 +double: -1.1234 +decimal: 0 +decimal: 1.1234 +decimal: -1.1234 +string: string space newline +normalized-string: string space newline +token: string space newline +name: as123:345-.abs +nmtoken: 1as123:345-.abs +nmtokens: abc 123 +ncname: as123_345-.abs +id: abc +id: a123 +idref: abc +idrefs: abc a123 +language: en +language: en-us +uri: http://www.example.com/foo#bar +qname: schemaLocation +qname: xsi:schemaLocation +base64_binary: 10 bytes +base64_binary: 1 bytes +base64_binary: 2 bytes +base64_binary: 3 bytes +hex_binary: 0 bytes +hex_binary: 10 bytes +gday: ---12+12:0 +gday: ---1 +gday: ---31 +gday: ---15+0:0 +gday: ---15-14:0 +gmonth: --10+12:0 +gmonth: --1 +gmonth: --12+0:0 +gyear: 2007+12:0 +gyear: 1 +gyear: -20000+0:0 +gmonth_day: --10-28+12:0 +gmonth_day: --12-31 +gmonth_day: --1-1+0:0 +gyear_month: 2007-12+12:0 +gyear_month: -2007-10 +gyear_month: 20007-10+0:0 +gyear_month: -20007-1 +date: 2007-12-26+12:0 +date: -2007-10-15 +date: 20007-12-31+0:0 +date: -20007-1-1 +time: 12:46:23.456+12:0 +time: 12:13:14 +time: 12:13:14+0:0 +date_time: 2007-12-26T12:13:14.123+12:0 +date_time: -2007-10-15T12:13:14 +date_time: 20007-12-31T12:13:14+0:0 +date_time: -20007-1-1T12:13:14 +duration: -P2007Y13M32DT25H61M61.123S +duration: P1Y0M0DT0H0M0S +duration: P0Y1M0DT0H0M0S +duration: P0Y0M1DT0H0M0S +duration: P0Y0M0DT1H0M0S +duration: P0Y0M0DT0H1M0S +duration: P0Y0M0DT0H0M1.1S +duration: P1Y0M0DT0H0M1S diff --git a/xsd/tests/cxx/parser/generated-impl/test.xml b/xsd/tests/cxx/parser/generated-impl/test.xml new file mode 100644 index 0000000..2f29a39 --- /dev/null +++ b/xsd/tests/cxx/parser/generated-impl/test.xml @@ -0,0 +1,168 @@ +<t:root xmlns:t="test" +        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +        xsi:schemaLocation="test test.xsd"> + +  <gender>male</gender> +  <gender-extension foo="foo">male</gender-extension> + +  <list>0 1 2 3</list> +  <list-extension foo="foo">3 2 1 0</list-extension> + +  <union>9</union> +  <union-extension foo="foo">string</union-extension> + +  <complex x="x"> +    <a>aaa</a> +  </complex> + +  <complex-extension x="x" y="y"> +    <a>aaa</a> +    <b>bbb</b> +  </complex-extension> + +  <any-type>aaa<b>bbb</b>ccc</any-type> +  <any-simple-type>abc123</any-simple-type> + +  <boolean>1</boolean> +  <boolean> 0 </boolean> +  <boolean>true</boolean> +  <boolean> false </boolean> + +  <byte>0</byte> +  <byte>123</byte> +  <byte>-123</byte> + +  <unsigned-byte>0</unsigned-byte> +  <unsigned-byte>123</unsigned-byte> + +  <short>0</short> +  <short>-1234</short> +  <short>1234</short> + +  <unsigned-short>0</unsigned-short> +  <unsigned-short>1234</unsigned-short> + +  <int>0</int> +  <int>-12345</int> +  <int>12345</int> + +  <unsigned-int>0</unsigned-int> +  <unsigned-int>12345</unsigned-int> + +  <long>0</long> +  <long>-123456</long> +  <long>123456</long> + +  <unsigned-long>0</unsigned-long> +  <unsigned-long>123456</unsigned-long> + +  <integer>0</integer> +  <integer>-123456</integer> +  <integer>123456</integer> + +  <negative-integer>-123456</negative-integer> + +  <non-positive-integer>0</non-positive-integer> +  <non-positive-integer>-123456</non-positive-integer> + +  <positive-integer>123456</positive-integer> + +  <non-negative-integer>0</non-negative-integer> +  <non-negative-integer>123456</non-negative-integer> + +  <float>0</float> +  <float>1.123</float> +  <float>-1.123</float> + +  <double>0</double> +  <double>1.1234</double> +  <double>-1.1234</double> + +  <decimal>0</decimal> +  <decimal>1.1234</decimal> +  <decimal>-1.1234</decimal> + +  <string>string space newline</string> + +  <normalized-string>string space newline</normalized-string> + +  <token> string space newline</token> + +  <name>as123:345-.abs</name> + +  <nmtoken>1as123:345-.abs</nmtoken> + +  <nmtokens>abc 123</nmtokens> + +  <ncname>as123_345-.abs</ncname> + +  <id>abc</id> +  <id>a123</id> + +  <idref>abc</idref> + +  <idrefs>abc a123</idrefs> + +  <language>en</language> +  <language>en-us</language> + +  <uri>http://www.example.com/foo#bar</uri> + +  <qname>schemaLocation</qname> +  <qname>xsi:schemaLocation</qname> + +  <base64_binary>MTIzNDVhYmNqaw==</base64_binary> +  <base64_binary>YQ==</base64_binary> +  <base64_binary>YWI=</base64_binary> +  <base64_binary>YWJj</base64_binary> + +  <hex_binary></hex_binary> +  <hex_binary>31323334356162636a6b</hex_binary> + +  <gday>---12+12:00</gday> +  <gday>---01</gday> +  <gday>---31</gday> +  <gday>---15Z</gday> +  <gday>---15-14:00</gday> + +  <gmonth>--10+12:00</gmonth> +  <gmonth>--01</gmonth> +  <gmonth>--12Z</gmonth> + +  <gyear>2007+12:00</gyear> +  <gyear>0001</gyear> +  <gyear>-20000Z</gyear> + +  <gmonth_day>--10-28+12:00</gmonth_day> +  <gmonth_day>--12-31</gmonth_day> +  <gmonth_day>--01-01Z</gmonth_day> + +  <gyear_month>2007-12+12:00</gyear_month> +  <gyear_month>-2007-10</gyear_month> +  <gyear_month>20007-10Z</gyear_month> +  <gyear_month>-20007-01</gyear_month> + +  <date>2007-12-26+12:00</date> +  <date>-2007-10-15</date> +  <date>20007-12-31Z</date> +  <date>-20007-01-01</date> + +  <time>12:46:23.456+12:00</time> +  <time>12:13:14</time> +  <time>12:13:14Z</time> + +  <date_time>2007-12-26T12:13:14.123+12:00</date_time> +  <date_time>-2007-10-15T12:13:14</date_time> +  <date_time>20007-12-31T12:13:14Z</date_time> +  <date_time>-20007-01-01T12:13:14</date_time> + +  <duration>-P2007Y13M32DT25H61M61.123S</duration> +  <duration>P1Y</duration> +  <duration>P1M</duration> +  <duration>P1D</duration> +  <duration>PT1H</duration> +  <duration>PT1M</duration> +  <duration>PT1.1S</duration> +  <duration>P1YT1S</duration> + +</t:root> diff --git a/xsd/tests/cxx/parser/generated-impl/test.xsd b/xsd/tests/cxx/parser/generated-impl/test.xsd new file mode 100644 index 0000000..7bc8f23 --- /dev/null +++ b/xsd/tests/cxx/parser/generated-impl/test.xsd @@ -0,0 +1,142 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + +  <!-- enum --> + +  <simpleType name="gender"> +    <restriction base="string"> +      <enumeration value="male"/> +      <enumeration value="female"/> +    </restriction> +  </simpleType> + +  <complexType name="gender-extension"> +    <simpleContent> +      <extension base="t:gender"> +        <attribute name="foo" type="string"/> +      </extension> +    </simpleContent> +  </complexType> + +  <!-- list --> + +  <simpleType name="list"> +    <list itemType="int"/> +  </simpleType> + +  <complexType name="list-extension"> +    <simpleContent> +      <extension base="t:list"> +        <attribute name="foo" type="string"/> +      </extension> +    </simpleContent> +  </complexType> + +  <!-- union --> + +  <simpleType name="union"> +    <union memberTypes="int string"/> +  </simpleType> + +  <complexType name="union-extension"> +    <simpleContent> +      <extension base="t:union"> +        <attribute name="foo" type="string"/> +      </extension> +    </simpleContent> +  </complexType> + +  <!-- complex --> + +  <complexType name="complex"> +    <sequence> +      <element name="a" type="string"/> +    </sequence> +    <attribute name="x" type="string"/> +  </complexType> + +  <complexType name="complex-extension"> +    <complexContent> +      <extension base="t:complex"> +        <sequence> +          <element name="b" type="string"/> +        </sequence> +        <attribute name="y" type="string"/> +      </extension> +    </complexContent> +  </complexType> + +  <complexType name="type"> +    <sequence> +      <element name="gender" type="t:gender"/> +      <element name="gender-extension" type="t:gender-extension"/> + +      <element name="list" type="t:list"/> +      <element name="list-extension" type="t:list-extension"/> + +      <element name="union" type="t:union"/> +      <element name="union-extension" type="t:union-extension"/> + +      <element name="complex" type="t:complex"/> +      <element name="complex-extension" type="t:complex-extension"/> + +      <!-- Built-in types. --> + +      <element name="any-type" type="anyType" maxOccurs="unbounded"/> +      <element name="any-simple-type" type="anySimpleType" maxOccurs="unbounded"/> + +      <element name="boolean" type="boolean" maxOccurs="unbounded"/> + +      <element name="byte" type="byte" maxOccurs="unbounded"/> +      <element name="unsigned-byte" type="unsignedByte" maxOccurs="unbounded"/> +      <element name="short" type="short" maxOccurs="unbounded"/> +      <element name="unsigned-short" type="unsignedShort" maxOccurs="unbounded"/> +      <element name="int" type="int" maxOccurs="unbounded"/> +      <element name="unsigned-int" type="unsignedInt" maxOccurs="unbounded"/> +      <element name="long" type="long" maxOccurs="unbounded"/> +      <element name="unsigned-long" type="unsignedLong" maxOccurs="unbounded"/> + +      <element name="integer" type="integer" maxOccurs="unbounded"/> +      <element name="negative-integer" type="negativeInteger" maxOccurs="unbounded"/> +      <element name="non-positive-integer" type="nonPositiveInteger" maxOccurs="unbounded"/> +      <element name="positive-integer" type="positiveInteger" maxOccurs="unbounded"/> +      <element name="non-negative-integer" type="nonNegativeInteger" maxOccurs="unbounded"/> + +      <element name="float" type="float" maxOccurs="unbounded"/> +      <element name="double" type="double" maxOccurs="unbounded"/> +      <element name="decimal" type="decimal" maxOccurs="unbounded"/> + +      <element name="string" type="string" maxOccurs="unbounded"/> +      <element name="normalized-string" type="normalizedString" maxOccurs="unbounded"/> +      <element name="token" type="token" maxOccurs="unbounded"/> +      <element name="name" type="Name" maxOccurs="unbounded"/> +      <element name="nmtoken" type="NMTOKEN" maxOccurs="unbounded"/> +      <element name="nmtokens" type="NMTOKENS" maxOccurs="unbounded"/> +      <element name="ncname" type="NCName" maxOccurs="unbounded"/> +      <element name="id" type="ID" maxOccurs="unbounded"/> +      <element name="idref" type="IDREF" maxOccurs="unbounded"/> +      <element name="idrefs" type="IDREFS" maxOccurs="unbounded"/> + +      <element name="language" type="language" maxOccurs="unbounded"/> +      <element name="uri" type="anyURI" maxOccurs="unbounded"/> +      <element name="qname" type="QName" maxOccurs="unbounded"/> + +      <element name="base64_binary" type="base64Binary" maxOccurs="unbounded"/> +      <element name="hex_binary" type="hexBinary" maxOccurs="unbounded"/> + +      <element name="gday" type="gDay" maxOccurs="unbounded"/> +      <element name="gmonth" type="gMonth" maxOccurs="unbounded"/> +      <element name="gyear" type="gYear" maxOccurs="unbounded"/> +      <element name="gmonth_day" type="gMonthDay" maxOccurs="unbounded"/> +      <element name="gyear_month" type="gYearMonth" maxOccurs="unbounded"/> +      <element name="date" type="date" maxOccurs="unbounded"/> +      <element name="time" type="time" maxOccurs="unbounded"/> +      <element name="date_time" type="dateTime" maxOccurs="unbounded"/> +      <element name="duration" type="duration" maxOccurs="unbounded"/> + +    </sequence> +  </complexType> + +  <element name="root" type="t:type"/> + +</schema> | 
