diff options
Diffstat (limited to 'odb/traversal/relational')
-rw-r--r-- | odb/traversal/relational/column.hxx | 20 | ||||
-rw-r--r-- | odb/traversal/relational/elements.cxx | 18 | ||||
-rw-r--r-- | odb/traversal/relational/elements.hxx | 147 | ||||
-rw-r--r-- | odb/traversal/relational/foreign-key.hxx | 20 | ||||
-rw-r--r-- | odb/traversal/relational/index.hxx | 20 | ||||
-rw-r--r-- | odb/traversal/relational/key.hxx | 43 | ||||
-rw-r--r-- | odb/traversal/relational/model.hxx | 20 | ||||
-rw-r--r-- | odb/traversal/relational/primary-key.hxx | 20 | ||||
-rw-r--r-- | odb/traversal/relational/table.hxx | 22 |
9 files changed, 330 insertions, 0 deletions
diff --git a/odb/traversal/relational/column.hxx b/odb/traversal/relational/column.hxx new file mode 100644 index 0000000..20c8716 --- /dev/null +++ b/odb/traversal/relational/column.hxx @@ -0,0 +1,20 @@ +// file : odb/traversal/relational/column.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// 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> {}; + } +} + +#endif // ODB_TRAVERSAL_RELATIONAL_COLUMN_HXX diff --git a/odb/traversal/relational/elements.cxx b/odb/traversal/relational/elements.cxx new file mode 100644 index 0000000..de9c259 --- /dev/null +++ b/odb/traversal/relational/elements.cxx @@ -0,0 +1,18 @@ +// file : odb/traversal/relational/elements.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v3; see accompanying LICENSE file + +#include <odb/traversal/relational/elements.hxx> + +namespace traversal +{ + namespace relational + { + void names:: + traverse (type& e) + { + dispatch (e.nameable ()); + } + } +} diff --git a/odb/traversal/relational/elements.hxx b/odb/traversal/relational/elements.hxx new file mode 100644 index 0000000..72b8c39 --- /dev/null +++ b/odb/traversal/relational/elements.hxx @@ -0,0 +1,147 @@ +// file : odb/traversal/relational/elements.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v3; see accompanying LICENSE file + +#ifndef ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX +#define ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX + +#include <cutl/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 + { + }; + + template <typename X> + struct edge: compiler::traverser_impl<X, semantics::relational::edge>, + virtual edge_base + { + }; + + // + // Edges + // + + struct names: edge<semantics::relational::names> + { + names () + { + } + + names (node_dispatcher& n) + { + node_traverser (n); + } + + virtual void + traverse (type&); + }; + + // + // Nodes + // + + struct nameable: node<semantics::relational::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) + { + iterate_and_dispatch (s.names_begin (), s.names_end (), d); + } + }; + + struct scope: scope_template<semantics::relational::scope> {}; + } +} + +#endif // ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX diff --git a/odb/traversal/relational/foreign-key.hxx b/odb/traversal/relational/foreign-key.hxx new file mode 100644 index 0000000..dc9b87e --- /dev/null +++ b/odb/traversal/relational/foreign-key.hxx @@ -0,0 +1,20 @@ +// file : odb/traversal/relational/foreign-key.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// 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> {}; + } +} + +#endif // ODB_TRAVERSAL_RELATIONAL_FOREIGN_KEY_HXX diff --git a/odb/traversal/relational/index.hxx b/odb/traversal/relational/index.hxx new file mode 100644 index 0000000..20a8bc5 --- /dev/null +++ b/odb/traversal/relational/index.hxx @@ -0,0 +1,20 @@ +// file : odb/traversal/relational/index.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// 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> {}; + } +} + +#endif // ODB_TRAVERSAL_RELATIONAL_INDEX_HXX diff --git a/odb/traversal/relational/key.hxx b/odb/traversal/relational/key.hxx new file mode 100644 index 0000000..ae2487d --- /dev/null +++ b/odb/traversal/relational/key.hxx @@ -0,0 +1,43 @@ +// file : odb/traversal/relational/key.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// 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 + { + 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) + { + 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/traversal/relational/model.hxx b/odb/traversal/relational/model.hxx new file mode 100644 index 0000000..6c120f6 --- /dev/null +++ b/odb/traversal/relational/model.hxx @@ -0,0 +1,20 @@ +// file : odb/traversal/relational/model.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// 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/traversal/relational/primary-key.hxx b/odb/traversal/relational/primary-key.hxx new file mode 100644 index 0000000..6374e4c --- /dev/null +++ b/odb/traversal/relational/primary-key.hxx @@ -0,0 +1,20 @@ +// file : odb/traversal/relational/primary-key.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// 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/traversal/relational/table.hxx b/odb/traversal/relational/table.hxx new file mode 100644 index 0000000..28783b1 --- /dev/null +++ b/odb/traversal/relational/table.hxx @@ -0,0 +1,22 @@ +// file : odb/traversal/relational/table.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// 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 object_table: scope_template<semantics::relational::table> {}; + struct container_table: scope_template<semantics::relational::table> {}; + } +} + +#endif // ODB_TRAVERSAL_RELATIONAL_TABLE_HXX |