summaryrefslogtreecommitdiff
path: root/xsd/cxx/parser
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/parser
parent45db924dfc19b49b7930522dbddd123fb9575e32 (diff)
Use std::unique_ptr instead of std::auto_ptr in C++11 mode
Diffstat (limited to 'xsd/cxx/parser')
-rw-r--r--xsd/cxx/parser/attribute-validation-source.cxx2
-rw-r--r--xsd/cxx/parser/element-validation-source.cxx2
-rw-r--r--xsd/cxx/parser/generator.cxx12
-rw-r--r--xsd/cxx/parser/parser-header.cxx4
-rw-r--r--xsd/cxx/parser/print-impl-common.hxx2
5 files changed, 16 insertions, 6 deletions
diff --git a/xsd/cxx/parser/attribute-validation-source.cxx b/xsd/cxx/parser/attribute-validation-source.cxx
index c4fe5ad..ba412b0 100644
--- a/xsd/cxx/parser/attribute-validation-source.cxx
+++ b/xsd/cxx/parser/attribute-validation-source.cxx
@@ -126,7 +126,7 @@ namespace CXX
// compilers (e.g., IBM xlC that needs an lvalue to pass
// std::auto_ptr).
//
- if (options.std () == cxx_version::cxx98)
+ if (std == cxx_version::cxx98)
os << arg_type (type) << " tmp (this->" << inst << "->" <<
post << " ());"
<< "this->" << name << " (tmp);";
diff --git a/xsd/cxx/parser/element-validation-source.cxx b/xsd/cxx/parser/element-validation-source.cxx
index 310ea27..1bc506a 100644
--- a/xsd/cxx/parser/element-validation-source.cxx
+++ b/xsd/cxx/parser/element-validation-source.cxx
@@ -314,7 +314,7 @@ namespace CXX
// compilers (e.g., IBM xlC that needs an lvalue to pass
// std::auto_ptr).
//
- if (options.std () == cxx_version::cxx98)
+ if (std == cxx_version::cxx98)
os << arg_type (type) << " tmp (" << inst << "->" <<
post << " ());"
<< "this->" << name << " (tmp);";
diff --git a/xsd/cxx/parser/generator.cxx b/xsd/cxx/parser/generator.cxx
index a262004..46a0687 100644
--- a/xsd/cxx/parser/generator.cxx
+++ b/xsd/cxx/parser/generator.cxx
@@ -290,12 +290,14 @@ namespace CXX
string_type = L"::std::basic_string< " + char_type + L" >";
String xns;
+ String auto_ptr;
{
Context ctx (std::wcerr, schema, file_path, ops, 0, 0, 0, 0);
xns = ctx.xs_ns_name ();
+ auto_ptr = ctx.auto_ptr;
}
- String buffer (L"::std::auto_ptr< " + xns + L"::buffer >");
+ String buffer (auto_ptr + L"< " + xns + L"::buffer >");
TypeMap::Namespace xsd ("http://www\\.w3\\.org/2001/XMLSchema");
xsd.types_push_back ("string", string_type);
@@ -777,6 +779,14 @@ namespace CXX
<< "#define " << guard << endl
<< endl;
+ if (ctx.std >= cxx_version::cxx11)
+ {
+ hxx << "#ifndef XSD_CXX11" << endl
+ << "#define XSD_CXX11" << endl
+ << "#endif" << endl
+ << endl;
+ }
+
// Version check.
//
hxx << "#include <xsd/cxx/config.hxx>" << endl
diff --git a/xsd/cxx/parser/parser-header.cxx b/xsd/cxx/parser/parser-header.cxx
index 5db1ef4..cd266ae 100644
--- a/xsd/cxx/parser/parser-header.cxx
+++ b/xsd/cxx/parser/parser-header.cxx
@@ -1008,7 +1008,7 @@ namespace CXX
virtual void
traverse (SemanticGraph::Fundamental::Base64Binary& t)
{
- String buffer (L"::std::auto_ptr< " + xs_ns_ + L"::buffer >");
+ String buffer (auto_ptr + L"< " + xs_ns_ + L"::buffer >");
gen_typedef (t, buffer,
"base64_binary_pskel", "base64_binary_pimpl");
}
@@ -1016,7 +1016,7 @@ namespace CXX
virtual void
traverse (SemanticGraph::Fundamental::HexBinary& t)
{
- String buffer (L"::std::auto_ptr< " + xs_ns_ + L"::buffer >");
+ String buffer (auto_ptr + L"< " + xs_ns_ + L"::buffer >");
gen_typedef (t, buffer, "hex_binary_pskel", "hex_binary_pimpl");
}
diff --git a/xsd/cxx/parser/print-impl-common.hxx b/xsd/cxx/parser/print-impl-common.hxx
index db26ea8..ab38ea4 100644
--- a/xsd/cxx/parser/print-impl-common.hxx
+++ b/xsd/cxx/parser/print-impl-common.hxx
@@ -605,7 +605,7 @@ namespace CXX
void
gen_buffer (SemanticGraph::Type& t)
{
- String type (L"::std::auto_ptr< " + xs_ns_name () + L"::buffer >");
+ String type (auto_ptr + L"< " + xs_ns_name () + L"::buffer >");
if (default_type (t, type))
{