diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-04-02 12:22:38 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-04-02 12:22:38 +0200 |
commit | 8336dd4c16d4885989a6d8f0c83a4b401f5cb63b (patch) | |
tree | 26ca613e7f3a3fe9fb75bf5bb3b65503661e0ebf /xsde/cxx/hybrid/serializer-source.cxx | |
parent | e4c22d3686da0e973e21eae0561c1169c0eeff36 (diff) |
Add support for attributes with default and fixed values.
tests/cxx/hybrid/default: new test
tests/cxx/hybrid/binary: update to test default and fixed values
Diffstat (limited to 'xsde/cxx/hybrid/serializer-source.cxx')
-rw-r--r-- | xsde/cxx/hybrid/serializer-source.cxx | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/xsde/cxx/hybrid/serializer-source.cxx b/xsde/cxx/hybrid/serializer-source.cxx index 540d742..b0c194e 100644 --- a/xsde/cxx/hybrid/serializer-source.cxx +++ b/xsde/cxx/hybrid/serializer-source.cxx @@ -886,9 +886,26 @@ namespace CXX { os << "bool " << s << "::" << endl << espresent (a) << " ()" - << "{" - << "return " << access << epresent (a) << " ();" - << "}"; + << "{"; + + if (a.default_ ()) + { + Boolean omit (options.value<CLI::omit_default_attributes> ()); + + if (a.fixed ()) + os << "return " << (omit ? "false" : "true") << ";"; + else + { + if (omit) + os << "return !" << access << edefault (a) << " ();"; + else + os << "return true;"; + } + } + else + os << "return " << access << epresent (a) << " ();"; + + os << "}"; } SemanticGraph::Type& t (a.type ()); |