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/schema.hxx | 152 ++++++++------------- 1 file changed, 54 insertions(+), 98 deletions(-) (limited to 'libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx') diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx index 10d2f75..803c870 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx @@ -1,12 +1,12 @@ // file : xsd-frontend/semantic-graph/schema.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_SCHEMA_HXX #define XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX -#include +#include +#include #include #include @@ -15,11 +15,8 @@ namespace XSDFrontend { namespace SemanticGraph { - // - // class Schema; - class Uses: public virtual Edge { public: @@ -41,21 +38,16 @@ namespace XSDFrontend return path_; } - protected: - friend class Bits::Graph; - - Uses (Path const& path) - : path_ (path) - { - } + public: + Uses (Path const& path): path_ (path) {} - Void + void set_left_node (Schema& s) { user_ = &s; } - Void + void set_right_node (Schema& s) { schema_ = &s; @@ -72,13 +64,8 @@ namespace XSDFrontend // class Implies: public virtual Uses { - protected: - friend class Bits::Graph; - - Implies (Path const& path) - : Uses (path) - { - } + public: + Implies (Path const& path): Uses (path) {} }; @@ -86,13 +73,8 @@ namespace XSDFrontend // class Sources: public virtual Uses { - protected: - friend class Bits::Graph; - - Sources (Path const& path) - : Uses (path) - { - } + public: + Sources (Path const& path): Uses (path) {} }; @@ -100,13 +82,8 @@ namespace XSDFrontend // class Includes: public virtual Uses { - protected: - friend class Bits::Graph; - - Includes (Path const& path) - : Uses (path) - { - } + public: + Includes (Path const& path): Uses (path) {} }; @@ -114,40 +91,29 @@ namespace XSDFrontend // class Imports: public virtual Uses { - protected: - friend class Bits::Graph; - - Imports (Path const& path) - : Uses (path) - { - } + public: + Imports (Path const& path): Uses (path) {} }; - // // - class Schema: public virtual Scope, - private Bits::Graph, - public NonCopyable + class Schema: public graph, public virtual Scope { - typedef - Cult::Containers::Vector - UsesList; - - typedef - Cult::Containers::Vector - UsedList; + typedef std::vector UsesList; + typedef std::vector UsedList; public: - Schema (Path const& file, UnsignedLong line, UnsignedLong column) - : SemanticGraph::Node (file, line, column) + Schema (Path const& file, unsigned long line, unsigned long column) + : Node (file, line, column), graph_ (*this) { } + private: + Schema (Schema const&); + Schema& operator= (Schema const&); + public: - typedef - Bits::PointerIterator - UsesIterator; + typedef pointer_iterator UsesIterator; UsesIterator uses_begin () const @@ -161,9 +127,8 @@ namespace XSDFrontend return uses_.end (); } - typedef - Bits::PointerIterator - UsedIterator; + public: + typedef pointer_iterator UsedIterator; UsedIterator used_begin () const @@ -177,7 +142,7 @@ namespace XSDFrontend return used_.end (); } - Boolean + bool used_p () const { return used_begin () != used_end (); @@ -187,90 +152,81 @@ namespace XSDFrontend find (Name const& name) const; public: - using Bits::Graph::new_edge; - using Bits::Graph::reset_left_node; - using Bits::Graph::reset_right_node; - using Bits::Graph::add_edge_left; - using Bits::Graph::add_edge_right; - using Bits::Graph::delete_node; - using Bits::Graph::delete_edge; + using graph::new_edge; + using graph::reset_left_node; + using graph::reset_right_node; + using graph::add_edge_left; + using graph::add_edge_right; + using graph::delete_node; + using graph::delete_edge; template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column) + new_node (Path const& file, unsigned long line, unsigned long column) { - return graph ().new_node (file, line, column); + return graph_.new_node (file, line, column); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0) { - return graph ().new_node (file, line, column, a0); + return graph_.new_node (file, line, column, a0); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0, A1 const& a1) { - return graph ().new_node (file, line, column, a0, a1); + return graph_.new_node (file, line, column, a0, a1); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0, A1 const& a1, A2 const& a2) { - return graph ().new_node (file, line, column, a0, a1, a2); + return graph_.new_node (file, line, column, a0, a1, a2); } template T& - new_node (Path const& file, UnsignedLong line, UnsignedLong column, + new_node (Path const& file, unsigned long line, unsigned long column, A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3) { - return graph ().new_node (file, line, column, a0, a1, a2, a3); + return graph_.new_node (file, line, column, a0, a1, a2, a3); } - protected: - //@@ gcc bug #21146 - // - friend class Bits::Graph; - + public: using Scope::add_edge_left; using Node::add_edge_right; - Void + void add_edge_left (Uses& e) { uses_.push_back (&e); } - Void + void add_edge_right (Uses& e) { used_.push_back (&e); } private: - Bits::Graph& - graph () - { - return *this; - } + typedef std::set SchemaSet; - private: - UsesList uses_; - UsedList used_; + void + find_ (Name const& name, NamesList&, SchemaSet&) const; private: - typedef Cult::Containers::Set SchemaSet; + graph& graph_; - Void - find_ (Name const& name, NamesList&, SchemaSet&) const; + UsesList uses_; + UsedList used_; mutable NamesList names_; mutable SchemaSet schemas_; -- cgit v1.2.3