summaryrefslogtreecommitdiff
path: root/xsd/libxsd/xsd/cxx/xml/string.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/libxsd/xsd/cxx/xml/string.hxx')
-rw-r--r--xsd/libxsd/xsd/cxx/xml/string.hxx39
1 files changed, 22 insertions, 17 deletions
diff --git a/xsd/libxsd/xsd/cxx/xml/string.hxx b/xsd/libxsd/xsd/cxx/xml/string.hxx
index f79e66e..9f4767b 100644
--- a/xsd/libxsd/xsd/cxx/xml/string.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/string.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/string.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_XML_STRING_HXX
@@ -9,9 +8,16 @@
#include <string>
#include <cstddef> // std::size_t
-#include <xsd/cxx/auto-array.hxx>
#include <xercesc/util/XercesDefs.hpp> // XMLCh
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
+
namespace xsd
{
namespace cxx
@@ -31,9 +37,9 @@ namespace xsd
transcode (const XMLCh* s, std::size_t length);
- // For VC7.1 wchar_t and XMLCh are the same type so we cannot
- // overload the transcode name. You should not use these functions
- // anyway and instead use the xml::string class below.
+ // For VC wchar_t and XMLCh are the same type so we cannot overload
+ // the transcode name. You should not use these functions anyway and
+ // instead use the xml::string class below.
//
template <typename C>
XMLCh*
@@ -50,21 +56,16 @@ namespace xsd
public :
template <typename C>
string (const std::basic_string<C>& s)
- : s_ (transcode_to_xmlch<C> (s))
- {
- }
+ : s_ (transcode_to_xmlch<C> (s)) {}
template <typename C>
- string (const C* s)
- : s_ (transcode_to_xmlch<C> (s))
- {
- }
+ string (const C* s): s_ (transcode_to_xmlch<C> (s)) {}
const XMLCh*
- c_str () const
- {
- return s_.get ();
- }
+ c_str () const {return s_.get ();}
+
+ XMLCh*
+ release () {return s_.release ();}
private:
string (const string&);
@@ -73,7 +74,11 @@ namespace xsd
operator= (const string&);
private:
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLCh[]> s_;
+#else
auto_array<XMLCh> s_;
+#endif
};
}
}