summaryrefslogtreecommitdiff
path: root/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/libxsd/xsd/cxx/parser/expat/elements.hxx')
-rw-r--r--xsd/libxsd/xsd/cxx/parser/expat/elements.hxx30
1 files changed, 24 insertions, 6 deletions
diff --git a/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx b/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx
index c9f3de0..86e7a73 100644
--- a/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx
@@ -1,16 +1,21 @@
// file : xsd/cxx/parser/expat/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_EXPAT_ELEMENTS_HXX
#define XSD_CXX_PARSER_EXPAT_ELEMENTS_HXX
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
#include <string>
#include <iosfwd>
#include <cstddef> // std::size_t
#include <vector>
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#endif
+
#include <expat.h>
// We only support UTF-8 expat for now.
@@ -35,6 +40,19 @@ namespace xsd
{
namespace expat
{
+#ifdef XSD_CXX11
+ struct parser_deleter
+ {
+ void
+ operator() (XML_Parser p) const
+ {
+ if (p != 0)
+ XML_ParserFree (p);
+ }
+ };
+
+ typedef std::unique_ptr<XML_ParserStruct> parser_auto_ptr;
+#else
// Simple auto pointer for Expat's XML_Parser object.
//
struct parser_auto_ptr
@@ -61,8 +79,8 @@ namespace xsd
return *this;
}
- public:
- operator XML_Parser ()
+ XML_Parser
+ get () const
{
return parser_;
}
@@ -76,12 +94,12 @@ namespace xsd
private:
XML_Parser parser_;
};
-
+#endif // XSD_CXX11
//
//
template <typename C>
- struct document: cxx::parser::document<C> // VC 7.1 likes it qualified
+ struct document: cxx::parser::document<C> // VC likes it qualified
{
public:
document (parser_base<C>&,