diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
commit | 8286ac511144e4f17d34eac9affb97e50646344a (patch) | |
tree | f1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /xsd/xsd/cxx/parser/attribute-validation-source.cxx | |
parent | a15cf65c44d5c224169c32ef5495b68c758134b7 (diff) |
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'xsd/xsd/cxx/parser/attribute-validation-source.cxx')
-rw-r--r-- | xsd/xsd/cxx/parser/attribute-validation-source.cxx | 45 |
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); |