From cd44a367fd73293b1c8edc36aa61667ca020a2eb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 5 Mar 2012 11:59:00 +0200 Subject: Add support for generating schema creation code into separate C++ file --- odb/relational/schema-source.cxx | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 odb/relational/schema-source.cxx (limited to 'odb/relational/schema-source.cxx') diff --git a/odb/relational/schema-source.cxx b/odb/relational/schema-source.cxx new file mode 100644 index 0000000..0acb6c4 --- /dev/null +++ b/odb/relational/schema-source.cxx @@ -0,0 +1,44 @@ +// file : odb/relational/schema-source.cxx +// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +// license : GNU GPL v3; see accompanying LICENSE file + +#include +#include + +using namespace std; + +namespace relational +{ + namespace schema_source + { + void + generate () + { + context ctx; + ostream& os (ctx.os); + + traversal::unit unit; + traversal::defines unit_defines; + traversal::namespace_ ns; + instance c; + + unit >> unit_defines >> ns; + unit_defines >> c; + + traversal::defines ns_defines; + + ns >> ns_defines >> ns; + ns_defines >> c; + + instance i; + i->generate (); + + os << "namespace odb" + << "{"; + + unit.dispatch (ctx.unit); + + os << "}"; + } + } +} -- cgit v1.1