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/tree-name-processor.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/tree-name-processor.cxx')
-rw-r--r-- | xsde/cxx/hybrid/tree-name-processor.cxx | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/xsde/cxx/hybrid/tree-name-processor.cxx b/xsde/cxx/hybrid/tree-name-processor.cxx index 9308598..da128c0 100644 --- a/xsde/cxx/hybrid/tree-name-processor.cxx +++ b/xsde/cxx/hybrid/tree-name-processor.cxx @@ -546,28 +546,41 @@ namespace CXX { SemanticGraph::Context& ac (a.context ()); + Boolean def (a.default_ ()); + Boolean fix (a.fixed ()); + + String const& base (ac.get<String> ("name")); + if (!data_members_) { - if (a.optional ()) - ac.set ( - "present", - find_name (ac.get<String> ("name") + L"_present", set_)); + if (a.optional () && !fix) + { + String n; + if (def) + n = find_name (base + L"_default", set_); + else + n = find_name (base + L"_present", set_); - if (detach && !fixed_length (a.type ())) - ac.set ( - "detach", - find_name (ac.get<String> ("name") + L"_detach", set_)); + ac.set (def ? "default" : "present", n); + } + + if (detach && !fix && !fixed_length (a.type ())) + ac.set ("detach", find_name (base + L"_detach", set_)); + if (def) + { + ac.set ( + "default-value", + find_name (base + (fix ? L"_fixed_value" : L"_default_value"), + set_)); + } } - else + else if (!fix) { - String const& base (ac.get<String> ("name")); - - if (a.optional ()) + if (a.optional () && !a.default_ () && fixed_length (a.type ())) { - if (fixed_length (a.type ())) - ac.set ("present-member", - find_name (ac.get<String> ("present") + L"_", set_)); + ac.set ("present-member", + find_name (ac.get<String> ("present") + L"_", set_)); } ac.set ("member", find_name (base + L"_", set_)); |