summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libxsd/xsd/cxx/tree/containers.hxx30
-rw-r--r--libxsd/xsd/cxx/tree/list.hxx20
-rw-r--r--libxsd/xsd/cxx/tree/parsing.txx18
-rw-r--r--libxsd/xsd/cxx/tree/stream-extraction.hxx6
-rw-r--r--libxsd/xsd/cxx/tree/types.hxx21
-rw-r--r--tests/cxx/tree/containment/driver.cxx35
-rw-r--r--tests/cxx/tree/containment/makefile2
-rw-r--r--tests/cxx/tree/containment/test.xsd32
-rw-r--r--xsd/cxx/tree/stream-extraction-source.cxx2
-rw-r--r--xsd/cxx/tree/tree-header.cxx2
-rw-r--r--xsd/cxx/tree/tree-inline.cxx7
-rw-r--r--xsd/cxx/tree/tree-source.cxx6
12 files changed, 128 insertions, 53 deletions
diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx
index 7cb6bd3..0a05a5e 100644
--- a/libxsd/xsd/cxx/tree/containers.hxx
+++ b/libxsd/xsd/cxx/tree/containers.hxx
@@ -833,15 +833,15 @@ namespace xsd
{
}
- sequence_common (size_type n, const type& x)
- : flags_ (0), container_ (0)
+ sequence_common (size_type n, const type& x, container* c)
+ : flags_ (0), container_ (c)
{
assign (n, x);
}
template <typename I>
- sequence_common (const I& begin, const I& end)
- : flags_ (0), container_ (0)
+ sequence_common (const I& begin, const I& end, container* c)
+ : flags_ (0), container_ (c)
{
assign (begin, end);
}
@@ -1056,26 +1056,26 @@ namespace xsd
//
#ifdef _MSC_VER
explicit
- sequence (size_type n, const T& x = T ())
- : sequence_common (n, x)
+ sequence (size_type n, const T& x = T (), container* c = 0)
+ : sequence_common (n, x, c)
{
}
#else
explicit
- sequence (size_type n)
- : sequence_common (n, T ())
+ sequence (size_type n, container* c = 0)
+ : sequence_common (n, T (), c)
{
}
- sequence (size_type n, const T& x)
- : sequence_common (n, x)
+ sequence (size_type n, const T& x, container* c = 0)
+ : sequence_common (n, x, c)
{
}
#endif
template <typename I>
- sequence (const I& begin, const I& end)
- : sequence_common (begin, end)
+ sequence (const I& begin, const I& end, container* c = 0)
+ : sequence_common (begin, end, c)
{
}
@@ -1315,13 +1315,15 @@ namespace xsd
}
explicit
- sequence (typename base_sequence::size_type n, const T& x = T ())
+ sequence (typename base_sequence::size_type n,
+ const T& x = T (),
+ container* = 0)
: base_sequence (n, x)
{
}
template <typename I>
- sequence (const I& begin, const I& end)
+ sequence (const I& begin, const I& end, container* = 0)
: base_sequence (begin, end)
{
}
diff --git a/libxsd/xsd/cxx/tree/list.hxx b/libxsd/xsd/cxx/tree/list.hxx
index 75972c6..f4367c3 100644
--- a/libxsd/xsd/cxx/tree/list.hxx
+++ b/libxsd/xsd/cxx/tree/list.hxx
@@ -44,14 +44,16 @@ namespace xsd
{
}
- list (typename sequence<T>::size_type n, const T& x)
- : sequence<T> (n, x)
+ list (typename sequence<T>::size_type n,
+ const T& x,
+ container* c = 0)
+ : sequence<T> (n, x, c)
{
}
template<typename I>
- list (const I& b, const I& e)
- : sequence<T> (b, e)
+ list (const I& b, const I& e, container* c = 0)
+ : sequence<T> (b, e, c)
{
}
@@ -92,14 +94,14 @@ namespace xsd
}
explicit
- list (typename sequence<T>::size_type n, const T& x)
- : sequence<T> (n, x)
+ list (typename sequence<T>::size_type n, const T& x, container* c = 0)
+ : sequence<T> (n, x, c)
{
}
template<typename I>
- list (const I& b, const I& e)
- : sequence<T> (b, e)
+ list (const I& b, const I& e, container* c = 0)
+ : sequence<T> (b, e, c)
{
}
@@ -129,4 +131,4 @@ namespace xsd
}
}
-#endif // XSD_CXX_TREE_LIST_HXX
+#endif // XSD_CXX_TREE_LIST_HXX
diff --git a/libxsd/xsd/cxx/tree/parsing.txx b/libxsd/xsd/cxx/tree/parsing.txx
index ebbf17b..929bf02 100644
--- a/libxsd/xsd/cxx/tree/parsing.txx
+++ b/libxsd/xsd/cxx/tree/parsing.txx
@@ -503,14 +503,14 @@ namespace xsd
template <typename C, typename B, typename nmtoken>
nmtokens<C, B, nmtoken>::
nmtokens (const xercesc::DOMElement& e, flags f, container* c)
- : B (e, f, c), base_type (e, f, c)
+ : B (e, f, c), base_type (e, f, this)
{
}
template <typename C, typename B, typename nmtoken>
nmtokens<C, B, nmtoken>::
nmtokens (const xercesc::DOMAttr& a, flags f, container* c)
- : B (a, f, c), base_type (a, f, c)
+ : B (a, f, c), base_type (a, f, this)
{
}
@@ -520,7 +520,7 @@ namespace xsd
const xercesc::DOMElement* e,
flags f,
container* c)
- : B (s, e, f, c), base_type (s, e, f, c)
+ : B (s, e, f, c), base_type (s, e, f, this)
{
}
@@ -669,14 +669,14 @@ namespace xsd
template <typename C, typename B, typename idref>
idrefs<C, B, idref>::
idrefs (const xercesc::DOMElement& e, flags f, container* c)
- : B (e, f, c), base_type (e, f, c)
+ : B (e, f, c), base_type (e, f, this)
{
}
template <typename C, typename B, typename idref>
idrefs<C, B, idref>::
idrefs (const xercesc::DOMAttr& a, flags f, container* c)
- : B (a, f, c), base_type (a, f, c)
+ : B (a, f, c), base_type (a, f, this)
{
}
@@ -686,7 +686,7 @@ namespace xsd
const xercesc::DOMElement* e,
flags f,
container* c)
- : B (s, e, f, c), base_type (s, e, f, c)
+ : B (s, e, f, c), base_type (s, e, f, this)
{
}
@@ -890,14 +890,14 @@ namespace xsd
template <typename C, typename B, typename entity>
entities<C, B, entity>::
entities (const xercesc::DOMElement& e, flags f, container* c)
- : B (e, f, c), base_type (e, f, c)
+ : B (e, f, c), base_type (e, f, this)
{
}
template <typename C, typename B, typename entity>
entities<C, B, entity>::
entities (const xercesc::DOMAttr& a, flags f, container* c)
- : B (a, f, c), base_type (a, f, c)
+ : B (a, f, c), base_type (a, f, this)
{
}
@@ -907,7 +907,7 @@ namespace xsd
const xercesc::DOMElement* e,
flags f,
container* c)
- : B (s, e, f, c), base_type (s, e, f, c)
+ : B (s, e, f, c), base_type (s, e, f, this)
{
}
}
diff --git a/libxsd/xsd/cxx/tree/stream-extraction.hxx b/libxsd/xsd/cxx/tree/stream-extraction.hxx
index 861358d..0052054 100644
--- a/libxsd/xsd/cxx/tree/stream-extraction.hxx
+++ b/libxsd/xsd/cxx/tree/stream-extraction.hxx
@@ -152,7 +152,7 @@ namespace xsd
template <typename S>
inline nmtokens<C, B, nmtoken>::
nmtokens (istream<S>& s, flags f, container* c)
- : B (s, f, c), base_type (s, f, c)
+ : B (s, f, c), base_type (s, f, this)
{
}
@@ -219,7 +219,7 @@ namespace xsd
template <typename S>
inline idrefs<C, B, idref>::
idrefs (istream<S>& s, flags f, container* c)
- : B (s, f, c), base_type (s, f, c)
+ : B (s, f, c), base_type (s, f, this)
{
}
@@ -291,7 +291,7 @@ namespace xsd
template <typename S>
inline entities<C, B, entity>::
entities (istream<S>& s, flags f, container* c)
- : B (s, f, c), base_type (s, f, c)
+ : B (s, f, c), base_type (s, f, this)
{
}
}
diff --git a/libxsd/xsd/cxx/tree/types.hxx b/libxsd/xsd/cxx/tree/types.hxx
index 20bcbe4..0ca0f3e 100644
--- a/libxsd/xsd/cxx/tree/types.hxx
+++ b/libxsd/xsd/cxx/tree/types.hxx
@@ -1014,6 +1014,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
nmtokens ()
+ : base_type (0, this)
{
}
@@ -1024,7 +1025,7 @@ namespace xsd
* @param x An exemplar element to copy.
*/
nmtokens (typename base_type::size_type n, const nmtoken& x)
- : base_type (n, x)
+ : base_type (n, x, this)
{
}
@@ -1037,7 +1038,7 @@ namespace xsd
*/
template <typename I>
nmtokens (const I& begin, const I& end)
- : base_type (begin, end)
+ : base_type (begin, end, this)
{
}
@@ -1052,7 +1053,7 @@ namespace xsd
* For polymorphic object models use the @c _clone function instead.
*/
nmtokens (const nmtokens& x, flags f, container* c = 0)
- : B (x, f, c), base_type (x, f, c)
+ : B (x, f, c), base_type (x, f, this)
{
}
@@ -2482,6 +2483,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
idrefs ()
+ : base_type (0, this)
{
}
@@ -2492,7 +2494,7 @@ namespace xsd
* @param x An exemplar element to copy.
*/
idrefs (typename base_type::size_type n, const idref& x)
- : base_type (n, x)
+ : base_type (n, x, this)
{
}
@@ -2505,7 +2507,7 @@ namespace xsd
*/
template <typename I>
idrefs (const I& begin, const I& end)
- : base_type (begin, end)
+ : base_type (begin, end, this)
{
}
@@ -2520,7 +2522,7 @@ namespace xsd
* For polymorphic object models use the @c _clone function instead.
*/
idrefs (const idrefs& x, flags f = 0, container* c = 0)
- : B (x, f, c), base_type (x, f, c)
+ : B (x, f, c), base_type (x, f, this)
{
}
@@ -3675,6 +3677,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
entities ()
+ : base_type (0, this)
{
}
@@ -3685,7 +3688,7 @@ namespace xsd
* @param x An exemplar element to copy.
*/
entities (typename base_type::size_type n, const entity& x)
- : base_type (n, x)
+ : base_type (n, x, this)
{
}
@@ -3698,7 +3701,7 @@ namespace xsd
*/
template <typename I>
entities (const I& begin, const I& end)
- : base_type (begin, end)
+ : base_type (begin, end, this)
{
}
@@ -3713,7 +3716,7 @@ namespace xsd
* For polymorphic object models use the @c _clone function instead.
*/
entities (const entities& x, flags f = 0, container* c = 0)
- : B (x, f, c), base_type (x, f, c)
+ : B (x, f, c), base_type (x, f, this)
{
}
diff --git a/tests/cxx/tree/containment/driver.cxx b/tests/cxx/tree/containment/driver.cxx
index bd9aa24..62e1a8c 100644
--- a/tests/cxx/tree/containment/driver.cxx
+++ b/tests/cxx/tree/containment/driver.cxx
@@ -74,4 +74,39 @@ main ()
i.ref ("bar");
assert (i.ref ()->get () == p);
}
+
+ // IDREF lists
+ //
+ {
+ id i1 ("a"), i2 ("b");
+
+ 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);
+ r1->push_back (xml_schema::idref ("a"));
+ r1->push_back (xml_schema::idref ("b"));
+
+ 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);
+
+ rc1->idrefs (r1);
+ rc2->idrefs (r2);
+
+ model m;
+ m.ids (ic);
+ m.idrefs1 (rc1);
+ m.idrefs2 (rc2);
+
+ assert (m.idrefs1 ().idrefs ()[0].get () != 0);
+ assert (m.idrefs1 ().idrefs ()[1].get () != 0);
+
+ assert (m.idrefs2 ().idrefs ()[0].get () != 0);
+ assert (m.idrefs2 ().idrefs ()[1].get () != 0);
+ }
}
diff --git a/tests/cxx/tree/containment/makefile b/tests/cxx/tree/containment/makefile
index e44f82e..d6f45b3 100644
--- a/tests/cxx/tree/containment/makefile
+++ b/tests/cxx/tree/containment/makefile
@@ -34,7 +34,7 @@ genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx)
gen := $(addprefix $(out_base)/,$(genf))
$(gen): xsd := $(out_root)/xsd/xsd
-$(gen): xsd_options :=
+$(gen): xsd_options := --generate-default-ctor
$(gen): $(out_root)/xsd/xsd
$(call include-dep,$(dep))
diff --git a/tests/cxx/tree/containment/test.xsd b/tests/cxx/tree/containment/test.xsd
index 002bdda..72c9379 100644
--- a/tests/cxx/tree/containment/test.xsd
+++ b/tests/cxx/tree/containment/test.xsd
@@ -24,4 +24,36 @@
</sequence>
</complexType>
+ <!-- IDREF lists -->
+
+ <complexType name="id">
+ <attribute name="id" type="ID" use="required"/>
+ </complexType>
+
+ <complexType name="ids">
+ <sequence>
+ <element name="id" type="t:id" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="idrefs1">
+ <attribute name="idrefs" type="IDREFS" use="required"/>
+ </complexType>
+
+ <simpleType name="idref-list">
+ <list itemType="IDREF"/>
+ </simpleType>
+
+ <complexType name="idrefs2">
+ <attribute name="idrefs" type="t:idref-list" use="required"/>
+ </complexType>
+
+ <complexType name="model">
+ <sequence>
+ <element name="ids" type="t:ids"/>
+ <element name="idrefs1" type="t:idrefs1"/>
+ <element name="idrefs2" type="t:idrefs2"/>
+ </sequence>
+ </complexType>
+
</schema>
diff --git a/xsd/cxx/tree/stream-extraction-source.cxx b/xsd/cxx/tree/stream-extraction-source.cxx
index 8b92040..27b3ca7 100644
--- a/xsd/cxx/tree/stream-extraction-source.cxx
+++ b/xsd/cxx/tree/stream-extraction-source.cxx
@@ -55,7 +55,7 @@ namespace CXX
<< flags_type << " f," << endl
<< container << "* c)" << endl
<< ": " << any_simple_type << " (s, f, c)," << endl
- << " " << base << " (s, f, c)"
+ << " " << base << " (s, f, this)"
<< "{"
<< "}";
diff --git a/xsd/cxx/tree/tree-header.cxx b/xsd/cxx/tree/tree-header.cxx
index 6b1490c..a63dcbe 100644
--- a/xsd/cxx/tree/tree-header.cxx
+++ b/xsd/cxx/tree/tree-header.cxx
@@ -135,7 +135,7 @@ namespace CXX
os << "template < typename " << iter_type << " >" << endl
<< name << " (const " << iter_type << "& begin, const " <<
iter_type << "& end)" << endl
- << ": " << base_type << " (begin, end)"
+ << ": " << base_type << " (begin, end, this)"
<< "{"
<< "}";
diff --git a/xsd/cxx/tree/tree-inline.cxx b/xsd/cxx/tree/tree-inline.cxx
index 5bec713..0b834af 100644
--- a/xsd/cxx/tree/tree-inline.cxx
+++ b/xsd/cxx/tree/tree-inline.cxx
@@ -52,7 +52,8 @@ namespace CXX
//
os << inl
<< name << "::" << endl
- << name << " ()"
+ << name << " ()" << endl
+ << ": " << base_type << " (0, this)"
<< "{"
<< "}";
@@ -66,7 +67,7 @@ namespace CXX
<< name << "::" << endl
<< name << " (" << size_type << " n, const " << item_name <<
"& x)" << endl
- << ": " << base_type << " (n, x)"
+ << ": " << base_type << " (n, x, this)"
<< "{"
<< "}";
@@ -78,7 +79,7 @@ namespace CXX
<< flags_type << " f," << endl
<< container << "* c)" << endl
<< ": " << any_simple_type << " (o, f, c)," << endl
- << " " << base_type << " (o, f, c)"
+ << " " << base_type << " (o, f, this)"
<< "{"
<< "}";
}
diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx
index 7952e38..4b4b301 100644
--- a/xsd/cxx/tree/tree-source.cxx
+++ b/xsd/cxx/tree/tree-source.cxx
@@ -62,7 +62,7 @@ namespace CXX
<< flags_type << " f," << endl
<< container << "* c)" << endl
<< ": " << any_simple_type << " (e, f, c)," << endl
- << " " << base << " (e, f, c)"
+ << " " << base << " (e, f, this)"
<< "{"
<< "}";
@@ -73,7 +73,7 @@ namespace CXX
<< flags_type << " f," << endl
<< container << "* c)" << endl
<< ": " << any_simple_type << " (a, f, c)," << endl
- << " " << base << " (a, f, c)"
+ << " " << base << " (a, f, this)"
<< "{"
<< "}";
@@ -85,7 +85,7 @@ namespace CXX
<< flags_type << " f," << endl
<< container << "* c)" << endl
<< ": " << any_simple_type << " (s, e, f, c)," << endl
- << " " << base << " (s, e, f, c)"
+ << " " << base << " (s, e, f, this)"
<< "{"
<< "}";
}