summaryrefslogtreecommitdiff
path: root/xsd/xsd/cxx/parser/attribute-validation-source.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/xsd/cxx/parser/attribute-validation-source.cxx')
-rw-r--r--xsd/xsd/cxx/parser/attribute-validation-source.cxx45
1 files changed, 27 insertions, 18 deletions
diff --git a/xsd/xsd/cxx/parser/attribute-validation-source.cxx b/xsd/xsd/cxx/parser/attribute-validation-source.cxx
index 536e2da..7ed54e4 100644
--- a/xsd/xsd/cxx/parser/attribute-validation-source.cxx
+++ b/xsd/xsd/cxx/parser/attribute-validation-source.cxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/attribute-validation-source.cxx
-// 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
#include <cxx/parser/attribute-validation-source.hxx>
@@ -23,7 +22,7 @@ namespace CXX
{
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Attribute& a)
{
String const& name (a.name ());
@@ -39,7 +38,7 @@ namespace CXX
os << "n == " << strlit (name) << " && ns.empty ()";
}
- virtual Void
+ virtual void
traverse (SemanticGraph::AnyAttribute& a)
{
String const& ns (a.definition_namespace ().name ());
@@ -93,7 +92,7 @@ namespace CXX
{
}
- virtual Void
+ virtual void
traverse (Type& a)
{
String const& name (ename (a));
@@ -120,10 +119,20 @@ namespace CXX
os << "this->" << inst << "->" << post << " ();"
<< "this->" << name << " ();";
else
- os << arg_type (type) << " tmp (this->" << inst << "->" <<
- post << " ());"
- << "this->" << name << " (tmp);"
- << endl;
+ {
+ // Don't create an lvalue in C++11 (think std::unique_ptr).
+ // In C++98 we do it for compatibility with older/broken
+ // compilers (e.g., IBM xlC that needs an lvalue to pass
+ // std::auto_ptr).
+ //
+ if (std == cxx_version::cxx98)
+ os << arg_type (type) << " tmp (this->" << inst << "->" <<
+ post << " ());"
+ << "this->" << name << " (tmp);";
+ else
+ os << "this->" << name << " (this->" << inst << "->" <<
+ post << " ());";
+ }
os << "}";
@@ -149,7 +158,7 @@ namespace CXX
{
}
- virtual Void
+ virtual void
traverse (Type& a)
{
os << "if (";
@@ -177,7 +186,7 @@ namespace CXX
{
}
- virtual Void
+ virtual void
traverse (Type& a)
{
if (!a.optional_p ())
@@ -195,7 +204,7 @@ namespace CXX
{
}
- virtual Void
+ virtual void
traverse (Type& a)
{
if (!a.optional_p ())
@@ -227,16 +236,16 @@ namespace CXX
names_attribute_state_check_ >> attribute_state_check_;
}
- virtual Void
+ virtual void
traverse (Type& c)
{
- Boolean has_att (has<Traversal::Attribute> (c));
- Boolean has_any (has<Traversal::AnyAttribute> (c));
+ bool has_att (has<Traversal::Attribute> (c));
+ bool has_any (has<Traversal::AnyAttribute> (c));
if (!has_att && !has_any)
return;
- Boolean has_req_att (false);
+ bool has_req_att (false);
if (has_att)
{
RequiredAttributeTest test (has_req_att);
@@ -380,12 +389,12 @@ namespace CXX
};
}
- Void
+ void
generate_attribute_validation_source (Context& ctx)
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);