summaryrefslogtreecommitdiff
path: root/xsd/cxx/elements.cxx
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 /xsd/cxx/elements.cxx
parent45db924dfc19b49b7930522dbddd123fb9575e32 (diff)
Use std::unique_ptr instead of std::auto_ptr in C++11 mode
Diffstat (limited to 'xsd/cxx/elements.cxx')
-rw-r--r--xsd/cxx/elements.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/xsd/cxx/elements.cxx b/xsd/cxx/elements.cxx
index 4a76444..5ee1f28 100644
--- a/xsd/cxx/elements.cxx
+++ b/xsd/cxx/elements.cxx
@@ -118,10 +118,12 @@ namespace CXX
schema_root (root),
schema_path (schema_path_),
options (ops),
+ std (ops.std ()),
char_type (char_type_),
char_encoding (char_encoding_),
L (L_),
string_type (string_type_),
+ auto_ptr (auto_ptr_),
string_literal_map (string_literal_map_),
type_exp (type_exp_),
inst_exp (inst_exp_),
@@ -184,6 +186,12 @@ namespace CXX
else
string_type_ = L"::std::basic_string< " + char_type + L" >";
+ // Automatic pointer type.
+ //
+ auto_ptr_ = std >= cxx_version::cxx11
+ ? "::std::unique_ptr"
+ : "::std::auto_ptr";
+
// Default encoding.
//
if (!char_encoding)
@@ -197,7 +205,7 @@ namespace CXX
// Default mapping.
//
nsr_mapping_.push_back (
- Regex (L"#^.* (.*?/)??"L"(([a-zA-Z_]\\w*)(/[a-zA-Z_]\\w*)*)/?$#$2#"));
+ Regex (L"#^.* (.*?/)??" L"(([a-zA-Z_]\\w*)(/[a-zA-Z_]\\w*)*)/?$#$2#"));
nsr_mapping_.push_back (
Regex (L"#^.* http://www\\.w3\\.org/2001/XMLSchema$#xml_schema#"));
@@ -1093,9 +1101,10 @@ namespace CXX
{
if (escape)
{
- // Close and open the string so there are no clashes.
+ // Close and open the string so there are no clashes. C++11
+ // requires a space between " and L.
//
- r += L"\"L\"";
+ r += L"\" L\"";
escape = false;
}