summaryrefslogtreecommitdiff
path: root/odb/odb/traversal/relational
diff options
context:
space:
mode:
Diffstat (limited to 'odb/odb/traversal/relational')
-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
12 files changed, 482 insertions, 0 deletions
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