summaryrefslogtreecommitdiff
path: root/xsd/doc/cxx/tree/manual
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-02-16 21:27:12 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-02-24 22:20:33 +0300
commitf0e0fb5f3f2af8b695680e84572137660ffd835b (patch)
tree4dcddf9101cb0d088ca9a23eee90b1679c3c03cc /xsd/doc/cxx/tree/manual
parentb083417c9111b5c10234a7218e046ea3b55381fa (diff)
Update documentation
Diffstat (limited to 'xsd/doc/cxx/tree/manual')
-rw-r--r--xsd/doc/cxx/tree/manual/index.xhtml.in264
1 files changed, 134 insertions, 130 deletions
diff --git a/xsd/doc/cxx/tree/manual/index.xhtml.in b/xsd/doc/cxx/tree/manual/index.xhtml.in
index 48f36b6..5a7240a 100644
--- a/xsd/doc/cxx/tree/manual/index.xhtml.in
+++ b/xsd/doc/cxx/tree/manual/index.xhtml.in
@@ -469,12 +469,14 @@
<li><a href="https://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml">XSD
Compiler Command Line Manual</a></li>
- <li>The <code>examples/cxx/tree/</code> directory in the XSD
- distribution contains a collection of examples and a README
- file with an overview of each example.</li>
+ <li>The <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ contains a collection of examples and a README file with an overview
+ of each example.</li>
- <li>The <code>README</code> file in the XSD distribution explains
- how to compile the examples on various platforms.</li>
+ <li>The <code>README</code> file in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ explains how to build the examples.</li>
<li>The <a href="https://www.codesynthesis.com/mailman/listinfo/xsd-users">xsd-users</a>
mailing list is a place to ask questions. Furthermore the
@@ -522,12 +524,12 @@
<h3><a name="2.1.1">2.1.1 C++ Standard</a></h3>
- <p>The C++/Tree mapping provides support for ISO/IEC C++ 1998/2003 (C++98)
- and ISO/IEC C++ 2011 (C++11). To select the C++ standard for the
+ <p>The C++/Tree mapping provides support for ISO/IEC C++ 2011 (C++11)
+ and ISO/IEC C++ 1998/2003 (C++98). To select the C++ standard for the
generated code we use the <code>--std</code> XSD compiler command
- line option. While the majority of the examples in this manual use
- C++98, support for the new functionality and library components
- introduced in C++11 are discussed throughout the document.</p>
+ line option. While the majority of the examples in this guide use
+ C++11, the document explains the C++11/98 usage difference and so
+ they can easily be converted to C++98.</p>
<h3><a name="2.1.2">2.1.2 Identifiers</a></h3>
@@ -1144,8 +1146,8 @@ namespace system
sequences of non-fundamental C++ types is the addition of
the overloaded <code>push_back</code> and <code>insert</code>
member functions which instead of the constant reference
- to the element type accept automatic pointer (<code>std::auto_ptr</code>
- or <code>std::unique_ptr</code>, depending on the C++ standard
+ to the element type accept automatic pointer (<code>std::unique_ptr</code>
+ or <code>std::auto_ptr</code>, depending on the C++ standard
selected) to the element type. These functions assume ownership
of the pointed to object and reset the passed automatic pointer.
</p>
@@ -2412,8 +2414,8 @@ public:
sequences of non-fundamental C++ types is the addition of
the overloaded <code>push_back</code> and <code>insert</code>
member functions which instead of the constant reference
- to the element type accept automatic pointer (<code>std::auto_ptr</code>
- or <code>std::unique_ptr</code>, depending on the C++ standard
+ to the element type accept automatic pointer (<code>std::unique_ptr</code>
+ or <code>std::auto_ptr</code>, depending on the C++ standard
selected) to the element type. These functions assume ownership
of the pointed to object and reset the passed automatic pointer.
</p>
@@ -2480,10 +2482,10 @@ public:
instance is initialized with copies of the passed objects. In the
second constructor, arguments that are complex types (that is,
they themselves contain elements or attributes) are passed as
- either <code>std::auto_ptr</code> (C++98) or <code>std::unique_ptr</code>
- (C++11), depending on the C++ standard selected. In this case the newly
+ either <code>std::unique_ptr</code> (C++11) or <code>std::auto_ptr</code>
+ (C++98), depending on the C++ standard selected. In this case the newly
created instance is directly initialized with and assumes ownership
- of the pointed to objects and the <code>std::[auto|unique]_ptr</code>
+ of the pointed to objects and the <code>std::[unique|auto]_ptr</code>
arguments are reset to <code>0</code>. For instance:</p>
<pre class="xml">
@@ -2529,7 +2531,7 @@ class object: public xml_schema::type
{
public:
object (const bool&amp; s_one, const complex&amp; c_one);
- object (const bool&amp; s_one, std::[auto|unique]_ptr&lt;complex> c_one);
+ object (const bool&amp; s_one, std::[unique|auto]_ptr&lt;complex> c_one);
object (const object&amp;);
public:
@@ -2546,7 +2548,7 @@ public:
</pre>
<p>Notice that the generated <code>complex</code> class does not
- have the second (<code>std::[auto|unique]_ptr</code>) version of the
+ have the second (<code>std::[unique|auto]_ptr</code>) version of the
constructor since all its required members are of simple types.</p>
<p>If an XML Schema complex type has an ultimate base which is an XML
@@ -2817,8 +2819,8 @@ public:
constant of the member's type. It makes a deep copy of its argument.
Except for member's types that are mapped to fundamental C++ types,
the second modifier function is provided that expects an argument
- of type automatic pointer (<code>std::auto_ptr</code> or
- <code>std::unique_ptr</code>, depending on the C++ standard selected)
+ of type automatic pointer (<code>std::unique_ptr</code> or
+ <code>std::auto_ptr</code>, depending on the C++ standard selected)
to the member's type. It assumes ownership of the pointed to object
and resets the passed automatic pointer. For instance:</p>
@@ -2854,7 +2856,7 @@ public:
member (const member_type&amp;);
void
- member (std::[auto|unique]_ptr&lt;member_type>);
+ member (std::[unique|auto]_ptr&lt;member_type>);
...
};
@@ -2871,7 +2873,7 @@ class object: public xml_schema::type
public:
...
- std::[auto|unique]_ptr&lt;member_type>
+ std::[unique|auto]_ptr&lt;member_type>
detach_member ();
...
@@ -2896,19 +2898,19 @@ f (object&amp; o)
o.member ("hello"); // set, deep copy
o.member () = "hello"; // set, deep copy
- // C++98 version.
- //
- std::auto_ptr&lt;string> p (new string ("hello"));
- o.member (p); // set, assumes ownership
- p = o.detach_member (); // detach, member is uninitialized
- o.member (p); // re-attach
-
// C++11 version.
//
std::unique_ptr&lt;string> p (new string ("hello"));
o.member (std::move (p)); // set, assumes ownership
p = o.detach_member (); // detach, member is uninitialized
o.member (std::move (p)); // re-attach
+
+ // C++98 version.
+ //
+ std::auto_ptr&lt;string> p (new string ("hello"));
+ o.member (p); // set, assumes ownership
+ p = o.detach_member (); // detach, member is uninitialized
+ o.member (p); // re-attach
}
</pre>
@@ -2938,8 +2940,8 @@ f (object&amp; o)
member's type. It makes a deep copy of its argument.
Except for member's types that are mapped to fundamental C++ types,
the second modifier function is provided that expects an argument
- of type automatic pointer (<code>std::auto_ptr</code> or
- <code>std::unique_ptr</code>, depending on the C++ standard selected)
+ of type automatic pointer (<code>std::unique_ptr</code> or
+ <code>std::auto_ptr</code>, depending on the C++ standard selected)
to the member's type. It assumes ownership of the pointed to object
and resets the passed automatic pointer. The last modifier function
expects an argument of type reference to constant of the container
@@ -2979,7 +2981,7 @@ public:
member (const member_type&amp;);
void
- member (std::[auto|unique]_ptr&lt;member_type>);
+ member (std::[unique|auto]_ptr&lt;member_type>);
void
member (const member_optional&amp;);
@@ -2992,7 +2994,7 @@ public:
<p>The <code>optional</code> class template is defined in an
implementation-specific namespace and has the following
- interface. The <code>[auto|unique]_ptr</code>-based constructor
+ interface. The <code>[unique|auto]_ptr</code>-based constructor
and modifier function are only available if the template
argument is not a fundamental C++ type.
</p>
@@ -3012,7 +3014,7 @@ public:
// Assumes ownership.
//
explicit
- optional (std::[auto|unique]_ptr&lt;X>);
+ optional (std::[unique|auto]_ptr&lt;X>);
optional (const optional&amp;);
@@ -3061,11 +3063,11 @@ public:
// Assumes ownership.
//
void
- set (std::[auto|unique]_ptr&lt;X>);
+ set (std::[unique|auto]_ptr&lt;X>);
// Detach and return the contained value.
//
- std::[auto|unique]_ptr&lt;X>
+ std::[unique|auto]_ptr&lt;X>
detach ();
void
@@ -3124,17 +3126,6 @@ f (object&amp; o)
o.member ().reset (); // reset
}
- // C++98 version.
- //
- std::auto_ptr&lt;string> p (new string ("hello"));
- o.member (p); // set, assumes ownership
-
- p = new string ("hello");
- o.member ().set (p); // set, assumes ownership
-
- p = o.member ().detach (); // detach, member is reset
- o.member ().set (p); // re-attach
-
// C++11 version.
//
std::unique_ptr&lt;string> p (new string ("hello"));
@@ -3145,6 +3136,17 @@ f (object&amp; o)
p = o.member ().detach (); // detach, member is reset
o.member ().set (std::move (p)); // re-attach
+
+ // C++98 version.
+ //
+ std::auto_ptr&lt;string> p (new string ("hello"));
+ o.member (p); // set, assumes ownership
+
+ p = new string ("hello");
+ o.member ().set (p); // set, assumes ownership
+
+ p = o.member ().detach (); // detach, member is reset
+ o.member ().set (p); // re-attach
}
</pre>
@@ -3226,7 +3228,7 @@ public:
as well as the <code>detach_back</code> and <code>detach</code>
member functions. The additional <code>push_back</code> and
<code>insert</code> functions accept an automatic pointer
- (<code>std::auto_ptr</code> or <code>std::unique_ptr</code>,
+ (<code>std::unique_ptr</code> or <code>std::auto_ptr</code>,
depending on the C++ standard selected) to the
element type instead of the constant reference. They assume
ownership of the pointed to object and reset the passed
@@ -3244,17 +3246,17 @@ public:
...
void
- push_back (std::[auto|unique]_ptr&lt;X>)
+ push_back (std::[unique|auto]_ptr&lt;X>)
iterator
- insert (iterator position, std::[auto|unique]_ptr&lt;X>)
+ insert (iterator position, std::[unique|auto]_ptr&lt;X>)
- std::[auto|unique]_ptr&lt;X>
+ std::[unique|auto]_ptr&lt;X>
detach_back (bool pop = true);
iterator
detach (iterator position,
- std::[auto|unique]_ptr&lt;X>&amp; result,
+ std::[unique|auto]_ptr&lt;X>&amp; result,
bool erase = true)
...
@@ -3282,13 +3284,6 @@ f (object&amp; o)
//
s.push_back ("hello"); // deep copy
- // C++98 version.
- //
- std::auto_ptr&lt;string> p (new string ("hello"));
- s.push_back (p); // assumes ownership
- p = s.detach_back (); // detach and pop
- s.push_back (p); // re-append
-
// C++11 version.
//
std::unique_ptr&lt;string> p (new string ("hello"));
@@ -3296,6 +3291,13 @@ f (object&amp; o)
p = s.detach_back (); // detach and pop
s.push_back (std::move (p)); // re-append
+ // C++98 version.
+ //
+ std::auto_ptr&lt;string> p (new string ("hello"));
+ s.push_back (p); // assumes ownership
+ p = s.detach_back (); // detach and pop
+ s.push_back (p); // re-append
+
// Setting a new container.
//
object::member_sequence n;
@@ -3617,7 +3619,9 @@ w[0].amount (10000);
<p>For the complete working code shown in this section refer to the
<code>order/element</code> example in the
- <code>examples/cxx/tree/</code> directory in the XSD distribution.</p>
+ <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<p>If both the base and derived types are ordered, then the
content order sequence is only added to the base and the content
@@ -3646,8 +3650,7 @@ w[0].amount (10000);
<p>As an example, here is how we can use the Boost Multi-Index
container for content order. First we create the
<code>content-order-container.hxx</code> header with the
- following definition (in C++11, use the alias template
- instead):</p>
+ following definition:</p>
<pre class="c++">
#ifndef CONTENT_ORDER_CONTAINER
@@ -3665,7 +3668,7 @@ struct by_id {};
struct by_id_index {};
template &lt;typename T>
-struct content_order_container:
+using content_order_container =
boost::multi_index::multi_index_container&lt;
T,
boost::multi_index::indexed_by&lt;
@@ -3679,8 +3682,7 @@ struct content_order_container:
boost::multi_index::member&lt;T, std::size_t, &amp;T::id>
>
>
- >
-{};
+ >;
#endif
</pre>
@@ -3734,7 +3736,7 @@ for (id_iterator i (r.first); i != r.second; ++i)
<p>The parsing functions read XML instance documents and return
corresponding object models as an automatic pointer
- (<code>std::auto_ptr</code> or <code>std::unique_ptr</code>,
+ (<code>std::unique_ptr</code> or <code>std::auto_ptr</code>,
depending on the C++ standard selected). Their signatures
have the following pattern (<code>type</code> denotes
element's type and <code>name</code> denotes element's
@@ -3742,7 +3744,7 @@ for (id_iterator i (r.first); i != r.second; ++i)
</p>
<pre class="c++">
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (....);
</pre>
@@ -3814,13 +3816,13 @@ public:
value (const value_type&amp;);
void
- value (std::[auto|unique]_ptr&lt;value_type>);
+ value (std::[unique|auto]_ptr&lt;value_type>);
// Constructors.
//
root (const value_type&amp;);
- root (std::[auto|unique]_ptr&lt;value_type>);
+ root (std::[unique|auto]_ptr&lt;value_type>);
root (const xercesc::DOMElement&amp;, xml_schema::flags = 0);
@@ -3916,7 +3918,7 @@ namespace xml_schema
class element_map
{
public:
- static std::[auto|unique]_ptr&lt;xml_schema::element_type>
+ static std::[unique|auto]_ptr&lt;xml_schema::element_type>
parse (const xercesc::DOMElement&amp;, flags = 0);
static void
@@ -3927,8 +3929,8 @@ namespace xml_schema
<p>The <code>parse()</code> function creates the corresponding
element type object based on the element name and namespace
- and returns it as an automatic pointer (<code>std::auto_ptr</code>
- or <code>std::unique_ptr</code>, depending on the C++ standard
+ and returns it as an automatic pointer (<code>std::unique_ptr</code>
+ or <code>std::auto_ptr</code>, depending on the C++ standard
selected) to <code>xml_schema::element_type</code>.
The <code>serialize()</code> function serializes the passed element
object to <code>DOMElement</code>. Note that in case of
@@ -3965,7 +3967,7 @@ struct no_element_info: virtual exception
//
DOMElement&amp; e = ... // Parse XML to DOM.
-auto_ptr&lt;xml_schema::element_type> r (
+unique_ptr&lt;xml_schema::element_type> r (
xml_schema::element_map::parse (e));
if (root1 r1 = dynamic_cast&lt;root1*> (r.get ()))
@@ -4097,7 +4099,7 @@ f (root&amp; r)
i != r.item ().end ()
++i)
{
- std::auto_ptr&lt;base> c (i->_clone ());
+ std::unique_ptr&lt;base> c (i->_clone ());
}
}
</pre>
@@ -4881,8 +4883,9 @@ for (batch::content_order_const_iterator i (b.content_order ().begin ());
<p>For the complete working code that shows the use of wildcards in
ordered types refer to the <code>order/element</code> example in
- the <code>examples/cxx/tree/</code> directory in the XSD
- distribution.</p>
+ the <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<h3><a name="2.12.5">2.12.5 Mapping for <code>anyAttribute</code></a></h3>
@@ -5293,8 +5296,9 @@ for (text::content_order_const_iterator i (t.content_order ().begin ());
<p>For the complete working code that shows the use of mixed content
in ordered types refer to the <code>order/mixed</code> example in
- the <code>examples/cxx/tree/</code> directory in the XSD
- distribution.</p>
+ the <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<!-- Parsing -->
@@ -5318,18 +5322,18 @@ for (text::content_order_const_iterator i (t.content_order ().begin ());
// Read from a URI or a local file.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const std::basic_string&lt;C>&amp; uri,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const std::basic_string&lt;C>&amp; uri,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const std::basic_string&lt;C>&amp; uri,
xercesc::DOMErrorHandler&amp;,
xml_schema::flags = 0,
@@ -5339,38 +5343,38 @@ name (const std::basic_string&lt;C>&amp; uri,
// Read from std::istream.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
xercesc::DOMErrorHandler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
const std::basic_string&lt;C>&amp; id,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
const std::basic_string&lt;C>&amp; id,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
const std::basic_string&lt;C>&amp; id,
xercesc::DOMErrorHandler&amp;,
@@ -5381,18 +5385,18 @@ name (std::istream&amp;,
// Read from InputSource.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (xercesc::InputSource&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (xercesc::InputSource&amp;,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (xercesc::InputSource&amp;,
xercesc::DOMErrorHandler&amp;,
xml_schema::flags = 0,
@@ -5402,13 +5406,13 @@ name (xercesc::InputSource&amp;,
// Read from DOM.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const xercesc::DOMDocument&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
-name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
+std::[unique|auto]_ptr&lt;type>
+name (xml_schema::dom::[unique|auto]_ptr&lt;xercesc::DOMDocument>,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
</pre>
@@ -5418,7 +5422,7 @@ name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
or a pre-parsed DOM instance in the form of
<code>xercesc::DOMDocument</code>. All the parsing functions
return a dynamically allocated object model as either
- <code>std::auto_ptr</code> or <code>std::unique_ptr</code>,
+ <code>std::unique_ptr</code> or <code>std::auto_ptr</code>,
depending on the C++ standard selected. Each of these parsing
functions is discussed in more detail in the following sections.
</p>
@@ -5462,7 +5466,7 @@ name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
<dd>Assume ownership of the DOM document passed. This flag only
makes sense together with the <code>keep_dom</code> flag in
the call to the parsing function with the
- <code>xml_schema::dom::[auto|unique]_ptr&lt;DOMDocument></code>
+ <code>xml_schema::dom::[unique|auto]_ptr&lt;DOMDocument></code>
argument.</dd>
<dt><code>xml_schema::flags::dont_validate</code></dt>
@@ -5478,7 +5482,7 @@ name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
<pre class="c++">
using xml_schema::flags;
-std::auto_ptr&lt;type> r (
+std::unique_ptr&lt;type> r (
name ("test.xml", flags::keep_dom | flags::dont_validate));
</pre>
@@ -5912,19 +5916,19 @@ struct no_prefix_mapping: virtual exception
For example:</p>
<pre class="c++">
-using std::auto_ptr;
+using std::unique_ptr;
-auto_ptr&lt;type> r1 (name ("test.xml"));
-auto_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
+unique_ptr&lt;type> r1 (name ("test.xml"));
+unique_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
</pre>
- <p>Or, in the C++11 mode:</p>
+ <p>Or, in the C++98 mode:</p>
<pre class="c++">
-using std::unique_ptr;
+using std::auto_ptr;
-unique_ptr&lt;type> r1 (name ("test.xml"));
-unique_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
+auto_ptr&lt;type> r1 (name ("test.xml"));
+auto_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
</pre>
<h2><a name="3.5">3.5 Reading from <code>std::istream</code></a></h2>
@@ -5935,17 +5939,17 @@ unique_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
relative paths. For instance:</p>
<pre class="c++">
-using std::auto_ptr;
+using std::unique_ptr;
{
std::ifstream ifs ("test.xml");
- auto_ptr&lt;type> r (name (ifs, "test.xml"));
+ unique_ptr&lt;type> r (name (ifs, "test.xml"));
}
{
std::string str ("..."); // Some XML fragment.
std::istringstream iss (str);
- auto_ptr&lt;type> r (name (iss));
+ unique_ptr&lt;type> r (name (iss));
}
</pre>
@@ -5958,7 +5962,7 @@ using std::auto_ptr;
<pre class="c++">
xercesc::StdInInputSource is;
-std::auto_ptr&lt;type> r (name (is));
+std::unique_ptr&lt;type> r (name (is));
</pre>
<h2><a name="3.7">3.7 Reading from DOM</a></h2>
@@ -5981,15 +5985,6 @@ std::auto_ptr&lt;type> r (name (is));
of the DOM document passed. For example:</p>
<pre class="c++">
-// C++98 version.
-//
-xml_schema::dom::auto_ptr&lt;xercesc::DOMDocument> doc = ...
-
-std::auto_ptr&lt;type> r (
- name (doc, xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
-
-// At this point doc is reset to 0.
-
// C++11 version.
//
xml_schema::dom::unique_ptr&lt;xercesc::DOMDocument> doc = ...
@@ -5999,6 +5994,15 @@ std::unique_ptr&lt;type> r (
xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
// At this point doc is reset to 0.
+
+// C++98 version.
+//
+xml_schema::dom::auto_ptr&lt;xercesc::DOMDocument> doc = ...
+
+std::auto_ptr&lt;type> r (
+ name (doc, xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
+
+// At this point doc is reset to 0.
</pre>
<h1><a name="4">4 Serialization</a></h1>
@@ -6086,7 +6090,7 @@ name (xercesc::XMLFormatTarget&amp;,
// Serialize to DOM.
//
-xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>
+xml_schema::dom::[unique|auto]_ptr&lt;xercesc::DOMDocument>
name (const type&amp;,
const xml_schema::namespace_infomap&amp;
xml_schema::namespace_infomap (),
@@ -6275,7 +6279,7 @@ map[""].schema = "test.xsd";
operator. For example:</p>
<pre class="c++">
-std::auto_ptr&lt;type> r = ...
+std::unique_ptr&lt;type> r = ...
std::ofstream ofs ("test.xml");
xml_schema::namespace_infomap map;
name (ofs,
@@ -6384,7 +6388,7 @@ struct serialization: virtual exception
<pre class="c++">
// Obtain the object model.
//
-std::auto_ptr&lt;type> r = ...
+std::unique_ptr&lt;type> r = ...
// Prepare namespace mapping and schema location information.
//
@@ -6417,11 +6421,11 @@ name (std::cout, *r, map);
</p>
<pre class="c++">
-using std::auto_ptr;
+using std::unique_ptr;
// Obtain the object model.
//
-auto_ptr&lt;type> r = ...
+unique_ptr&lt;type> r = ...
// Prepare namespace mapping and schema location information.
//
@@ -6437,15 +6441,15 @@ XMLPlatformUtils::Initialize ();
{
// Choose a target.
//
- auto_ptr&lt;XMLFormatTarget> ft;
+ unique_ptr&lt;XMLFormatTarget> ft;
if (argc != 2)
{
- ft = auto_ptr&lt;XMLFormatTarget> (new StdOutFormatTarget ());
+ ft = unique_ptr&lt;XMLFormatTarget> (new StdOutFormatTarget ());
}
else
{
- ft = auto_ptr&lt;XMLFormatTarget> (
+ ft = unique_ptr&lt;XMLFormatTarget> (
new LocalFileFormatTarget (argv[1]));
}
@@ -6477,7 +6481,7 @@ XMLPlatformUtils::Terminate ();
<pre class="c++">
// Obtain the object model.
//
-std::auto_ptr&lt;type> r = ...
+std::unique_ptr&lt;type> r = ...
using namespace xercesc;
@@ -6565,7 +6569,7 @@ XMLPlatformUtils::Initialize ();
{
// Parse XML to object model.
//
- std::auto_ptr&lt;type> r (root (
+ std::unique_ptr&lt;type> r (root (
"root.xml",
xml_schema::flags::keep_dom |
xml_schema::flags::dont_initialize));
@@ -6612,7 +6616,7 @@ XMLPlatformUtils::Initialize ();
{
// Parse XML to object model.
//
- std::auto_ptr&lt;type> r (root (
+ std::unique_ptr&lt;type> r (root (
"root.xml",
xml_schema::flags::keep_dom |
xml_schema::flags::dont_initialize));
@@ -6703,7 +6707,7 @@ XMLPlatformUtils::Terminate ();
<pre class="c++">
// Parse XML to object model.
//
-std::auto_ptr&lt;type> r (root ("root.xml"));
+std::unique_ptr&lt;type> r (root ("root.xml"));
// Save to a CDR stream.
//
@@ -6717,7 +6721,7 @@ ocdr &lt;&lt; *r;
ACE_InputCDR ace_icdr (buf, size);
xml_schema::istream&lt;ACE_InputCDR> icdr (ace_icdr);
-std::auto_ptr&lt;object> copy (new object (icdr));
+std::unique_ptr&lt;object> copy (new object (icdr));
// Serialize to XML.
//