summaryrefslogtreecommitdiff
path: root/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx')
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx152
1 files changed, 54 insertions, 98 deletions
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 <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_SCHEMA_HXX
#define XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX
-#include <cult/containers/set.hxx>
+#include <set>
+#include <vector>
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/namespace.hxx>
@@ -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<Node, Edge>;
-
- 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<Node, Edge>;
-
- 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<Node, Edge>;
-
- 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<Node, Edge>;
-
- 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<Node, Edge>;
-
- Imports (Path const& path)
- : Uses (path)
- {
- }
+ public:
+ Imports (Path const& path): Uses (path) {}
};
-
//
//
- class Schema: public virtual Scope,
- private Bits::Graph<Node, Edge>,
- public NonCopyable
+ class Schema: public graph, public virtual Scope
{
- typedef
- Cult::Containers::Vector<Uses*>
- UsesList;
-
- typedef
- Cult::Containers::Vector<Uses*>
- UsedList;
+ typedef std::vector<Uses*> UsesList;
+ typedef std::vector<Uses*> 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<UsesList::ConstIterator>
- UsesIterator;
+ typedef pointer_iterator<UsesList::const_iterator> UsesIterator;
UsesIterator
uses_begin () const
@@ -161,9 +127,8 @@ namespace XSDFrontend
return uses_.end ();
}
- typedef
- Bits::PointerIterator<UsedList::ConstIterator>
- UsedIterator;
+ public:
+ typedef pointer_iterator<UsedList::const_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<SemanticGraph::Node, Edge>::new_edge;
- using Bits::Graph<SemanticGraph::Node, Edge>::reset_left_node;
- using Bits::Graph<SemanticGraph::Node, Edge>::reset_right_node;
- using Bits::Graph<SemanticGraph::Node, Edge>::add_edge_left;
- using Bits::Graph<SemanticGraph::Node, Edge>::add_edge_right;
- using Bits::Graph<SemanticGraph::Node, Edge>::delete_node;
- using Bits::Graph<SemanticGraph::Node, Edge>::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 <typename T>
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<T> (file, line, column);
+ return graph_.new_node<T> (file, line, column);
}
template <typename T, typename A0>
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<T> (file, line, column, a0);
+ return graph_.new_node<T> (file, line, column, a0);
}
template <typename T, typename A0, typename A1>
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<T> (file, line, column, a0, a1);
+ return graph_.new_node<T> (file, line, column, a0, a1);
}
template <typename T, typename A0, typename A1, typename A2>
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<T> (file, line, column, a0, a1, a2);
+ return graph_.new_node<T> (file, line, column, a0, a1, a2);
}
template <typename T, typename A0, typename A1, typename A2,
typename A3>
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<T> (file, line, column, a0, a1, a2, a3);
+ return graph_.new_node<T> (file, line, column, a0, a1, a2, a3);
}
- protected:
- //@@ gcc bug #21146
- //
- friend class Bits::Graph<SemanticGraph::Node, Edge>;
-
+ 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<SemanticGraph::Node, Edge>&
- graph ()
- {
- return *this;
- }
+ typedef std::set<Schema const*> SchemaSet;
- private:
- UsesList uses_;
- UsedList used_;
+ void
+ find_ (Name const& name, NamesList&, SchemaSet&) const;
private:
- typedef Cult::Containers::Set<Schema const*> SchemaSet;
+ graph& graph_;
- Void
- find_ (Name const& name, NamesList&, SchemaSet&) const;
+ UsesList uses_;
+ UsedList used_;
mutable NamesList names_;
mutable SchemaSet schemas_;