diff options
Diffstat (limited to 'xsde/cxx/hybrid/tree-size-processor.cxx')
-rw-r--r-- | xsde/cxx/hybrid/tree-size-processor.cxx | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/xsde/cxx/hybrid/tree-size-processor.cxx b/xsde/cxx/hybrid/tree-size-processor.cxx index 33d829a..c6b347e 100644 --- a/xsde/cxx/hybrid/tree-size-processor.cxx +++ b/xsde/cxx/hybrid/tree-size-processor.cxx @@ -237,20 +237,23 @@ namespace CXX // struct Type: Traversal::List, Traversal::Union, - Traversal::Complex + Traversal::Complex, + Traversal::Enumeration { Type (Boolean& valid, TypeSet& custom_data, CustomTypeMap& custom_type_map, TypeSet& poly_types, Boolean stl_, - Boolean poly_) + Boolean poly_, + Boolean enum_mapping) : valid_ (valid), custom_data_ (custom_data), custom_type_map_ (custom_type_map), poly_types_ (poly_types), stl (stl_), - poly (poly_) + poly (poly_), + enum_ (enum_mapping) { } @@ -281,6 +284,44 @@ namespace CXX } virtual Void + traverse (SemanticGraph::Enumeration& e) + { + if (!test (e)) + { + // First process our base since enum_mapping() needs the + // polymorphic property determined. + // + SemanticGraph::Type& b (e.inherits ().base ()); + + if (!test (b)) + dispatch (b); + + SemanticGraph::Enumeration* base_enum (0); + + if (!enum_ || !Context::enum_mapping (e, &base_enum)) + { + traverse (static_cast<SemanticGraph::Complex&> (e)); + return; + } + + Boolean fixed (true); + + if (base_enum && !get (b)) + fixed = false; + + // Check for custom data. + // + if (fixed) + { + if (custom_data_.find (e.name ()) != custom_data_.end ()) + fixed = false; + } + + set (e, fixed); + } + } + + virtual Void traverse (SemanticGraph::Complex& c) { SemanticGraph::Context& ctx (c.context ()); @@ -428,6 +469,7 @@ namespace CXX TypeSet& poly_types_; Boolean stl; Boolean poly; + Boolean enum_; typedef Containers::Vector<SemanticGraph::Complex*> Path; Path path_; @@ -1184,7 +1226,8 @@ namespace CXX custom_type_map, poly_types, stl, - poly); + poly, + !ops.value<CLI::suppress_enum> ()); schema >> schema_names >> ns >> ns_names >> type; |