From 0fdf19714613a82a184f4f6e75fb9a4f9b62f18a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 19 Jan 2014 10:05:08 +0200 Subject: Use std::unique_ptr instead of std::auto_ptr in C++11 mode --- libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx | 38 +++++-- libxsd/xsd/cxx/tree/containers.hxx | 33 +++--- libxsd/xsd/cxx/tree/containers.txx | 21 +++- libxsd/xsd/cxx/tree/element-map.hxx | 10 +- libxsd/xsd/cxx/tree/elements.hxx | 131 ++++++++++------------ libxsd/xsd/cxx/tree/istream.hxx | 6 +- libxsd/xsd/cxx/tree/ostream.hxx | 6 +- libxsd/xsd/cxx/tree/parsing.txx | 18 +-- libxsd/xsd/cxx/tree/parsing/element-map.txx | 6 +- libxsd/xsd/cxx/tree/stream-extraction-map.hxx | 10 +- libxsd/xsd/cxx/tree/stream-extraction-map.txx | 6 +- libxsd/xsd/cxx/tree/stream-extraction.hxx | 3 +- libxsd/xsd/cxx/tree/type-factory-map.hxx | 16 +-- libxsd/xsd/cxx/tree/type-factory-map.txx | 13 +-- libxsd/xsd/cxx/tree/type-serializer-map.hxx | 3 +- libxsd/xsd/cxx/tree/type-serializer-map.txx | 2 +- libxsd/xsd/cxx/tree/types.txx | 20 +++- 17 files changed, 189 insertions(+), 153 deletions(-) (limited to 'libxsd/xsd/cxx/tree') 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::strdelete #include -#include +#include // XSD_CXX11 + +#ifdef XSD_CXX11 +# include // std::unique_ptr +#else +# include +#endif #include #include @@ -258,11 +264,11 @@ namespace xsd namespace bits { - template - struct ace_str_deallocator + template + struct ace_str_deleter { void - deallocate (C* s) + operator() (C* s) const { ACE::strdelete (s); } @@ -272,18 +278,22 @@ namespace xsd inline istream& operator>> (istream& s, std::basic_string& x) { - typedef bits::ace_str_deallocator deallocator; + typedef bits::ace_str_deleter deleter; - deallocator d; + deleter d; char* r; if (!s.impl ().read_string (r)) throw ace_cdr_stream_extraction (); - auto_array ar (r, d); +#ifdef XSD_CXX11 + std::unique_ptr ar ( +#else + auto_array ar ( +#endif + r, d); x = r; - return s; } @@ -291,18 +301,22 @@ namespace xsd inline istream& operator>> (istream& s, std::basic_string& x) { - typedef bits::ace_str_deallocator deallocator; + typedef bits::ace_str_deleter deleter; - deallocator d; + deleter d; wchar_t* r; if (!s.impl ().read_wstring (r)) throw ace_cdr_stream_extraction (); - auto_array ar (r, d); +#ifdef XSD_CXX11 + std::unique_ptr ar ( +#else + auto_array 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 // std::ptrdiff_t #include #include -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::iterator_traits #include // std::equal, std::lexicographical_compare #include +#include // XSD_AUTO_PTR + #include namespace xsd @@ -136,7 +138,7 @@ namespace xsd one (const T&, container*); - one (std::auto_ptr, container*); + one (XSD_AUTO_PTR, container*); one (const one&, flags, container*); @@ -163,7 +165,7 @@ namespace xsd } void - set (std::auto_ptr); + set (XSD_AUTO_PTR); bool present () const @@ -171,13 +173,13 @@ namespace xsd return x_ != 0; } - std::auto_ptr + XSD_AUTO_PTR detach () { T* x (x_); x->_container (0); x_ = 0; - return std::auto_ptr (x); + return XSD_AUTO_PTR (x); } protected: @@ -268,7 +270,7 @@ namespace xsd optional (const T&, container* = 0); explicit - optional (std::auto_ptr, container* = 0); + optional (XSD_AUTO_PTR, container* = 0); optional (const optional&, flags = 0, container* = 0); @@ -341,18 +343,18 @@ namespace xsd } void - set (std::auto_ptr); + set (XSD_AUTO_PTR); void reset (); - std::auto_ptr + XSD_AUTO_PTR detach () { T* x (x_); x->_container (0); x_ = 0; - return std::auto_ptr (x); + return XSD_AUTO_PTR (x); } protected: @@ -1266,7 +1268,7 @@ namespace xsd } void - push_back (std::auto_ptr x) + push_back (XSD_AUTO_PTR x) { if (x->_container () != container_) x->_container (container_); @@ -1280,7 +1282,7 @@ namespace xsd v_.pop_back (); } - std::auto_ptr + XSD_AUTO_PTR detach_back (bool pop = true) { ptr& p (v_.back ()); @@ -1290,7 +1292,7 @@ namespace xsd if (pop) v_.pop_back (); - return std::auto_ptr (x); + return XSD_AUTO_PTR (x); } iterator @@ -1302,7 +1304,7 @@ namespace xsd } iterator - insert (iterator position, std::auto_ptr x) + insert (iterator position, XSD_AUTO_PTR x) { if (x->_container () != container_) x->_container (container_); @@ -1336,12 +1338,11 @@ namespace xsd } iterator - detach (iterator position, std::auto_ptr& r, bool erase = true) + detach (iterator position, XSD_AUTO_PTR& r, bool erase = true) { ptr& p (*position.base ()); p->_container (0); - std::auto_ptr tmp (static_cast (p.release ())); - r = tmp; + r.reset (static_cast (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 + +#ifdef XSD_CXX11 +# include // std::move +#endif + #include namespace xsd @@ -38,10 +43,14 @@ namespace xsd template one:: - one (std::auto_ptr x, container* c) + one (XSD_AUTO_PTR x, container* c) : x_ (0), container_ (c) { +#ifdef XSD_CXX11 + set (std::move (x)); +#else set (x); +#endif } template @@ -86,7 +95,7 @@ namespace xsd template void one:: - set (std::auto_ptr x) + set (XSD_AUTO_PTR x) { T* r (0); @@ -128,10 +137,14 @@ namespace xsd template optional:: - optional (std::auto_ptr x, container* c) + optional (XSD_AUTO_PTR x, container* c) : x_ (0), container_ (c) { +#ifdef XSD_CXX11 + set (std::move (x)); +#else set (x); +#endif } template @@ -185,7 +198,7 @@ namespace xsd template void optional:: - set (std::auto_ptr x) + set (XSD_AUTO_PTR 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 -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::size_t #include +#include // XSD_AUTO_PTR + #include #include @@ -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 + static XSD_AUTO_PTR parse (const xercesc::DOMElement& e, flags f = 0); /** @@ -61,7 +63,7 @@ namespace xsd typedef xml::qualified_name qualified_name; - typedef std::auto_ptr + typedef XSD_AUTO_PTR (*parser) (const xercesc::DOMElement&, flags f); typedef void @@ -113,7 +115,7 @@ namespace xsd // // template - std::auto_ptr > + XSD_AUTO_PTR > parser_impl (const xercesc::DOMElement&, flags); template 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_AUTO_PTR, XSD_CXX11 + #include #include -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include #include #include +#ifdef XSD_CXX11 +# include // std::move +#endif + #include #include #include @@ -33,7 +39,7 @@ #include #include // xml::properties -#include // dom::auto_ptr +#include // dom::auto_ptr/unique_ptr #include #include @@ -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 argument. + * @c dom::auto_ptr/unique_ptr argument. * */ static const unsigned long own_dom = 0x00000200UL; @@ -386,11 +392,7 @@ namespace xsd { // Drop DOM association. // - if (dom_info_.get ()) - { - std::auto_ptr r (0); - dom_info_ = r; - } + dom_info_.reset (); } return *this; @@ -444,7 +446,7 @@ namespace xsd dr = c; } - std::auto_ptr& m (dr ? dr->map_ : map_); + XSD_AUTO_PTR& 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 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 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 r ( + dom_info_ = dom_info_factory::create ( *static_cast (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 r ( + dom_info_ = dom_info_factory::create ( *static_cast (n), - *this)); + *this); - dom_info_ = r; break; } default: @@ -650,10 +648,7 @@ namespace xsd assert (container_ == 0); if (map_.get () == 0) - { - std::auto_ptr tmp (new map); - map_ = tmp; - } + map_.reset (new map); if (!map_->insert ( std::pair (&i, t)).second) @@ -714,7 +709,7 @@ namespace xsd { } - virtual std::auto_ptr + virtual XSD_AUTO_PTR 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* pd ( - reinterpret_cast*> ( + XSD_DOM_AUTO_PTR* pd ( + reinterpret_cast*> ( 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 + virtual XSD_AUTO_PTR 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 (0); - - return auto_ptr ( - new dom_element_info (*doc_, tree_node)); + return XSD_AUTO_PTR ( + 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 (0); - + return XSD_AUTO_PTR (); // 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 ( + return XSD_AUTO_PTR ( new dom_element_info (static_cast (*dn), tree_node, false)); @@ -835,7 +831,7 @@ namespace xsd } private: - xml::dom::auto_ptr doc_; + XSD_DOM_AUTO_PTR doc_; xercesc::DOMElement& e_; }; @@ -848,11 +844,9 @@ namespace xsd a_.setUserData (user_data_keys::node, &n, 0); } - virtual std::auto_ptr + virtual XSD_AUTO_PTR 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 (0); + return XSD_AUTO_PTR (); } // 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 (0); + return XSD_AUTO_PTR (); // 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 ( + return XSD_AUTO_PTR ( new dom_attribute_info (static_cast (n), tree_node)); } @@ -919,18 +913,18 @@ namespace xsd struct dom_info_factory { - static std::auto_ptr + static XSD_AUTO_PTR create (const xercesc::DOMElement& e, type& n, bool root) { - return std::auto_ptr ( + return XSD_AUTO_PTR ( new dom_element_info ( const_cast (e), n, root)); } - static std::auto_ptr + static XSD_AUTO_PTR create (const xercesc::DOMAttr& a, type& n) { - return std::auto_ptr ( + return XSD_AUTO_PTR ( new dom_attribute_info ( const_cast (a), n)); } @@ -938,7 +932,7 @@ namespace xsd //@endcond - std::auto_ptr dom_info_; + XSD_AUTO_PTR dom_info_; // ID/IDREF map. @@ -961,7 +955,7 @@ namespace xsd std::map map; - std::auto_ptr map_; + XSD_AUTO_PTR map_; private: container* container_; @@ -973,8 +967,7 @@ namespace xsd { if (x.dom_info_.get () != 0 && (f & flags::keep_dom)) { - std::auto_ptr 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 + static XSD_AUTO_PTR create (const xercesc::DOMElement& e, flags f, container* c) { - return std::auto_ptr (new T (e, f, c)); + return XSD_AUTO_PTR (new T (e, f, c)); } - static std::auto_ptr + static XSD_AUTO_PTR create (const xercesc::DOMAttr& a, flags f, container* c) { - return std::auto_ptr (new T (a, f, c)); + return XSD_AUTO_PTR (new T (a, f, c)); } - static std::auto_ptr + static XSD_AUTO_PTR create (const std::basic_string& s, const xercesc::DOMElement* e, flags f, container* c) { - return std::auto_ptr (new T (s, e, f, c)); + return XSD_AUTO_PTR (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 #include -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::size_t +#include // XSD_AUTO_PTR + #include namespace xsd @@ -236,7 +238,7 @@ namespace xsd S& s_; std::size_t seq_; - std::auto_ptr pool_; + XSD_AUTO_PTR 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 #include -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::size_t +#include // XSD_AUTO_PTR + namespace xsd { namespace cxx @@ -187,7 +189,7 @@ namespace xsd S& s_; std::size_t seq_; - std::auto_ptr pool_; + XSD_AUTO_PTR 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 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 r (dom_info_factory::create (a, *this)); - dom_info_ = r; - } + dom_info_ = dom_info_factory::create (a, *this); } template @@ -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 - std::auto_ptr > element_map:: + XSD_AUTO_PTR > element_map:: parse (const xercesc::DOMElement& e, flags f) { const qualified_name n (xml::dom::name (e)); @@ -30,10 +30,10 @@ namespace xsd } template - std::auto_ptr > + XSD_AUTO_PTR > parser_impl (const xercesc::DOMElement& e, flags f) { - return std::auto_ptr > (new T (e, f)); + return XSD_AUTO_PTR > (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 -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::size_t +#include // XSD_AUTO_PTR + #include #include #include @@ -24,7 +26,7 @@ namespace xsd struct stream_extraction_map { typedef xml::qualified_name qualified_name; - typedef std::auto_ptr (*extractor) ( + typedef XSD_AUTO_PTR (*extractor) ( istream&, flags, container*); public: @@ -38,7 +40,7 @@ namespace xsd void unregister_type (const qualified_name& name); - std::auto_ptr + XSD_AUTO_PTR extract (istream&, flags, container*); public: @@ -82,7 +84,7 @@ namespace xsd // // template - std::auto_ptr + XSD_AUTO_PTR extractor_impl (istream&, 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 - std::auto_ptr stream_extraction_map:: + XSD_AUTO_PTR stream_extraction_map:: extract (istream& s, flags f, container* c) { std::basic_string ns, name; @@ -303,10 +303,10 @@ namespace xsd // // template - std::auto_ptr + XSD_AUTO_PTR extractor_impl (istream& s, flags f, container* c) { - return std::auto_ptr (new T (s, f, c)); + return XSD_AUTO_PTR (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 p (new T (s, f, c)); - this->push_back (p); + this->push_back (XSD_AUTO_PTR (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 #include -#include // std::auto_ptr +#include // std::auto_ptr/unique_ptr #include // std::size_t #include +#include // XSD_AUTO_PTR + #include #include @@ -26,9 +28,9 @@ namespace xsd struct type_factory_map { typedef xml::qualified_name qualified_name; - typedef std::auto_ptr (*factory) (const xercesc::DOMElement&, - flags, - container*); + typedef XSD_AUTO_PTR (*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 + XSD_AUTO_PTR create (const C* name, // element name const C* ns, // element namespace factory static_type, @@ -66,7 +68,7 @@ namespace xsd private: template - static std::auto_ptr + static XSD_AUTO_PTR traits_adapter (const xercesc::DOMElement&, flags, container*); private: @@ -132,7 +134,7 @@ namespace xsd // // template - std::auto_ptr + XSD_AUTO_PTR 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 - std::auto_ptr type_factory_map:: + XSD_AUTO_PTR type_factory_map:: create (const C* name, const C* ns, factory static_type, @@ -307,7 +307,7 @@ namespace xsd } if (f == 0) - return std::auto_ptr (0); // No match. + return XSD_AUTO_PTR (); // No match. // Check for xsi:type // @@ -326,11 +326,10 @@ namespace xsd template template - std::auto_ptr type_factory_map:: + XSD_AUTO_PTR type_factory_map:: traits_adapter (const xercesc::DOMElement& e, flags f, container* c) { - std::auto_ptr r (traits::create (e, f, c)); - return std::auto_ptr (r.release ()); + return XSD_AUTO_PTR (traits::create (e, f, c)); } template @@ -428,10 +427,10 @@ namespace xsd // // template - std::auto_ptr + XSD_AUTO_PTR factory_impl (const xercesc::DOMElement& e, flags f, container* c) { - return std::auto_ptr (new T (e, f, c)); + return XSD_AUTO_PTR (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 #include +#include #include // 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 + XSD_DOM_AUTO_PTR serialize (const C* name, // element name const C* ns, // element namespace const xml::dom::namespace_infomap&, 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 - xml::dom::auto_ptr type_serializer_map:: + XSD_DOM_AUTO_PTR type_serializer_map:: serialize (const C* name, const C* ns, const xml::dom::namespace_infomap& 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 #include -#include +#include // XSD_CXX11 + +#ifdef XSD_CXX11 +# include // std::unique_ptr +#else +# include +#endif #include @@ -318,9 +324,13 @@ namespace xsd std::basic_string str; XMLSize_t n; - xml::std_memory_manager mm; + +#ifdef XSD_CXX11 + std::unique_ptr r ( +#else auto_array r ( +#endif Base64::encode ( reinterpret_cast (this->data ()), static_cast (this->size ()), @@ -353,9 +363,13 @@ namespace xsd xml::std_memory_manager mm; XMLSize_t size; +#ifdef XSD_CXX11 + std::unique_ptr data ( +#else auto_array data ( +#endif Base64::decodeToXMLByte (src, &size, &mm, Base64::Conf_RFC2045), - mm); + mm); if (data) { -- cgit v1.1