From 8286ac511144e4f17d34eac9affb97e50646344a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:25:44 +0200 Subject: Imported Upstream version 4.0.0 --- .../xsd-frontend/semantic-graph/complex.hxx | 53 +++++++++++++--------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx') 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 -// 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 #include -#include - 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 (&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; - - 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_; }; } -- cgit v1.2.3