diff options
Diffstat (limited to 'libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx')
-rw-r--r-- | libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx index 40327bc..ac47810 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx @@ -1,6 +1,5 @@ // file : xsd-frontend/semantic-graph/complex.hxx -// 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 #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPLEX_HXX @@ -9,8 +8,6 @@ #include <xsd-frontend/semantic-graph/elements.hxx> #include <xsd-frontend/semantic-graph/compositors.hxx> -#include <cult/containers/vector.hxx> - namespace XSDFrontend { namespace SemanticGraph @@ -18,15 +15,27 @@ namespace XSDFrontend class Complex: public virtual Type, public virtual Scope { public: - Boolean + bool mixed_p () const { - return mixed_; + if (mixed_) + return true; + + // If we have empty content, then we have the same content + // type as our base. + // + if (!contains_compositor_p () && inherits_p ()) + { + if (Complex* b = dynamic_cast<Complex*> (&inherits ().base ())) + return b->mixed_p (); + } + + return false; } public: - Boolean - contains_compositor_p () + bool + contains_compositor_p () const { return contains_compositor_ != 0; } @@ -39,37 +48,37 @@ namespace XSDFrontend } public: - Void - mixed_p (Boolean m) + void + mixed_p (bool m) { mixed_ = m; } - protected: - friend class Bits::Graph<Node, Edge>; - - Complex (); // Virtual inheritance (Enumeration). - Complex (Path const& file, UnsignedLong line, UnsignedLong column); - - using Type::add_edge_right; - using Type::add_edge_left; - using Scope::add_edge_left; + public: + Complex (Path const& file, unsigned long line, unsigned long column); - Void + void add_edge_left (ContainsCompositor& e) { contains_compositor_ = &e; } - Void + void remove_edge_left (ContainsCompositor& e) { assert (contains_compositor_ == &e); contains_compositor_ = 0; } + using Type::add_edge_right; + using Type::add_edge_left; + using Scope::add_edge_left; + + protected: + Complex (); // For virtual inheritance (Enumeration). + private: - Boolean mixed_; + bool mixed_; ContainsCompositor* contains_compositor_; }; } |