aboutsummaryrefslogtreecommitdiff
path: root/xsd/cxx/tree/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/tree/elements.cxx
parent45db924dfc19b49b7930522dbddd123fb9575e32 (diff)
Use std::unique_ptr instead of std::auto_ptr in C++11 mode
Diffstat (limited to 'xsd/cxx/tree/elements.cxx')
-rw-r--r--xsd/cxx/tree/elements.cxx61
1 files changed, 32 insertions, 29 deletions
diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx
index 8021287..10bf999 100644
--- a/xsd/cxx/tree/elements.cxx
+++ b/xsd/cxx/tree/elements.cxx
@@ -93,7 +93,10 @@ namespace CXX
xsc.get<String> ("error-handler");
}
- dom_auto_ptr_ = xs_name + L"::dom::auto_ptr";
+ dom_auto_ptr_ = xs_name + (std >= cxx_version::cxx11
+ ? L"::dom::unique_ptr"
+ : L"::dom::auto_ptr");
+
dom_node_key_ = xs_name + L"::dom::" +
xsc.get<String> ("tree-node-key");
@@ -828,7 +831,7 @@ namespace CXX
// FromBaseCtorArg
//
FromBaseCtorArg::
- FromBaseCtorArg (Context& c, ArgType at, bool arg)
+ FromBaseCtorArg (Context& c, CtorArgType at, bool arg)
: Context (c), arg_type_ (at), arg_ (arg)
{
}
@@ -863,29 +866,29 @@ namespace CXX
os << "," << endl;
- bool auto_ptr (false);
+ bool ptr (false);
switch (arg_type_)
{
- case arg_complex_auto_ptr:
+ case CtorArgType::complex_auto_ptr:
{
bool simple (true);
IsSimpleType t (simple);
t.dispatch (e.type ());
- auto_ptr = !simple;
+ ptr = !simple;
break;
}
- case arg_poly_auto_ptr:
+ case CtorArgType::poly_auto_ptr:
{
- auto_ptr = polymorphic && polymorphic_p (e.type ());
+ ptr = polymorphic && polymorphic_p (e.type ());
break;
}
- case arg_type:
+ case CtorArgType::type:
break;
}
- if (auto_ptr)
- os << "::std::auto_ptr< " << etype (e) << " >&";
+ if (ptr)
+ os << auto_ptr << "< " << etype (e) << " >";
else
os << "const " << etype (e) << "&";
@@ -916,7 +919,7 @@ namespace CXX
// CtorArgs
//
CtorArgs::
- CtorArgs (Context& c, ArgType at)
+ CtorArgs (Context& c, CtorArgType at)
: Context (c),
arg_type_ (at),
base_arg_ (0),
@@ -928,7 +931,7 @@ namespace CXX
}
CtorArgs::
- CtorArgs (Context& c, ArgType at, String& base_arg)
+ CtorArgs (Context& c, CtorArgType at, String& base_arg)
: Context (c),
arg_type_ (at),
base_arg_ (&base_arg),
@@ -1000,29 +1003,29 @@ namespace CXX
if (min (e) == 1 && max (e) == 1)
{
- bool auto_ptr (false);
+ bool ptr (false);
switch (arg_type_)
{
- case arg_complex_auto_ptr:
+ case CtorArgType::complex_auto_ptr:
{
bool simple (true);
IsSimpleType t (simple);
t.dispatch (e.type ());
- auto_ptr = !simple;
+ ptr = !simple;
break;
}
- case arg_poly_auto_ptr:
+ case CtorArgType::poly_auto_ptr:
{
- auto_ptr = polymorphic && polymorphic_p (e.type ());
+ ptr = polymorphic && polymorphic_p (e.type ());
break;
}
- case arg_type:
+ case CtorArgType::type:
break;
}
- if (auto_ptr)
- os << comma () << "::std::auto_ptr< " << etype (e) << " >&";
+ if (ptr)
+ os << comma () << auto_ptr << "< " << etype (e) << " >";
else
os << comma () << "const " << etype (e) << "&";
@@ -1059,7 +1062,7 @@ namespace CXX
// CtorArgsWithoutBase
//
CtorArgsWithoutBase::
- CtorArgsWithoutBase (Context& c, ArgType at, bool arg, bool first)
+ CtorArgsWithoutBase (Context& c, CtorArgType at, bool arg, bool first)
: Context (c), arg_type_ (at), arg_ (arg), first_ (first)
{
*this >> inherits_ >> *this;
@@ -1089,29 +1092,29 @@ namespace CXX
if (min (e) == 1 && max (e) == 1)
{
- bool auto_ptr (false);
+ bool ptr (false);
switch (arg_type_)
{
- case arg_complex_auto_ptr:
+ case CtorArgType::complex_auto_ptr:
{
bool simple (true);
IsSimpleType t (simple);
t.dispatch (e.type ());
- auto_ptr = !simple;
+ ptr = !simple;
break;
}
- case arg_poly_auto_ptr:
+ case CtorArgType::poly_auto_ptr:
{
- auto_ptr = polymorphic && polymorphic_p (e.type ());
+ ptr = polymorphic && polymorphic_p (e.type ());
break;
}
- case arg_type:
+ case CtorArgType::type:
break;
}
- if (auto_ptr)
- os << comma () << "::std::auto_ptr< " << etype (e) << " >&";
+ if (ptr)
+ os << comma () << auto_ptr << "< " << etype (e) << " >";
else
os << comma () << "const " << etype (e) << "&";