summaryrefslogtreecommitdiff
path: root/odb/odb/traversal
diff options
context:
space:
mode:
Diffstat (limited to 'odb/odb/traversal')
-rw-r--r--odb/odb/traversal/class-template.cxx62
-rw-r--r--odb/odb/traversal/class-template.hxx45
-rw-r--r--odb/odb/traversal/class.cxx34
-rw-r--r--odb/odb/traversal/class.hxx40
-rw-r--r--odb/odb/traversal/derived.cxx111
-rw-r--r--odb/odb/traversal/derived.hxx130
-rw-r--r--odb/odb/traversal/elements.cxx77
-rw-r--r--odb/odb/traversal/elements.hxx238
-rw-r--r--odb/odb/traversal/enum.cxx54
-rw-r--r--odb/odb/traversal/enum.hxx57
-rw-r--r--odb/odb/traversal/fundamental.hxx39
-rw-r--r--odb/odb/traversal/namespace.hxx15
-rw-r--r--odb/odb/traversal/relational.hxx18
-rw-r--r--odb/odb/traversal/relational/changelog.cxx63
-rw-r--r--odb/odb/traversal/relational/changelog.hxx53
-rw-r--r--odb/odb/traversal/relational/changeset.hxx18
-rw-r--r--odb/odb/traversal/relational/column.hxx21
-rw-r--r--odb/odb/traversal/relational/elements.hxx162
-rw-r--r--odb/odb/traversal/relational/foreign-key.hxx21
-rw-r--r--odb/odb/traversal/relational/index.hxx20
-rw-r--r--odb/odb/traversal/relational/key.cxx17
-rw-r--r--odb/odb/traversal/relational/key.hxx50
-rw-r--r--odb/odb/traversal/relational/model.hxx18
-rw-r--r--odb/odb/traversal/relational/primary-key.hxx18
-rw-r--r--odb/odb/traversal/relational/table.hxx21
-rw-r--r--odb/odb/traversal/template.cxx53
-rw-r--r--odb/odb/traversal/template.hxx56
-rw-r--r--odb/odb/traversal/union-template.cxx26
-rw-r--r--odb/odb/traversal/union-template.hxx29
-rw-r--r--odb/odb/traversal/union.hxx15
-rw-r--r--odb/odb/traversal/unit.hxx15
31 files changed, 1596 insertions, 0 deletions
diff --git a/odb/odb/traversal/class-template.cxx b/odb/odb/traversal/class-template.cxx
new file mode 100644
index 0000000..b04b625
--- /dev/null
+++ b/odb/odb/traversal/class-template.cxx
@@ -0,0 +1,62 @@
+// file : odb/traversal/class-template.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/class-template.hxx>
+
+namespace traversal
+{
+ //
+ //
+ void class_template::
+ traverse (type& c)
+ {
+ inherits (c);
+ names (c);
+ }
+
+ void class_template::
+ inherits (type& c)
+ {
+ inherits (c, *this);
+ }
+
+ void class_template::
+ inherits (type& c, edge_dispatcher& d)
+ {
+ iterate_and_dispatch (c.inherits_begin (), c.inherits_end (), d);
+ }
+
+ //
+ //
+ void class_instantiation::
+ traverse (type& c)
+ {
+ instantiates (c);
+ inherits (c);
+ names (c);
+ }
+
+ void class_instantiation::
+ instantiates (type& c)
+ {
+ instantiates (c, *this);
+ }
+
+ void class_instantiation::
+ instantiates (type& c, edge_dispatcher& d)
+ {
+ d.dispatch (c.instantiates ());
+ }
+
+ void class_instantiation::
+ inherits (type& c)
+ {
+ inherits (c, *this);
+ }
+
+ void class_instantiation::
+ inherits (type& c, edge_dispatcher& d)
+ {
+ iterate_and_dispatch (c.inherits_begin (), c.inherits_end (), d);
+ }
+}
diff --git a/odb/odb/traversal/class-template.hxx b/odb/odb/traversal/class-template.hxx
new file mode 100644
index 0000000..18e1e5b
--- /dev/null
+++ b/odb/odb/traversal/class-template.hxx
@@ -0,0 +1,45 @@
+// file : odb/traversal/class-template.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_CLASS_TEMPLATE_HXX
+#define ODB_TRAVERSAL_CLASS_TEMPLATE_HXX
+
+#include <odb/semantics/class-template.hxx>
+
+#include <odb/traversal/elements.hxx>
+#include <odb/traversal/class.hxx>
+
+namespace traversal
+{
+ struct class_template: scope_template<semantics::class_template>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ inherits (type&);
+
+ virtual void
+ inherits (type&, edge_dispatcher&);
+ };
+
+ struct class_instantiation: scope_template<semantics::class_instantiation>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ instantiates (type&);
+
+ virtual void
+ instantiates (type&, edge_dispatcher&);
+
+ virtual void
+ inherits (type&);
+
+ virtual void
+ inherits (type&, edge_dispatcher&);
+ };
+}
+
+#endif // ODB_TRAVERSAL_CLASS_TEMPLATE_HXX
diff --git a/odb/odb/traversal/class.cxx b/odb/odb/traversal/class.cxx
new file mode 100644
index 0000000..80c8b80
--- /dev/null
+++ b/odb/odb/traversal/class.cxx
@@ -0,0 +1,34 @@
+// file : odb/traversal/class.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/class.hxx>
+
+namespace traversal
+{
+ void inherits::
+ traverse (type& i)
+ {
+ dispatch (i.base ());
+ }
+
+ //
+ //
+ void class_::
+ traverse (type& c)
+ {
+ inherits (c);
+ names (c);
+ }
+
+ void class_::
+ inherits (type& c)
+ {
+ inherits (c, *this);
+ }
+
+ void class_::
+ inherits (type& c, edge_dispatcher& d)
+ {
+ iterate_and_dispatch (c.inherits_begin (), c.inherits_end (), d);
+ }
+}
diff --git a/odb/odb/traversal/class.hxx b/odb/odb/traversal/class.hxx
new file mode 100644
index 0000000..de86cc0
--- /dev/null
+++ b/odb/odb/traversal/class.hxx
@@ -0,0 +1,40 @@
+// file : odb/traversal/class.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_CLASS_HXX
+#define ODB_TRAVERSAL_CLASS_HXX
+
+#include <odb/semantics/class.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ struct inherits: edge<semantics::inherits>
+ {
+ inherits ()
+ {
+ }
+
+ inherits (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct class_: scope_template<semantics::class_>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ inherits (type&);
+
+ virtual void
+ inherits (type&, edge_dispatcher&);
+ };
+}
+
+#endif // ODB_TRAVERSAL_CLASS_HXX
diff --git a/odb/odb/traversal/derived.cxx b/odb/odb/traversal/derived.cxx
new file mode 100644
index 0000000..a0acab8
--- /dev/null
+++ b/odb/odb/traversal/derived.cxx
@@ -0,0 +1,111 @@
+// file : odb/traversal/derived.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/derived.hxx>
+
+namespace traversal
+{
+ void qualifies::
+ traverse (type& e)
+ {
+ dispatch (e.type ());
+ }
+
+ void points::
+ traverse (type& e)
+ {
+ dispatch (e.type ());
+ }
+
+ void references::
+ traverse (type& e)
+ {
+ dispatch (e.type ());
+ }
+
+ void contains::
+ traverse (type& e)
+ {
+ dispatch (e.type ());
+ }
+
+ //
+ //
+ void qualifier::
+ traverse (type& q)
+ {
+ qualifies (q);
+ }
+
+ void qualifier::
+ qualifies (type& q)
+ {
+ qualifies (q, *this);
+ }
+
+ void qualifier::
+ qualifies (type& q, edge_dispatcher& d)
+ {
+ d.dispatch (q.qualifies ());
+ }
+
+ //
+ //
+ void pointer::
+ traverse (type& p)
+ {
+ points (p);
+ }
+
+ void pointer::
+ points (type& p)
+ {
+ points (p, *this);
+ }
+
+ void pointer::
+ points (type& p, edge_dispatcher& d)
+ {
+ d.dispatch (p.points ());
+ }
+
+ //
+ //
+ void reference::
+ traverse (type& r)
+ {
+ references (r);
+ }
+
+ void reference::
+ references (type& r)
+ {
+ references (r, *this);
+ }
+
+ void reference::
+ references (type& r, edge_dispatcher& d)
+ {
+ d.dispatch (r.references ());
+ }
+
+ //
+ //
+ void array::
+ traverse (type& a)
+ {
+ contains (a);
+ }
+
+ void array::
+ contains (type& a)
+ {
+ contains (a, *this);
+ }
+
+ void array::
+ contains (type& a, edge_dispatcher& d)
+ {
+ d.dispatch (a.contains ());
+ }
+}
diff --git a/odb/odb/traversal/derived.hxx b/odb/odb/traversal/derived.hxx
new file mode 100644
index 0000000..b7648aa
--- /dev/null
+++ b/odb/odb/traversal/derived.hxx
@@ -0,0 +1,130 @@
+// file : odb/traversal/derived.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_DERIVED_HXX
+#define ODB_TRAVERSAL_DERIVED_HXX
+
+#include <odb/semantics/derived.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ //
+ // Edges.
+ //
+ struct qualifies: edge<semantics::qualifies>
+ {
+ qualifies ()
+ {
+ }
+
+ qualifies (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct points: edge<semantics::points>
+ {
+ points ()
+ {
+ }
+
+ points (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct references: edge<semantics::references>
+ {
+ references ()
+ {
+ }
+
+ references (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct contains: edge<semantics::contains>
+ {
+ contains ()
+ {
+ }
+
+ contains (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+
+ //
+ // Nodes.
+ //
+ struct derived_type: node<semantics::derived_type> {};
+
+ struct qualifier: node<semantics::qualifier>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ qualifies (type&);
+
+ virtual void
+ qualifies (type&, edge_dispatcher&);
+ };
+
+ struct pointer: node<semantics::pointer>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ points (type&);
+
+ virtual void
+ points (type&, edge_dispatcher&);
+ };
+
+ struct reference: node<semantics::reference>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ references (type&);
+
+ virtual void
+ references (type&, edge_dispatcher&);
+ };
+
+ struct array: node<semantics::array>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ contains (type&);
+
+ virtual void
+ contains (type&, edge_dispatcher&);
+ };
+}
+
+#endif // ODB_TRAVERSAL_DERIVED_HXX
diff --git a/odb/odb/traversal/elements.cxx b/odb/odb/traversal/elements.cxx
new file mode 100644
index 0000000..f95917a
--- /dev/null
+++ b/odb/odb/traversal/elements.cxx
@@ -0,0 +1,77 @@
+// file : odb/traversal/elements.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ void names::
+ traverse (type& e)
+ {
+ dispatch (e.named ());
+ }
+
+ void declares::
+ traverse (type& e)
+ {
+ dispatch (e.named ());
+ }
+
+ void defines::
+ traverse (type& e)
+ {
+ dispatch (e.named ());
+ }
+
+ void typedefs::
+ traverse (type& e)
+ {
+ dispatch (e.named ());
+ }
+
+ void belongs::
+ traverse (type& e)
+ {
+ dispatch (e.type ());
+ }
+
+ // instance
+ //
+ void instance::
+ traverse (type& i)
+ {
+ belongs (i);
+ }
+
+ void instance::
+ belongs (type& i)
+ {
+ belongs (i, *this);
+ }
+
+ void instance::
+ belongs (type& i, edge_dispatcher& d)
+ {
+ d.dispatch (i.belongs ());
+ }
+
+ // data_member
+ //
+ void data_member::
+ traverse (type& m)
+ {
+ belongs (m);
+ }
+
+ void data_member::
+ belongs (type& m)
+ {
+ belongs (m, *this);
+ }
+
+ void data_member::
+ belongs (type& m, edge_dispatcher& d)
+ {
+ d.dispatch (m.belongs ());
+ }
+}
diff --git a/odb/odb/traversal/elements.hxx b/odb/odb/traversal/elements.hxx
new file mode 100644
index 0000000..d67a6d8
--- /dev/null
+++ b/odb/odb/traversal/elements.hxx
@@ -0,0 +1,238 @@
+// file : odb/traversal/elements.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_ELEMENTS_HXX
+#define ODB_TRAVERSAL_ELEMENTS_HXX
+
+#include <libcutl/compiler/traversal.hxx>
+#include <odb/semantics/elements.hxx>
+
+namespace traversal
+{
+ using namespace cutl;
+
+ //
+ //
+ typedef compiler::dispatcher<semantics::node> node_dispatcher;
+ typedef compiler::dispatcher<semantics::edge> edge_dispatcher;
+
+ //
+ //
+ struct node_base: node_dispatcher, edge_dispatcher
+ {
+ void
+ edge_traverser (edge_dispatcher& d)
+ {
+ edge_dispatcher::traverser (d);
+ }
+
+ edge_dispatcher&
+ edge_traverser ()
+ {
+ return *this;
+ }
+
+ using node_dispatcher::dispatch;
+ using edge_dispatcher::dispatch;
+
+ using edge_dispatcher::iterate_and_dispatch;
+ };
+
+ struct edge_base: edge_dispatcher, node_dispatcher
+ {
+ void
+ node_traverser (node_dispatcher& d)
+ {
+ node_dispatcher::traverser (d);
+ }
+
+ node_dispatcher&
+ node_traverser ()
+ {
+ return *this;
+ }
+
+ using edge_dispatcher::dispatch;
+ using node_dispatcher::dispatch;
+
+ using node_dispatcher::iterate_and_dispatch;
+ };
+
+ inline edge_base&
+ operator>> (node_base& n, edge_base& e)
+ {
+ n.edge_traverser (e);
+ return e;
+ }
+
+ inline node_base&
+ operator>> (edge_base& e, node_base& n)
+ {
+ e.node_traverser (n);
+ return n;
+ }
+
+ //
+ //
+ template <typename X>
+ struct node: compiler::traverser_impl<X, semantics::node>,
+ virtual node_base
+ {
+ };
+
+ template <typename X>
+ struct edge: compiler::traverser_impl<X, semantics::edge>,
+ virtual edge_base
+ {
+ };
+
+ //
+ // Edges
+ //
+
+ struct names: edge<semantics::names>
+ {
+ names ()
+ {
+ }
+
+ names (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct declares: edge<semantics::declares>
+ {
+ declares ()
+ {
+ }
+
+ declares (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct defines: edge<semantics::defines>
+ {
+ defines ()
+ {
+ }
+
+ defines (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct typedefs: edge<semantics::typedefs>
+ {
+ typedefs ()
+ {
+ }
+
+ typedefs (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct belongs: edge<semantics::belongs>
+ {
+ belongs ()
+ {
+ }
+
+ belongs (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ //
+ // Nodes
+ //
+
+ struct nameable: node<semantics::nameable> {};
+
+ //
+ //
+ template <typename T>
+ struct scope_template: node<T>
+ {
+ public:
+ virtual void
+ traverse (T& s)
+ {
+ names (s);
+ }
+
+ virtual void
+ names (T& s)
+ {
+ names (s, *this);
+ }
+
+ virtual void
+ names (T& s, edge_dispatcher& d)
+ {
+ this->iterate_and_dispatch (s.names_begin (), s.names_end (), d);
+ }
+ };
+
+ struct scope: scope_template<semantics::scope> {};
+
+ //
+ //
+ struct type: node<semantics::type> {};
+
+ //
+ //
+ struct instance: node<semantics::instance>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ belongs (type&);
+
+ virtual void
+ belongs (type&, edge_dispatcher&);
+ };
+
+ //
+ //
+ struct data_member: node<semantics::data_member>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ belongs (type&);
+
+ virtual void
+ belongs (type&, edge_dispatcher&);
+ };
+
+ //
+ //
+ struct unsupported_type: node<semantics::unsupported_type> {};
+}
+
+#endif // ODB_TRAVERSAL_ELEMENTS_HXX
diff --git a/odb/odb/traversal/enum.cxx b/odb/odb/traversal/enum.cxx
new file mode 100644
index 0000000..fa33f92
--- /dev/null
+++ b/odb/odb/traversal/enum.cxx
@@ -0,0 +1,54 @@
+// file : odb/traversal/enum.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/enum.hxx>
+
+namespace traversal
+{
+ void enumerates::
+ traverse (type& e)
+ {
+ dispatch (e.enumerator ());
+ }
+
+ //
+ //
+ void underlies::
+ traverse (type& u)
+ {
+ dispatch (u.type ());
+ }
+
+ //
+ //
+ void enum_::
+ traverse (type& e)
+ {
+ underlied (e);
+ enumerates (e);
+ }
+
+ void enum_::
+ underlied (type& e)
+ {
+ underlied (e, *this);
+ }
+
+ void enum_::
+ underlied (type& e, edge_dispatcher& d)
+ {
+ d.dispatch (e.underlied ());
+ }
+
+ void enum_::
+ enumerates (type& e)
+ {
+ enumerates (e, *this);
+ }
+
+ void enum_::
+ enumerates (type& e, edge_dispatcher& d)
+ {
+ iterate_and_dispatch (e.enumerates_begin (), e.enumerates_end (), d);
+ }
+}
diff --git a/odb/odb/traversal/enum.hxx b/odb/odb/traversal/enum.hxx
new file mode 100644
index 0000000..cd141f2
--- /dev/null
+++ b/odb/odb/traversal/enum.hxx
@@ -0,0 +1,57 @@
+// file : odb/traversal/enum.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_ENUM_HXX
+#define ODB_TRAVERSAL_ENUM_HXX
+
+#include <odb/semantics/enum.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ struct enumerates: edge<semantics::enumerates>
+ {
+ enumerates () {}
+ enumerates (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct enumerator: node<semantics::enumerator> {};
+
+ struct underlies: edge<semantics::underlies>
+ {
+ underlies () {}
+ underlies (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct enum_: node<semantics::enum_>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ underlied (type&);
+
+ virtual void
+ underlied (type&, edge_dispatcher&);
+
+ virtual void
+ enumerates (type&);
+
+ virtual void
+ enumerates (type&, edge_dispatcher&);
+ };
+}
+
+#endif // ODB_TRAVERSAL_ENUM_HXX
diff --git a/odb/odb/traversal/fundamental.hxx b/odb/odb/traversal/fundamental.hxx
new file mode 100644
index 0000000..974e74f
--- /dev/null
+++ b/odb/odb/traversal/fundamental.hxx
@@ -0,0 +1,39 @@
+// file : odb/traversal/fundamental.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_FUNDAMENTAL_HXX
+#define ODB_TRAVERSAL_FUNDAMENTAL_HXX
+
+#include <odb/semantics/fundamental.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ struct fund_type: node<semantics::fund_type> {};
+
+ struct fund_void: node<semantics::fund_void> {};
+ struct fund_bool: node<semantics::fund_bool> {};
+
+ // Integral.
+ //
+ struct fund_char: node<semantics::fund_char> {};
+ struct fund_wchar: node<semantics::fund_wchar> {};
+ struct fund_signed_char: node<semantics::fund_signed_char> {};
+ struct fund_unsigned_char: node<semantics::fund_unsigned_char> {};
+ struct fund_short: node<semantics::fund_short> {};
+ struct fund_unsigned_short: node<semantics::fund_unsigned_short> {};
+ struct fund_int: node<semantics::fund_int> {};
+ struct fund_unsigned_int: node<semantics::fund_unsigned_int> {};
+ struct fund_long: node<semantics::fund_long> {};
+ struct fund_unsigned_long: node<semantics::fund_unsigned_long> {};
+ struct fund_long_long: node<semantics::fund_long_long> {};
+ struct fund_unsigned_long_long: node<semantics::fund_unsigned_long_long> {};
+
+ // Real.
+ //
+ struct fund_float: node<semantics::fund_float> {};
+ struct fund_double: node<semantics::fund_double> {};
+ struct fund_long_double: node<semantics::fund_long_double> {};
+}
+
+#endif // ODB_TRAVERSAL_FUNDAMENTAL_HXX
diff --git a/odb/odb/traversal/namespace.hxx b/odb/odb/traversal/namespace.hxx
new file mode 100644
index 0000000..223322b
--- /dev/null
+++ b/odb/odb/traversal/namespace.hxx
@@ -0,0 +1,15 @@
+// file : odb/traversal/namespace.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_NAMESPACE_HXX
+#define ODB_TRAVERSAL_NAMESPACE_HXX
+
+#include <odb/semantics/namespace.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ struct namespace_: scope_template<semantics::namespace_> {};
+}
+
+#endif // ODB_TRAVERSAL_NAMESPACE_HXX
diff --git a/odb/odb/traversal/relational.hxx b/odb/odb/traversal/relational.hxx
new file mode 100644
index 0000000..a78e26b
--- /dev/null
+++ b/odb/odb/traversal/relational.hxx
@@ -0,0 +1,18 @@
+// file : odb/traversal/relational.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_HXX
+#define ODB_TRAVERSAL_RELATIONAL_HXX
+
+#include <odb/traversal/relational/changelog.hxx>
+#include <odb/traversal/relational/changeset.hxx>
+#include <odb/traversal/relational/column.hxx>
+#include <odb/traversal/relational/elements.hxx>
+#include <odb/traversal/relational/foreign-key.hxx>
+#include <odb/traversal/relational/index.hxx>
+#include <odb/traversal/relational/key.hxx>
+#include <odb/traversal/relational/model.hxx>
+#include <odb/traversal/relational/primary-key.hxx>
+#include <odb/traversal/relational/table.hxx>
+
+#endif // ODB_TRAVERSAL_RELATIONAL_HXX
diff --git a/odb/odb/traversal/relational/changelog.cxx b/odb/odb/traversal/relational/changelog.cxx
new file mode 100644
index 0000000..149d93d
--- /dev/null
+++ b/odb/odb/traversal/relational/changelog.cxx
@@ -0,0 +1,63 @@
+// file : odb/traversal/relational/changelog.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/relational/changelog.hxx>
+#include <odb/traversal/relational/model.hxx>
+#include <odb/traversal/relational/changeset.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ // contains_model
+ //
+ void contains_model::
+ traverse (type& c)
+ {
+ dispatch (c.model ());
+ }
+
+ // contains_changeset
+ //
+ void contains_changeset::
+ traverse (type& c)
+ {
+ dispatch (c.changeset ());
+ }
+
+ // changelog
+ //
+ void changelog::
+ traverse (type& cl)
+ {
+ contains_model (cl);
+ contains_changeset (cl);
+ }
+
+ void changelog::
+ contains_model (type& cl)
+ {
+ contains_model (cl, *this);
+ }
+
+ void changelog::
+ contains_model (type& cl, edge_dispatcher& d)
+ {
+ d.dispatch (cl.contains_model ());
+ }
+
+ void changelog::
+ contains_changeset (type& cl)
+ {
+ contains_changeset (cl, *this);
+ }
+
+ void changelog::
+ contains_changeset (type& cl, edge_dispatcher& d)
+ {
+ iterate_and_dispatch (cl.contains_changeset_begin (),
+ cl.contains_changeset_end (),
+ d);
+ }
+ }
+}
diff --git a/odb/odb/traversal/relational/changelog.hxx b/odb/odb/traversal/relational/changelog.hxx
new file mode 100644
index 0000000..4b7f18f
--- /dev/null
+++ b/odb/odb/traversal/relational/changelog.hxx
@@ -0,0 +1,53 @@
+// file : odb/traversal/relational/changelog.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_CHANGELOG_HXX
+#define ODB_TRAVERSAL_RELATIONAL_CHANGELOG_HXX
+
+#include <odb/semantics/relational/changelog.hxx>
+#include <odb/traversal/relational/elements.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct contains_model: edge<semantics::relational::contains_model>
+ {
+ contains_model () {}
+ contains_model (node_dispatcher& n) {node_traverser (n);}
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct contains_changeset: edge<semantics::relational::contains_changeset>
+ {
+ contains_changeset () {}
+ contains_changeset (node_dispatcher& n) {node_traverser (n);}
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct changelog: node<semantics::relational::changelog>
+ {
+ public:
+ virtual void
+ traverse (type&);
+
+ virtual void
+ contains_model (type&);
+
+ virtual void
+ contains_model (type&, edge_dispatcher&);
+
+ virtual void
+ contains_changeset (type&);
+
+ virtual void
+ contains_changeset (type&, edge_dispatcher&);
+ };
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_CHANGELOG_HXX
diff --git a/odb/odb/traversal/relational/changeset.hxx b/odb/odb/traversal/relational/changeset.hxx
new file mode 100644
index 0000000..3cc522a
--- /dev/null
+++ b/odb/odb/traversal/relational/changeset.hxx
@@ -0,0 +1,18 @@
+// file : odb/traversal/relational/changeset.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_CHANGESET_HXX
+#define ODB_TRAVERSAL_RELATIONAL_CHANGESET_HXX
+
+#include <odb/semantics/relational/changeset.hxx>
+#include <odb/traversal/relational/elements.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct changeset: scope_template<semantics::relational::changeset> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_CHANGESET_HXX
diff --git a/odb/odb/traversal/relational/column.hxx b/odb/odb/traversal/relational/column.hxx
new file mode 100644
index 0000000..b9c586d
--- /dev/null
+++ b/odb/odb/traversal/relational/column.hxx
@@ -0,0 +1,21 @@
+// file : odb/traversal/relational/column.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_COLUMN_HXX
+#define ODB_TRAVERSAL_RELATIONAL_COLUMN_HXX
+
+#include <odb/semantics/relational/column.hxx>
+#include <odb/traversal/relational/elements.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct column: node<semantics::relational::column> {};
+ struct add_column: node<semantics::relational::add_column> {};
+ struct drop_column: node<semantics::relational::drop_column> {};
+ struct alter_column: node<semantics::relational::alter_column> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_COLUMN_HXX
diff --git a/odb/odb/traversal/relational/elements.hxx b/odb/odb/traversal/relational/elements.hxx
new file mode 100644
index 0000000..2b43ab0
--- /dev/null
+++ b/odb/odb/traversal/relational/elements.hxx
@@ -0,0 +1,162 @@
+// file : odb/traversal/relational/elements.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX
+#define ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX
+
+#include <libcutl/compiler/traversal.hxx>
+#include <odb/semantics/relational/elements.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ using namespace cutl;
+
+ //
+ //
+ typedef compiler::dispatcher<semantics::relational::node> node_dispatcher;
+ typedef compiler::dispatcher<semantics::relational::edge> edge_dispatcher;
+
+ //
+ //
+ struct node_base: node_dispatcher, edge_dispatcher
+ {
+ void
+ edge_traverser (edge_dispatcher& d)
+ {
+ edge_dispatcher::traverser (d);
+ }
+
+ edge_dispatcher&
+ edge_traverser ()
+ {
+ return *this;
+ }
+
+ using node_dispatcher::dispatch;
+ using edge_dispatcher::dispatch;
+
+ using edge_dispatcher::iterate_and_dispatch;
+ };
+
+ struct edge_base: edge_dispatcher, node_dispatcher
+ {
+ void
+ node_traverser (node_dispatcher& d)
+ {
+ node_dispatcher::traverser (d);
+ }
+
+ node_dispatcher&
+ node_traverser ()
+ {
+ return *this;
+ }
+
+ using edge_dispatcher::dispatch;
+ using node_dispatcher::dispatch;
+
+ using node_dispatcher::iterate_and_dispatch;
+ };
+
+ inline edge_base&
+ operator>> (node_base& n, edge_base& e)
+ {
+ n.edge_traverser (e);
+ return e;
+ }
+
+ inline node_base&
+ operator>> (edge_base& e, node_base& n)
+ {
+ e.node_traverser (n);
+ return n;
+ }
+
+ //
+ //
+ template <typename X>
+ struct node: compiler::traverser_impl<X, semantics::relational::node>,
+ virtual node_base
+ {
+ virtual void
+ traverse (X&) {}
+ };
+
+ template <typename X>
+ struct edge: compiler::traverser_impl<X, semantics::relational::edge>,
+ virtual edge_base
+ {
+ };
+
+ //
+ // Edges
+ //
+
+ template <typename N>
+ struct names: edge<semantics::relational::names<N> >
+ {
+ names ()
+ {
+ }
+
+ names (node_dispatcher& n)
+ {
+ this->node_traverser (n);
+ }
+
+ virtual void
+ traverse (semantics::relational::names<N>& e)
+ {
+ this->dispatch (e.nameable ());
+ }
+ };
+
+ typedef names<semantics::relational::uname> unames;
+ typedef names<semantics::relational::qname> qnames;
+
+ //
+ // Nodes
+ //
+
+ template <typename N>
+ struct nameable: node<semantics::relational::nameable<N> > {};
+
+ typedef nameable<semantics::relational::uname> unameable;
+ typedef nameable<semantics::relational::qname> qnameable;
+
+ //
+ //
+ template <typename T>
+ struct scope_template: node<T>
+ {
+ public:
+ virtual void
+ traverse (T& s)
+ {
+ names (s);
+ }
+
+ virtual void
+ names (T& s)
+ {
+ names (s, *this);
+ }
+
+ virtual void
+ names (T& s, edge_dispatcher& d)
+ {
+ this->iterate_and_dispatch (s.names_begin (), s.names_end (), d);
+ }
+ };
+
+ template <typename N>
+ struct scope: scope_template<semantics::relational::scope<N> > {};
+
+ typedef scope<semantics::relational::uname> uscope;
+ typedef scope<semantics::relational::qname> qscope;
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX
diff --git a/odb/odb/traversal/relational/foreign-key.hxx b/odb/odb/traversal/relational/foreign-key.hxx
new file mode 100644
index 0000000..b8ccba3
--- /dev/null
+++ b/odb/odb/traversal/relational/foreign-key.hxx
@@ -0,0 +1,21 @@
+// file : odb/traversal/relational/foreign-key.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_FOREIGN_KEY_HXX
+#define ODB_TRAVERSAL_RELATIONAL_FOREIGN_KEY_HXX
+
+#include <odb/semantics/relational/foreign-key.hxx>
+#include <odb/traversal/relational/key.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct foreign_key: key_template<semantics::relational::foreign_key> {};
+ struct add_foreign_key:
+ key_template<semantics::relational::add_foreign_key> {};
+ struct drop_foreign_key: node<semantics::relational::drop_foreign_key> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_FOREIGN_KEY_HXX
diff --git a/odb/odb/traversal/relational/index.hxx b/odb/odb/traversal/relational/index.hxx
new file mode 100644
index 0000000..2277fee
--- /dev/null
+++ b/odb/odb/traversal/relational/index.hxx
@@ -0,0 +1,20 @@
+// file : odb/traversal/relational/index.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_INDEX_HXX
+#define ODB_TRAVERSAL_RELATIONAL_INDEX_HXX
+
+#include <odb/semantics/relational/index.hxx>
+#include <odb/traversal/relational/key.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct index: key_template<semantics::relational::index> {};
+ struct add_index: key_template<semantics::relational::add_index> {};
+ struct drop_index: node<semantics::relational::drop_index> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_INDEX_HXX
diff --git a/odb/odb/traversal/relational/key.cxx b/odb/odb/traversal/relational/key.cxx
new file mode 100644
index 0000000..15a131c
--- /dev/null
+++ b/odb/odb/traversal/relational/key.cxx
@@ -0,0 +1,17 @@
+// file : odb/traversal/relational/key.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/relational/key.hxx>
+#include <odb/traversal/relational/column.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ void contains::
+ traverse (type& c)
+ {
+ dispatch (c.column ());
+ }
+ }
+}
diff --git a/odb/odb/traversal/relational/key.hxx b/odb/odb/traversal/relational/key.hxx
new file mode 100644
index 0000000..d0ba2d7
--- /dev/null
+++ b/odb/odb/traversal/relational/key.hxx
@@ -0,0 +1,50 @@
+// file : odb/traversal/relational/key.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_KEY_HXX
+#define ODB_TRAVERSAL_RELATIONAL_KEY_HXX
+
+#include <odb/semantics/relational/key.hxx>
+#include <odb/traversal/relational/elements.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct contains: edge<semantics::relational::contains>
+ {
+ contains () {}
+ contains (node_dispatcher& n) {node_traverser (n);}
+
+ virtual void
+ traverse (type&);
+ };
+
+ template <typename T>
+ struct key_template: node<T>
+ {
+ public:
+ virtual void
+ traverse (T& k)
+ {
+ contains (k);
+ }
+
+ virtual void
+ contains (T& k)
+ {
+ contains (k, *this);
+ }
+
+ virtual void
+ contains (T& k, edge_dispatcher& d)
+ {
+ this->iterate_and_dispatch (k.contains_begin (), k.contains_end (), d);
+ }
+ };
+
+ struct key: key_template<semantics::relational::key> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_KEY_HXX
diff --git a/odb/odb/traversal/relational/model.hxx b/odb/odb/traversal/relational/model.hxx
new file mode 100644
index 0000000..03d70b1
--- /dev/null
+++ b/odb/odb/traversal/relational/model.hxx
@@ -0,0 +1,18 @@
+// file : odb/traversal/relational/model.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_MODEL_HXX
+#define ODB_TRAVERSAL_RELATIONAL_MODEL_HXX
+
+#include <odb/semantics/relational/model.hxx>
+#include <odb/traversal/relational/elements.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct model: scope_template<semantics::relational::model> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_MODEL_HXX
diff --git a/odb/odb/traversal/relational/primary-key.hxx b/odb/odb/traversal/relational/primary-key.hxx
new file mode 100644
index 0000000..dcefab6
--- /dev/null
+++ b/odb/odb/traversal/relational/primary-key.hxx
@@ -0,0 +1,18 @@
+// file : odb/traversal/relational/primary-key.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_PRIMARY_KEY_HXX
+#define ODB_TRAVERSAL_RELATIONAL_PRIMARY_KEY_HXX
+
+#include <odb/semantics/relational/primary-key.hxx>
+#include <odb/traversal/relational/key.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct primary_key: key_template<semantics::relational::primary_key> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_PRIMARY_KEY_HXX
diff --git a/odb/odb/traversal/relational/table.hxx b/odb/odb/traversal/relational/table.hxx
new file mode 100644
index 0000000..d80e37e
--- /dev/null
+++ b/odb/odb/traversal/relational/table.hxx
@@ -0,0 +1,21 @@
+// file : odb/traversal/relational/table.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_RELATIONAL_TABLE_HXX
+#define ODB_TRAVERSAL_RELATIONAL_TABLE_HXX
+
+#include <odb/semantics/relational/table.hxx>
+#include <odb/traversal/relational/elements.hxx>
+
+namespace traversal
+{
+ namespace relational
+ {
+ struct table: scope_template<semantics::relational::table> {};
+ struct add_table: scope_template<semantics::relational::add_table> {};
+ struct drop_table: node<semantics::relational::drop_table> {};
+ struct alter_table: scope_template<semantics::relational::alter_table> {};
+ }
+}
+
+#endif // ODB_TRAVERSAL_RELATIONAL_TABLE_HXX
diff --git a/odb/odb/traversal/template.cxx b/odb/odb/traversal/template.cxx
new file mode 100644
index 0000000..21a846d
--- /dev/null
+++ b/odb/odb/traversal/template.cxx
@@ -0,0 +1,53 @@
+// file : odb/traversal/template.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/template.hxx>
+
+namespace traversal
+{
+ void instantiates::
+ traverse (type& i)
+ {
+ dispatch (i.template_ ());
+ }
+
+ //
+ //
+ void instantiation::
+ traverse (type& i)
+ {
+ instantiates (i);
+ }
+
+ void instantiation::
+ instantiates (type& i)
+ {
+ instantiates (i, *this);
+ }
+
+ void instantiation::
+ instantiates (type& i, edge_dispatcher& d)
+ {
+ d.dispatch (i.instantiates ());
+ }
+
+ //
+ //
+ void type_instantiation::
+ traverse (type& i)
+ {
+ instantiates (i);
+ }
+
+ void type_instantiation::
+ instantiates (type& i)
+ {
+ instantiates (i, *this);
+ }
+
+ void type_instantiation::
+ instantiates (type& i, edge_dispatcher& d)
+ {
+ d.dispatch (i.instantiates ());
+ }
+}
diff --git a/odb/odb/traversal/template.hxx b/odb/odb/traversal/template.hxx
new file mode 100644
index 0000000..28a64d5
--- /dev/null
+++ b/odb/odb/traversal/template.hxx
@@ -0,0 +1,56 @@
+// file : odb/traversal/template.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_TEMPLATE_HXX
+#define ODB_TRAVERSAL_TEMPLATE_HXX
+
+#include <odb/semantics/template.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ struct instantiates: edge<semantics::instantiates>
+ {
+ instantiates ()
+ {
+ }
+
+ instantiates (node_dispatcher& n)
+ {
+ node_traverser (n);
+ }
+
+ virtual void
+ traverse (type&);
+ };
+
+ struct template_: node<semantics::template_> {};
+
+ struct instantiation: node<semantics::instantiation>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ instantiates (type&);
+
+ virtual void
+ instantiates (type&, edge_dispatcher&);
+ };
+
+ struct type_template: node<semantics::type_template> {};
+
+ struct type_instantiation: node<semantics::type_instantiation>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ instantiates (type&);
+
+ virtual void
+ instantiates (type&, edge_dispatcher&);
+ };
+}
+
+#endif // ODB_TRAVERSAL_TEMPLATE_HXX
diff --git a/odb/odb/traversal/union-template.cxx b/odb/odb/traversal/union-template.cxx
new file mode 100644
index 0000000..9d72fcd
--- /dev/null
+++ b/odb/odb/traversal/union-template.cxx
@@ -0,0 +1,26 @@
+// file : odb/traversal/union-template.cxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#include <odb/traversal/union-template.hxx>
+
+namespace traversal
+{
+ void union_instantiation::
+ traverse (type& u)
+ {
+ instantiates (u);
+ names (u);
+ }
+
+ void union_instantiation::
+ instantiates (type& u)
+ {
+ instantiates (u, *this);
+ }
+
+ void union_instantiation::
+ instantiates (type& u, edge_dispatcher& d)
+ {
+ d.dispatch (u.instantiates ());
+ }
+}
diff --git a/odb/odb/traversal/union-template.hxx b/odb/odb/traversal/union-template.hxx
new file mode 100644
index 0000000..10d1d49
--- /dev/null
+++ b/odb/odb/traversal/union-template.hxx
@@ -0,0 +1,29 @@
+// file : odb/traversal/union-template.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_UNION_TEMPLATE_HXX
+#define ODB_TRAVERSAL_UNION_TEMPLATE_HXX
+
+#include <odb/semantics/union-template.hxx>
+
+#include <odb/traversal/elements.hxx>
+#include <odb/traversal/union.hxx>
+
+namespace traversal
+{
+ struct union_template: scope_template<semantics::union_template> {};
+
+ struct union_instantiation: scope_template<semantics::union_instantiation>
+ {
+ virtual void
+ traverse (type&);
+
+ virtual void
+ instantiates (type&);
+
+ virtual void
+ instantiates (type&, edge_dispatcher&);
+ };
+}
+
+#endif // ODB_TRAVERSAL_UNION_TEMPLATE_HXX
diff --git a/odb/odb/traversal/union.hxx b/odb/odb/traversal/union.hxx
new file mode 100644
index 0000000..2d1a7af
--- /dev/null
+++ b/odb/odb/traversal/union.hxx
@@ -0,0 +1,15 @@
+// file : odb/traversal/union.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_UNION_HXX
+#define ODB_TRAVERSAL_UNION_HXX
+
+#include <odb/semantics/union.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ struct union_: scope_template<semantics::union_> {};
+}
+
+#endif // ODB_TRAVERSAL_UNION_HXX
diff --git a/odb/odb/traversal/unit.hxx b/odb/odb/traversal/unit.hxx
new file mode 100644
index 0000000..a90418a
--- /dev/null
+++ b/odb/odb/traversal/unit.hxx
@@ -0,0 +1,15 @@
+// file : odb/traversal/unit.hxx
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_TRAVERSAL_UNIT_HXX
+#define ODB_TRAVERSAL_UNIT_HXX
+
+#include <odb/semantics/unit.hxx>
+#include <odb/traversal/elements.hxx>
+
+namespace traversal
+{
+ struct unit: scope_template<semantics::unit> {};
+}
+
+#endif // ODB_TRAVERSAL_UNIT_HXX