From d5a8a14abbbdb41c753502ea25e2c327ada106f3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Nov 2012 11:32:43 +0200 Subject: Namespace management for static multi-database support Now in libodb the odb::core namespace is split into odb::common (database- independent stuff) and odb::core proper, which imports odb::common. Each database runtime now defines odb::::core namespace which also imports odb::common and adds the database-specific bits. The overall idea is that one can do using namespace odb::::core just like for odb::core. --- odb/forward.hxx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'odb/forward.hxx') diff --git a/odb/forward.hxx b/odb/forward.hxx index 705acd3..fe23c5f 100644 --- a/odb/forward.hxx +++ b/odb/forward.hxx @@ -14,6 +14,19 @@ namespace odb { + // Common and core namespaces. The idea is that you can use the + // using directive to get database-independent (common) names or + // all core names (core). + // + namespace common {} + + namespace core + { + using namespace common; + } + + // + // class database; class connection; typedef details::shared_ptr connection_ptr; @@ -21,6 +34,11 @@ namespace odb class statement; class session; + namespace common + { + using odb::session; + } + namespace core { using odb::database; @@ -28,7 +46,6 @@ namespace odb using odb::connection_ptr; using odb::transaction; using odb::statement; - using odb::session; } // Tracing. @@ -36,7 +53,7 @@ namespace odb class tracer; // Not in core. extern LIBODB_EXPORT tracer& stderr_tracer; - namespace core + namespace common { using odb::stderr_tracer; } -- cgit v1.1