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/compositors.hxx | 119 ++++++++------------- 1 file changed, 45 insertions(+), 74 deletions(-) (limited to 'libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx') diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx index c82d8a4..3573c24 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx @@ -1,12 +1,11 @@ // file : xsd-frontend/semantic-graph/compositors.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX #define XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX -#include +#include #include #include @@ -33,43 +32,41 @@ namespace XSDFrontend } public: - UnsignedLong + unsigned long min () const { return min_; } - UnsignedLong + unsigned long max () const { return max_; } - protected: - friend class Bits::Graph; - - ContainsCompositor (UnsignedLong min, UnsignedLong max); + public: + ContainsCompositor (unsigned long min, unsigned long max); - Void + void set_left_node (Node& n) { container_ = &n; } - Void + void set_right_node (Compositor& n) { compositor_ = &n; } - Void + void clear_left_node (Node& n) { assert (container_ == &n); container_ = 0; } - Void + void clear_right_node (Compositor& n) { assert (compositor_ == &n); @@ -79,25 +76,19 @@ namespace XSDFrontend private: Compositor* compositor_; Node* container_; - UnsignedLong min_, max_; + unsigned long min_, max_; }; - // // class Compositor: public virtual Particle { - typedef - Cult::Containers::List - ContainsList; + typedef std::list ContainsList; public: + typedef pointer_iterator ContainsIterator; typedef - Bits::PointerIterator - ContainsIterator; - - typedef - Bits::PointerIterator + pointer_iterator ContainsConstIterator; ContainsIterator @@ -125,7 +116,7 @@ namespace XSDFrontend } public: - Boolean + bool contained_compositor_p () { return contained_compositor_ != 0; @@ -139,7 +130,7 @@ namespace XSDFrontend } public: - UnsignedLong + unsigned long min () const { if (contained_compositor_ != 0) @@ -148,7 +139,7 @@ namespace XSDFrontend return Particle::min (); } - UnsignedLong + unsigned long max () const { if (contained_compositor_ != 0) @@ -157,24 +148,31 @@ namespace XSDFrontend return Particle::max (); } - protected: - friend class Bits::Graph; + public: + Compositor (): contained_compositor_ (0) {} - Compositor () - : contained_compositor_ (0) + void + add_edge_left (ContainsParticle& e) { + contains_.push_back (&e); } - Void - add_edge_left (ContainsParticle& e) + void + add_edge_left (ContainsParticle& e, ContainsIterator const& after) { - contains_.push_back (&e); + if (after.base () == contains_.end ()) + contains_.push_front (&e); + else + { + ContainsList::iterator i (after.base ()); + contains_.insert (++i, &e); + } } - Void + void remove_edge_left (ContainsParticle& e) { - for (ContainsList::Iterator i (contains_.begin ()); + for (ContainsList::iterator i (contains_.begin ()); i != contains_.end (); ++i) { if (*i == &e) @@ -185,77 +183,50 @@ namespace XSDFrontend } } - //@@ Ideally should be protected but then NodeArg has no way to - // access it. Maybe when (if) I move NodeArg into Grpah I can - // resolve this. - // - public: - Void - add_edge_left (ContainsParticle& e, ContainsIterator const& after) - { - if (after.base () == contains_.end ()) - contains_.push_front (&e); - else - { - ContainsList::Iterator i (after.base ()); - contains_.insert (++i, &e); - } - } - - protected: - using Node::add_edge_right; - using Particle::add_edge_right; - using Particle::remove_edge_right; - - Void + void add_edge_right (ContainsCompositor& e) { contained_compositor_ = &e; } - Void + void remove_edge_right (ContainsCompositor& e) { assert (contained_compositor_ == &e); contained_compositor_ = 0; } + using Node::add_edge_right; + using Particle::add_edge_right; + using Particle::remove_edge_right; + private: ContainsList contains_; ContainsCompositor* contained_compositor_; }; - // // class All: public virtual Compositor { - protected: - friend class Bits::Graph; - - All (Path const& file, UnsignedLong line, UnsignedLong column); + public: + All (Path const& file, unsigned long line, unsigned long column); }; - // // class Choice: public virtual Compositor { - protected: - friend class Bits::Graph; - - Choice (Path const& file, UnsignedLong line, UnsignedLong column); + public: + Choice (Path const& file, unsigned long line, unsigned long column); }; - // // class Sequence: public virtual Compositor { - protected: - friend class Bits::Graph; - - Sequence (Path const& file, UnsignedLong line, UnsignedLong column); + public: + Sequence (Path const& file, unsigned long line, unsigned long column); }; } } -- cgit v1.2.3