diff options
Diffstat (limited to 'xsde/cxx/hybrid/insertion-source.cxx')
-rw-r--r-- | xsde/cxx/hybrid/insertion-source.cxx | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/xsde/cxx/hybrid/insertion-source.cxx b/xsde/cxx/hybrid/insertion-source.cxx index b0b89c9..7dc6fcb 100644 --- a/xsde/cxx/hybrid/insertion-source.cxx +++ b/xsde/cxx/hybrid/insertion-source.cxx @@ -100,19 +100,41 @@ namespace CXX virtual Void traverse (SemanticGraph::Attribute& a) { + // Don't waste space on fixed attributes. + // + if (a.fixed ()) + return; + if (a.optional ()) { - String const& present (epresent (a)); + if (!a.default_ ()) + { + String const& present (epresent (a)); - if (exceptions) - os << "s << x." << present << " ();"; + if (exceptions) + os << "s << x." << present << " ();"; + else + os << "if (!(s << x." << present << " ()))" << endl + << "return false;"; + + os << endl + << "if (x." << present << " ())" + << "{"; + } else - os << "if (!(s << x." << present << " ()))" << endl - << "return false;"; + { + String const& default_ (edefault (a)); - os << endl - << "if (x." << present << " ())" - << "{"; + if (exceptions) + os << "s << x." << default_ << " ();"; + else + os << "if (!(s << x." << default_ << " ()))" << endl + << "return false;"; + + os << endl + << "if (!x." << default_ << " ())" + << "{"; + } } String const& name (ename (a)); |