summaryrefslogtreecommitdiff
path: root/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:21:29 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:21:29 +0200
commitbada6666c70977a058755ccf232e7d67b24adeed (patch)
tree1e92d50cebce96abaf9bce19e36026c47f77b9ba /libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx
parenteaf34adcbd8095bc6d1f3371b1227f654c7b19fc (diff)
New upstream release
Diffstat (limited to 'libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx')
-rw-r--r--libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx119
1 files changed, 45 insertions, 74 deletions
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 <boris@codesynthesis.com>
-// 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 <cult/containers/list.hxx>
+#include <list>
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/particle.hxx>
@@ -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<Node, Edge>;
-
- 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<ContainsParticle*>
- ContainsList;
+ typedef std::list<ContainsParticle*> ContainsList;
public:
+ typedef pointer_iterator<ContainsList::iterator> ContainsIterator;
typedef
- Bits::PointerIterator<ContainsList::Iterator>
- ContainsIterator;
-
- typedef
- Bits::PointerIterator<ContainsList::ConstIterator>
+ pointer_iterator<ContainsList::const_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<Node, Edge>;
+ 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<Node, Edge>;
-
- 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<Node, Edge>;
-
- 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<Node, Edge>;
-
- Sequence (Path const& file, UnsignedLong line, UnsignedLong column);
+ public:
+ Sequence (Path const& file, unsigned long line, unsigned long column);
};
}
}