From 55df757e98329e8e09afffe274ce2ceab269f8b3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 19 Sep 2011 16:19:25 +0200 Subject: Make processing top-level action, like validation and generation --- odb/generator.cxx | 54 ++---------------------------------------------------- 1 file changed, 2 insertions(+), 52 deletions(-) (limited to 'odb/generator.cxx') diff --git a/odb/generator.cxx b/odb/generator.cxx index 0064b5c..50abbe9 100644 --- a/odb/generator.cxx +++ b/odb/generator.cxx @@ -21,11 +21,6 @@ #include #include #include -#include - -#include -#include -#include using namespace std; using namespace cutl; @@ -93,56 +88,11 @@ namespace } } -generator:: -generator () -{ -} - -static auto_ptr -create_context (ostream& os, semantics::unit& unit, options const& ops) -{ - auto_ptr r; - - switch (ops.database ()) - { - case database::mysql: - { - r.reset (new relational::mysql::context (os, unit, ops)); - break; - } - case database::pgsql: - { - r.reset (new relational::pgsql::context (os, unit, ops)); - break; - } - case database::sqlite: - { - r.reset (new relational::sqlite::context (os, unit, ops)); - break; - } - case database::tracer: - { - r.reset (new context (os, unit, ops)); - break; - } - } - - return r; -} - void generator:: generate (options const& ops, semantics::unit& unit, path const& p) { try { - // Process types. - // - if (ops.database () != database::tracer) - { - auto_ptr ctx (create_context (cerr, unit, ops)); - relational::process_types (); - } - // Output files. // path file (p.leaf ()); @@ -439,13 +389,13 @@ generate (options const& ops, semantics::unit& unit, path const& p) auto_rm.cancel (); } - catch (const generation_failed&) + catch (generation_failed const&) { // Code generation failed. Diagnostics has already been issued. // throw failed (); } - catch (const re::format& e) + catch (re::format const& e) { cerr << "error: invalid regex: '" << e.regex () << "': " << e.description () << endl; -- cgit v1.1