aboutsummaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx/tree
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-01-19 10:05:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-01-19 10:06:32 +0200
commit0fdf19714613a82a184f4f6e75fb9a4f9b62f18a (patch)
tree93bb2df0f9d9eab44d36dedf29d4df500ecefcbc /libxsd/xsd/cxx/tree
parent45db924dfc19b49b7930522dbddd123fb9575e32 (diff)
Use std::unique_ptr instead of std::auto_ptr in C++11 mode
Diffstat (limited to 'libxsd/xsd/cxx/tree')
-rw-r--r--libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx38
-rw-r--r--libxsd/xsd/cxx/tree/containers.hxx33
-rw-r--r--libxsd/xsd/cxx/tree/containers.txx21
-rw-r--r--libxsd/xsd/cxx/tree/element-map.hxx10
-rw-r--r--libxsd/xsd/cxx/tree/elements.hxx131
-rw-r--r--libxsd/xsd/cxx/tree/istream.hxx6
-rw-r--r--libxsd/xsd/cxx/tree/ostream.hxx6
-rw-r--r--libxsd/xsd/cxx/tree/parsing.txx18
-rw-r--r--libxsd/xsd/cxx/tree/parsing/element-map.txx6
-rw-r--r--libxsd/xsd/cxx/tree/stream-extraction-map.hxx10
-rw-r--r--libxsd/xsd/cxx/tree/stream-extraction-map.txx6
-rw-r--r--libxsd/xsd/cxx/tree/stream-extraction.hxx3
-rw-r--r--libxsd/xsd/cxx/tree/type-factory-map.hxx16
-rw-r--r--libxsd/xsd/cxx/tree/type-factory-map.txx13
-rw-r--r--libxsd/xsd/cxx/tree/type-serializer-map.hxx3
-rw-r--r--libxsd/xsd/cxx/tree/type-serializer-map.txx2
-rw-r--r--libxsd/xsd/cxx/tree/types.txx20
17 files changed, 189 insertions, 153 deletions
diff --git a/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx b/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx
index 50c19d6..03e2409 100644
--- a/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx
+++ b/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx
@@ -12,7 +12,13 @@
#include <ace/ACE.h> // ACE::strdelete
#include <ace/CDR_Stream.h>
-#include <xsd/cxx/auto-array.hxx>
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
#include <xsd/cxx/tree/buffer.hxx>
#include <xsd/cxx/tree/istream.hxx>
@@ -258,11 +264,11 @@ namespace xsd
namespace bits
{
- template<typename C>
- struct ace_str_deallocator
+ template <typename C>
+ struct ace_str_deleter
{
void
- deallocate (C* s)
+ operator() (C* s) const
{
ACE::strdelete (s);
}
@@ -272,18 +278,22 @@ namespace xsd
inline istream<ACE_InputCDR>&
operator>> (istream<ACE_InputCDR>& s, std::basic_string<char>& x)
{
- typedef bits::ace_str_deallocator<char> deallocator;
+ typedef bits::ace_str_deleter<char> deleter;
- deallocator d;
+ deleter d;
char* r;
if (!s.impl ().read_string (r))
throw ace_cdr_stream_extraction ();
- auto_array<char, deallocator> ar (r, d);
+#ifdef XSD_CXX11
+ std::unique_ptr<char[], deleter&> ar (
+#else
+ auto_array<char, deleter> ar (
+#endif
+ r, d);
x = r;
-
return s;
}
@@ -291,18 +301,22 @@ namespace xsd
inline istream<ACE_InputCDR>&
operator>> (istream<ACE_InputCDR>& s, std::basic_string<wchar_t>& x)
{
- typedef bits::ace_str_deallocator<wchar_t> deallocator;
+ typedef bits::ace_str_deleter<wchar_t> deleter;
- deallocator d;
+ deleter d;
wchar_t* r;
if (!s.impl ().read_wstring (r))
throw ace_cdr_stream_extraction ();
- auto_array<wchar_t, deallocator> ar (r, d);
+#ifdef XSD_CXX11
+ std::unique_ptr<wchar_t[], deleter&> ar (
+#else
+ auto_array<wchar_t, deleter> ar (
+#endif
+ r, d);
x = r;
-
return s;
}
#endif
diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx
index e6b9f88..1b959cb 100644
--- a/libxsd/xsd/cxx/tree/containers.hxx
+++ b/libxsd/xsd/cxx/tree/containers.hxx
@@ -9,11 +9,13 @@
#include <cstddef> // std::ptrdiff_t
#include <string>
#include <vector>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <iterator> // std::iterator_traits
#include <algorithm> // std::equal, std::lexicographical_compare
#include <iosfwd>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/elements.hxx>
namespace xsd
@@ -136,7 +138,7 @@ namespace xsd
one (const T&, container*);
- one (std::auto_ptr<T>, container*);
+ one (XSD_AUTO_PTR<T>, container*);
one (const one&, flags, container*);
@@ -163,7 +165,7 @@ namespace xsd
}
void
- set (std::auto_ptr<T>);
+ set (XSD_AUTO_PTR<T>);
bool
present () const
@@ -171,13 +173,13 @@ namespace xsd
return x_ != 0;
}
- std::auto_ptr<T>
+ XSD_AUTO_PTR<T>
detach ()
{
T* x (x_);
x->_container (0);
x_ = 0;
- return std::auto_ptr<T> (x);
+ return XSD_AUTO_PTR<T> (x);
}
protected:
@@ -268,7 +270,7 @@ namespace xsd
optional (const T&, container* = 0);
explicit
- optional (std::auto_ptr<T>, container* = 0);
+ optional (XSD_AUTO_PTR<T>, container* = 0);
optional (const optional&, flags = 0, container* = 0);
@@ -341,18 +343,18 @@ namespace xsd
}
void
- set (std::auto_ptr<T>);
+ set (XSD_AUTO_PTR<T>);
void
reset ();
- std::auto_ptr<T>
+ XSD_AUTO_PTR<T>
detach ()
{
T* x (x_);
x->_container (0);
x_ = 0;
- return std::auto_ptr<T> (x);
+ return XSD_AUTO_PTR<T> (x);
}
protected:
@@ -1266,7 +1268,7 @@ namespace xsd
}
void
- push_back (std::auto_ptr<T> x)
+ push_back (XSD_AUTO_PTR<T> x)
{
if (x->_container () != container_)
x->_container (container_);
@@ -1280,7 +1282,7 @@ namespace xsd
v_.pop_back ();
}
- std::auto_ptr<T>
+ XSD_AUTO_PTR<T>
detach_back (bool pop = true)
{
ptr& p (v_.back ());
@@ -1290,7 +1292,7 @@ namespace xsd
if (pop)
v_.pop_back ();
- return std::auto_ptr<T> (x);
+ return XSD_AUTO_PTR<T> (x);
}
iterator
@@ -1302,7 +1304,7 @@ namespace xsd
}
iterator
- insert (iterator position, std::auto_ptr<T> x)
+ insert (iterator position, XSD_AUTO_PTR<T> x)
{
if (x->_container () != container_)
x->_container (container_);
@@ -1336,12 +1338,11 @@ namespace xsd
}
iterator
- detach (iterator position, std::auto_ptr<T>& r, bool erase = true)
+ detach (iterator position, XSD_AUTO_PTR<T>& r, bool erase = true)
{
ptr& p (*position.base ());
p->_container (0);
- std::auto_ptr<T> tmp (static_cast<T*> (p.release ()));
- r = tmp;
+ r.reset (static_cast<T*> (p.release ()));
if (erase)
return iterator (v_.erase (position.base ()));
diff --git a/libxsd/xsd/cxx/tree/containers.txx b/libxsd/xsd/cxx/tree/containers.txx
index a27af48..7e45a02 100644
--- a/libxsd/xsd/cxx/tree/containers.txx
+++ b/libxsd/xsd/cxx/tree/containers.txx
@@ -4,6 +4,11 @@
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <ostream>
+
+#ifdef XSD_CXX11
+# include <utility> // std::move
+#endif
+
#include <xsd/cxx/tree/bits/literals.hxx>
namespace xsd
@@ -38,10 +43,14 @@ namespace xsd
template<typename T>
one<T, false>::
- one (std::auto_ptr<T> x, container* c)
+ one (XSD_AUTO_PTR<T> x, container* c)
: x_ (0), container_ (c)
{
+#ifdef XSD_CXX11
+ set (std::move (x));
+#else
set (x);
+#endif
}
template<typename T>
@@ -86,7 +95,7 @@ namespace xsd
template<typename T>
void one<T, false>::
- set (std::auto_ptr<T> x)
+ set (XSD_AUTO_PTR<T> x)
{
T* r (0);
@@ -128,10 +137,14 @@ namespace xsd
template <typename T>
optional<T, false>::
- optional (std::auto_ptr<T> x, container* c)
+ optional (XSD_AUTO_PTR<T> x, container* c)
: x_ (0), container_ (c)
{
+#ifdef XSD_CXX11
+ set (std::move (x));
+#else
set (x);
+#endif
}
template <typename T>
@@ -185,7 +198,7 @@ namespace xsd
template <typename T>
void optional<T, false>::
- set (std::auto_ptr<T> x)
+ set (XSD_AUTO_PTR<T> x)
{
T* r (0);
diff --git a/libxsd/xsd/cxx/tree/element-map.hxx b/libxsd/xsd/cxx/tree/element-map.hxx
index debfaed..b00bdbd 100644
--- a/libxsd/xsd/cxx/tree/element-map.hxx
+++ b/libxsd/xsd/cxx/tree/element-map.hxx
@@ -7,10 +7,12 @@
#define XSD_CXX_TREE_ELEMENT_MAP_HXX
#include <map>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
#include <string>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/xml/qualified-name.hxx>
#include <xsd/cxx/tree/elements.hxx>
@@ -44,7 +46,7 @@ namespace xsd
* @param f Flags to create the new element object with.
* @return An automatic pointer to the new element object.
*/
- static std::auto_ptr<element_type>
+ static XSD_AUTO_PTR<element_type>
parse (const xercesc::DOMElement& e, flags f = 0);
/**
@@ -61,7 +63,7 @@ namespace xsd
typedef xml::qualified_name<C> qualified_name;
- typedef std::auto_ptr<element_type>
+ typedef XSD_AUTO_PTR<element_type>
(*parser) (const xercesc::DOMElement&, flags f);
typedef void
@@ -113,7 +115,7 @@ namespace xsd
//
//
template<typename T, typename C, typename B>
- std::auto_ptr<element_type<C, B> >
+ XSD_AUTO_PTR<element_type<C, B> >
parser_impl (const xercesc::DOMElement&, flags);
template<typename T, typename C, typename B>
diff --git a/libxsd/xsd/cxx/tree/elements.hxx b/libxsd/xsd/cxx/tree/elements.hxx
index 17ad70c..396e880 100644
--- a/libxsd/xsd/cxx/tree/elements.hxx
+++ b/libxsd/xsd/cxx/tree/elements.hxx
@@ -17,13 +17,19 @@
#ifndef XSD_CXX_TREE_ELEMENTS_HXX
#define XSD_CXX_TREE_ELEMENTS_HXX
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR, XSD_CXX11
+
#include <map>
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <istream>
#include <sstream>
#include <cassert>
+#ifdef XSD_CXX11
+# include <utility> // std::move
+#endif
+
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOMAttr.hpp>
#include <xercesc/dom/DOMElement.hpp>
@@ -33,7 +39,7 @@
#include <xercesc/util/XercesVersion.hpp>
#include <xsd/cxx/xml/elements.hxx> // xml::properties
-#include <xsd/cxx/xml/dom/auto-ptr.hxx> // dom::auto_ptr
+#include <xsd/cxx/xml/dom/auto-ptr.hxx> // dom::auto_ptr/unique_ptr
#include <xsd/cxx/tree/facet.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
@@ -83,7 +89,7 @@ namespace xsd
*
* This flag only makes sense together with the @c keep_dom
* flag in the call to the %parsing function with the
- * @c dom::auto_ptr<DOMDocument> argument.
+ * @c dom::auto_ptr/unique_ptr<DOMDocument> argument.
*
*/
static const unsigned long own_dom = 0x00000200UL;
@@ -386,11 +392,7 @@ namespace xsd
{
// Drop DOM association.
//
- if (dom_info_.get ())
- {
- std::auto_ptr<dom_info> r (0);
- dom_info_ = r;
- }
+ dom_info_.reset ();
}
return *this;
@@ -444,7 +446,7 @@ namespace xsd
dr = c;
}
- std::auto_ptr<map>& m (dr ? dr->map_ : map_);
+ XSD_AUTO_PTR<map>& m (dr ? dr->map_ : map_);
if (container_ == 0)
{
@@ -455,11 +457,16 @@ namespace xsd
if (m.get () != 0)
{
m->insert (map_->begin (), map_->end ());
- std::auto_ptr<map> tmp (0);
- map_ = tmp;
+ map_.reset ();
}
else
+ {
+#ifdef XSD_CXX11
+ m = std::move (map_);
+#else
m = map_;
+#endif
+ }
}
}
else
@@ -481,10 +488,7 @@ namespace xsd
// Part of our subtree.
//
if (m.get () == 0)
- {
- std::auto_ptr<map> tmp (new map);
- m = tmp;
- }
+ m.reset (new map);
m->insert (*i);
sr->map_->erase (i++);
@@ -599,37 +603,31 @@ namespace xsd
{
if (container_ != 0)
{
- // @@ Should be a throw.
- //
assert (_root ()->_node () != 0);
assert (_root ()->_node ()->getOwnerDocument () ==
n->getOwnerDocument ());
}
- std::auto_ptr<dom_info> r (
+ dom_info_ =
dom_info_factory::create (
*static_cast<xercesc::DOMElement*> (n),
*this,
- container_ == 0));
+ container_ == 0);
- dom_info_ = r;
break;
}
case xercesc::DOMNode::ATTRIBUTE_NODE:
{
- //@@ Should be a throw.
- //
assert (container_ != 0);
assert (_root ()->_node () != 0);
assert (_root ()->_node ()->getOwnerDocument () ==
n->getOwnerDocument ());
- std::auto_ptr<dom_info> r (
+ dom_info_ =
dom_info_factory::create (
*static_cast<xercesc::DOMAttr*> (n),
- *this));
+ *this);
- dom_info_ = r;
break;
}
default:
@@ -650,10 +648,7 @@ namespace xsd
assert (container_ == 0);
if (map_.get () == 0)
- {
- std::auto_ptr<map> tmp (new map);
- map_ = tmp;
- }
+ map_.reset (new map);
if (!map_->insert (
std::pair<const identity*, type*> (&i, t)).second)
@@ -714,7 +709,7 @@ namespace xsd
{
}
- virtual std::auto_ptr<dom_info>
+ virtual XSD_AUTO_PTR<dom_info>
clone (type& tree_node, container*) const = 0;
virtual xercesc::DOMNode*
@@ -731,32 +726,35 @@ namespace xsd
struct dom_element_info: public dom_info
{
dom_element_info (xercesc::DOMElement& e, type& n, bool root)
- : doc_ (0), e_ (e)
+ : e_ (e)
{
e_.setUserData (user_data_keys::node, &n, 0);
if (root)
{
- // The caller should have associated a dom::auto_ptr object
- // that owns this document with the document node using the
- // xml_schema::dom::tree_node_key key.
+ // The caller should have associated a dom::auto/unique_ptr
+ // object that owns this document with the document node
+ // using the xml_schema::dom::tree_node_key key.
//
- xml::dom::auto_ptr<xercesc::DOMDocument>* pd (
- reinterpret_cast<xml::dom::auto_ptr<xercesc::DOMDocument>*> (
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>* pd (
+ reinterpret_cast<XSD_DOM_AUTO_PTR<xercesc::DOMDocument>*> (
e.getOwnerDocument ()->getUserData (user_data_keys::node)));
assert (pd != 0);
assert (pd->get () == e.getOwnerDocument ());
- doc_ = *pd; // Transfer ownership.
+ // Transfer ownership.
+#ifdef XSD_CXX11
+ doc_ = std::move (*pd);
+#else
+ doc_ = *pd;
+#endif
}
}
- virtual std::auto_ptr<dom_info>
+ virtual XSD_AUTO_PTR<dom_info>
clone (type& tree_node, container* c) const
{
- using std::auto_ptr;
-
// Check if we are a document root.
//
if (c == 0)
@@ -764,11 +762,10 @@ namespace xsd
// We preserver DOM associations only in complete
// copies from root.
//
- if (doc_.get () == 0)
- return auto_ptr<dom_info> (0);
-
- return auto_ptr<dom_info> (
- new dom_element_info (*doc_, tree_node));
+ return XSD_AUTO_PTR<dom_info> (
+ doc_.get () == 0
+ ? 0
+ : new dom_element_info (*doc_, tree_node));
}
// Check if our container does not have DOM association (e.g.,
@@ -779,8 +776,7 @@ namespace xsd
DOMNode* cn (c->_node ());
if (cn == 0)
- return auto_ptr<dom_info> (0);
-
+ return XSD_AUTO_PTR<dom_info> ();
// Now we are going to find the corresponding element in
// the new tree.
@@ -812,7 +808,7 @@ namespace xsd
assert (dn->getNodeType () == DOMNode::ELEMENT_NODE);
- return auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_element_info (static_cast<DOMElement&> (*dn),
tree_node,
false));
@@ -835,7 +831,7 @@ namespace xsd
}
private:
- xml::dom::auto_ptr<xercesc::DOMDocument> doc_;
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc_;
xercesc::DOMElement& e_;
};
@@ -848,11 +844,9 @@ namespace xsd
a_.setUserData (user_data_keys::node, &n, 0);
}
- virtual std::auto_ptr<dom_info>
+ virtual XSD_AUTO_PTR<dom_info>
clone (type& tree_node, container* c) const
{
- using std::auto_ptr;
-
// Check if we are a document root.
//
if (c == 0)
@@ -860,7 +854,7 @@ namespace xsd
// We preserver DOM associations only in complete
// copies from root.
//
- return auto_ptr<dom_info> (0);
+ return XSD_AUTO_PTR<dom_info> ();
}
// Check if our container does not have DOM association (e.g.,
@@ -871,7 +865,7 @@ namespace xsd
DOMNode* cn (c->_node ());
if (cn == 0)
- return auto_ptr<dom_info> (0);
+ return XSD_AUTO_PTR<dom_info> ();
// We are going to find the corresponding attribute in
// the new tree.
@@ -898,7 +892,7 @@ namespace xsd
DOMNode& n (*cn->getAttributes ()->item (i));
assert (n.getNodeType () == DOMNode::ATTRIBUTE_NODE);
- return auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_attribute_info (static_cast<DOMAttr&> (n), tree_node));
}
@@ -919,18 +913,18 @@ namespace xsd
struct dom_info_factory
{
- static std::auto_ptr<dom_info>
+ static XSD_AUTO_PTR<dom_info>
create (const xercesc::DOMElement& e, type& n, bool root)
{
- return std::auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_element_info (
const_cast<xercesc::DOMElement&> (e), n, root));
}
- static std::auto_ptr<dom_info>
+ static XSD_AUTO_PTR<dom_info>
create (const xercesc::DOMAttr& a, type& n)
{
- return std::auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_attribute_info (
const_cast<xercesc::DOMAttr&> (a), n));
}
@@ -938,7 +932,7 @@ namespace xsd
//@endcond
- std::auto_ptr<dom_info> dom_info_;
+ XSD_AUTO_PTR<dom_info> dom_info_;
// ID/IDREF map.
@@ -961,7 +955,7 @@ namespace xsd
std::map<const identity*, type*, identity_comparator>
map;
- std::auto_ptr<map> map_;
+ XSD_AUTO_PTR<map> map_;
private:
container* container_;
@@ -973,8 +967,7 @@ namespace xsd
{
if (x.dom_info_.get () != 0 && (f & flags::keep_dom))
{
- std::auto_ptr<dom_info> r (x.dom_info_->clone (*this, c));
- dom_info_ = r;
+ dom_info_ = x.dom_info_->clone (*this, c);
}
}
@@ -1183,25 +1176,25 @@ namespace xsd
{
typedef T type;
- static std::auto_ptr<T>
+ static XSD_AUTO_PTR<T>
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return std::auto_ptr<T> (new T (e, f, c));
+ return XSD_AUTO_PTR<T> (new T (e, f, c));
}
- static std::auto_ptr<T>
+ static XSD_AUTO_PTR<T>
create (const xercesc::DOMAttr& a, flags f, container* c)
{
- return std::auto_ptr<T> (new T (a, f, c));
+ return XSD_AUTO_PTR<T> (new T (a, f, c));
}
- static std::auto_ptr<T>
+ static XSD_AUTO_PTR<T>
create (const std::basic_string<C>& s,
const xercesc::DOMElement* e,
flags f,
container* c)
{
- return std::auto_ptr<T> (new T (s, e, f, c));
+ return XSD_AUTO_PTR<T> (new T (s, e, f, c));
}
};
diff --git a/libxsd/xsd/cxx/tree/istream.hxx b/libxsd/xsd/cxx/tree/istream.hxx
index b76fdcb..1ff2bd8 100644
--- a/libxsd/xsd/cxx/tree/istream.hxx
+++ b/libxsd/xsd/cxx/tree/istream.hxx
@@ -8,9 +8,11 @@
#include <map>
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/istream-fwd.hxx>
namespace xsd
@@ -236,7 +238,7 @@ namespace xsd
S& s_;
std::size_t seq_;
- std::auto_ptr<pool> pool_;
+ XSD_AUTO_PTR<pool> pool_;
};
diff --git a/libxsd/xsd/cxx/tree/ostream.hxx b/libxsd/xsd/cxx/tree/ostream.hxx
index 7d8711e..fde681e 100644
--- a/libxsd/xsd/cxx/tree/ostream.hxx
+++ b/libxsd/xsd/cxx/tree/ostream.hxx
@@ -8,9 +8,11 @@
#include <map>
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
namespace xsd
{
namespace cxx
@@ -187,7 +189,7 @@ namespace xsd
S& s_;
std::size_t seq_;
- std::auto_ptr<pool> pool_;
+ XSD_AUTO_PTR<pool> pool_;
};
diff --git a/libxsd/xsd/cxx/tree/parsing.txx b/libxsd/xsd/cxx/tree/parsing.txx
index e8bca99..14af025 100644
--- a/libxsd/xsd/cxx/tree/parsing.txx
+++ b/libxsd/xsd/cxx/tree/parsing.txx
@@ -35,25 +35,18 @@ namespace xsd
//
inline _type::
_type (const xercesc::DOMElement& e, flags f, container* c)
- : dom_info_ (0), container_ (c)
+ : container_ (c)
{
if (f & flags::keep_dom)
- {
- std::auto_ptr<dom_info> r (
- dom_info_factory::create (e, *this, c == 0));
- dom_info_ = r;
- }
+ dom_info_ = dom_info_factory::create (e, *this, c == 0);
}
inline _type::
_type (const xercesc::DOMAttr& a, flags f, container* c)
- : dom_info_ (0), container_ (c)
+ : container_ (c)
{
if (f & flags::keep_dom)
- {
- std::auto_ptr<dom_info> r (dom_info_factory::create (a, *this));
- dom_info_ = r;
- }
+ dom_info_ = dom_info_factory::create (a, *this);
}
template <typename C>
@@ -62,8 +55,7 @@ namespace xsd
const xercesc::DOMElement*,
flags,
container* c)
- : dom_info_ (0), // List elements don't have associated DOM nodes.
- container_ (c)
+ : container_ (c) // List elements don't have associated DOM nodes.
{
}
diff --git a/libxsd/xsd/cxx/tree/parsing/element-map.txx b/libxsd/xsd/cxx/tree/parsing/element-map.txx
index 71f23a8..a284c39 100644
--- a/libxsd/xsd/cxx/tree/parsing/element-map.txx
+++ b/libxsd/xsd/cxx/tree/parsing/element-map.txx
@@ -17,7 +17,7 @@ namespace xsd
namespace tree
{
template <typename C, typename T>
- std::auto_ptr<element_type<C, T> > element_map<C, T>::
+ XSD_AUTO_PTR<element_type<C, T> > element_map<C, T>::
parse (const xercesc::DOMElement& e, flags f)
{
const qualified_name n (xml::dom::name<C> (e));
@@ -30,10 +30,10 @@ namespace xsd
}
template<typename T, typename C, typename B>
- std::auto_ptr<element_type<C, B> >
+ XSD_AUTO_PTR<element_type<C, B> >
parser_impl (const xercesc::DOMElement& e, flags f)
{
- return std::auto_ptr<element_type<C, B> > (new T (e, f));
+ return XSD_AUTO_PTR<element_type<C, B> > (new T (e, f));
}
}
}
diff --git a/libxsd/xsd/cxx/tree/stream-extraction-map.hxx b/libxsd/xsd/cxx/tree/stream-extraction-map.hxx
index 1c18d51..245d786 100644
--- a/libxsd/xsd/cxx/tree/stream-extraction-map.hxx
+++ b/libxsd/xsd/cxx/tree/stream-extraction-map.hxx
@@ -7,9 +7,11 @@
#define XSD_CXX_TREE_STREAM_EXTRACTION_MAP_HXX
#include <map>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/istream.hxx>
#include <xsd/cxx/xml/qualified-name.hxx>
@@ -24,7 +26,7 @@ namespace xsd
struct stream_extraction_map
{
typedef xml::qualified_name<C> qualified_name;
- typedef std::auto_ptr<type> (*extractor) (
+ typedef XSD_AUTO_PTR<type> (*extractor) (
istream<S>&, flags, container*);
public:
@@ -38,7 +40,7 @@ namespace xsd
void
unregister_type (const qualified_name& name);
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
extract (istream<S>&, flags, container*);
public:
@@ -82,7 +84,7 @@ namespace xsd
//
//
template<typename S, typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
extractor_impl (istream<S>&, flags, container*);
diff --git a/libxsd/xsd/cxx/tree/stream-extraction-map.txx b/libxsd/xsd/cxx/tree/stream-extraction-map.txx
index 17b3fc5..156f9c0 100644
--- a/libxsd/xsd/cxx/tree/stream-extraction-map.txx
+++ b/libxsd/xsd/cxx/tree/stream-extraction-map.txx
@@ -233,7 +233,7 @@ namespace xsd
}
template <typename S, typename C>
- std::auto_ptr<type> stream_extraction_map<S, C>::
+ XSD_AUTO_PTR<type> stream_extraction_map<S, C>::
extract (istream<S>& s, flags f, container* c)
{
std::basic_string<C> ns, name;
@@ -303,10 +303,10 @@ namespace xsd
//
//
template<typename S, typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
extractor_impl (istream<S>& s, flags f, container* c)
{
- return std::auto_ptr<type> (new T (s, f, c));
+ return XSD_AUTO_PTR<type> (new T (s, f, c));
}
diff --git a/libxsd/xsd/cxx/tree/stream-extraction.hxx b/libxsd/xsd/cxx/tree/stream-extraction.hxx
index eef60ca..e4a1740 100644
--- a/libxsd/xsd/cxx/tree/stream-extraction.hxx
+++ b/libxsd/xsd/cxx/tree/stream-extraction.hxx
@@ -67,8 +67,7 @@ namespace xsd
while (size--)
{
- std::auto_ptr<T> p (new T (s, f, c));
- this->push_back (p);
+ this->push_back (XSD_AUTO_PTR<T> (new T (s, f, c)));
}
}
}
diff --git a/libxsd/xsd/cxx/tree/type-factory-map.hxx b/libxsd/xsd/cxx/tree/type-factory-map.hxx
index a42ef96..ea173cc 100644
--- a/libxsd/xsd/cxx/tree/type-factory-map.hxx
+++ b/libxsd/xsd/cxx/tree/type-factory-map.hxx
@@ -8,11 +8,13 @@
#include <map>
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
#include <xercesc/dom/DOMElement.hpp>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/xml/qualified-name.hxx>
@@ -26,9 +28,9 @@ namespace xsd
struct type_factory_map
{
typedef xml::qualified_name<C> qualified_name;
- typedef std::auto_ptr<type> (*factory) (const xercesc::DOMElement&,
- flags,
- container*);
+ typedef XSD_AUTO_PTR<type> (*factory) (const xercesc::DOMElement&,
+ flags,
+ container*);
public:
type_factory_map ();
@@ -49,7 +51,7 @@ namespace xsd
unregister_element (const qualified_name& root,
const qualified_name& subst);
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
create (const C* name, // element name
const C* ns, // element namespace
factory static_type,
@@ -66,7 +68,7 @@ namespace xsd
private:
template <typename T>
- static std::auto_ptr<type>
+ static XSD_AUTO_PTR<type>
traits_adapter (const xercesc::DOMElement&, flags, container*);
private:
@@ -132,7 +134,7 @@ namespace xsd
//
//
template<typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
factory_impl (const xercesc::DOMElement&, flags, container*);
//
diff --git a/libxsd/xsd/cxx/tree/type-factory-map.txx b/libxsd/xsd/cxx/tree/type-factory-map.txx
index 998fb7b..174147c 100644
--- a/libxsd/xsd/cxx/tree/type-factory-map.txx
+++ b/libxsd/xsd/cxx/tree/type-factory-map.txx
@@ -273,7 +273,7 @@ namespace xsd
}
template <typename C>
- std::auto_ptr<type> type_factory_map<C>::
+ XSD_AUTO_PTR<type> type_factory_map<C>::
create (const C* name,
const C* ns,
factory static_type,
@@ -307,7 +307,7 @@ namespace xsd
}
if (f == 0)
- return std::auto_ptr<type> (0); // No match.
+ return XSD_AUTO_PTR<type> (); // No match.
// Check for xsi:type
//
@@ -326,11 +326,10 @@ namespace xsd
template <typename C>
template <typename T>
- std::auto_ptr<type> type_factory_map<C>::
+ XSD_AUTO_PTR<type> type_factory_map<C>::
traits_adapter (const xercesc::DOMElement& e, flags f, container* c)
{
- std::auto_ptr<T> r (traits<T, C>::create (e, f, c));
- return std::auto_ptr<type> (r.release ());
+ return XSD_AUTO_PTR<type> (traits<T, C>::create (e, f, c));
}
template <typename C>
@@ -428,10 +427,10 @@ namespace xsd
//
//
template<typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
factory_impl (const xercesc::DOMElement& e, flags f, container* c)
{
- return std::auto_ptr<type> (new T (e, f, c));
+ return XSD_AUTO_PTR<type> (new T (e, f, c));
}
//
diff --git a/libxsd/xsd/cxx/tree/type-serializer-map.hxx b/libxsd/xsd/cxx/tree/type-serializer-map.hxx
index 0ac9299..ca52129 100644
--- a/libxsd/xsd/cxx/tree/type-serializer-map.hxx
+++ b/libxsd/xsd/cxx/tree/type-serializer-map.hxx
@@ -16,6 +16,7 @@
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/xml/qualified-name.hxx>
+#include <xsd/cxx/xml/dom/auto-ptr.hxx>
#include <xsd/cxx/xml/dom/serialization-header.hxx> // namespace_infomap
namespace xsd
@@ -70,7 +71,7 @@ namespace xsd
// Create DOMDocument with root element suitable for serializing
// x into it.
//
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
serialize (const C* name, // element name
const C* ns, // element namespace
const xml::dom::namespace_infomap<C>&,
diff --git a/libxsd/xsd/cxx/tree/type-serializer-map.txx b/libxsd/xsd/cxx/tree/type-serializer-map.txx
index 1dd1e52..454282e 100644
--- a/libxsd/xsd/cxx/tree/type-serializer-map.txx
+++ b/libxsd/xsd/cxx/tree/type-serializer-map.txx
@@ -399,7 +399,7 @@ namespace xsd
}
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument> type_serializer_map<C>::
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument> type_serializer_map<C>::
serialize (const C* name,
const C* ns,
const xml::dom::namespace_infomap<C>& m,
diff --git a/libxsd/xsd/cxx/tree/types.txx b/libxsd/xsd/cxx/tree/types.txx
index 98fcf81..61cb419 100644
--- a/libxsd/xsd/cxx/tree/types.txx
+++ b/libxsd/xsd/cxx/tree/types.txx
@@ -6,7 +6,13 @@
#include <xercesc/util/Base64.hpp>
#include <xercesc/util/XMLString.hpp>
-#include <xsd/cxx/auto-array.hxx>
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
#include <xsd/cxx/xml/std-memory-manager.hxx>
@@ -318,9 +324,13 @@ namespace xsd
std::basic_string<C> str;
XMLSize_t n;
-
xml::std_memory_manager mm;
+
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLByte[], xml::std_memory_manager&> r (
+#else
auto_array<XMLByte, xml::std_memory_manager> r (
+#endif
Base64::encode (
reinterpret_cast<const XMLByte*> (this->data ()),
static_cast<XMLSize_t> (this->size ()),
@@ -353,9 +363,13 @@ namespace xsd
xml::std_memory_manager mm;
XMLSize_t size;
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLByte[], xml::std_memory_manager&> data (
+#else
auto_array<XMLByte, xml::std_memory_manager> data (
+#endif
Base64::decodeToXMLByte (src, &size, &mm, Base64::Conf_RFC2045),
- mm);
+ mm);
if (data)
{