From 3daba7d9d24c5fb85e2ee8c21b23b31efb8b278c Mon Sep 17 00:00:00 2001 From: Michael Shepanski Date: Thu, 30 Oct 2014 15:10:56 +1100 Subject: Allow lambdas & std::functions as query factories with C++-98 builds of libodb --- doc/manual.xhtml | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 13203f0..dd03def 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -12605,46 +12605,74 @@ namespace odb schema_version = 0, const std::string& name = ""); - // C++98/03 version: + typedef void data_migration_function_type (database&); + + // Common (for all the databases) data migration, C++98/03 version: // - typedef void (*data_migration_function_type) (database&); + template <schema_version v, schema_version base> + static void + data_migration_function (data_migration_function_type*, + const std::string& name = ""); - // C++11 version: + // Common (for all the databases) data migration, C++11 version: // - typedef std::function<void (database&)> data_migration_function_type; + template <schema_version v, schema_version base> + static void + data_migration_function (std::function<data_migration_function_type>, + const std::string& name = ""); - // Common (for all the databases) data migration. + // Database-specific data migration, C++98/03 version: // template <schema_version v, schema_version base> static void - data_migration_function (data_migration_function_type, + data_migration_function (database&, + data_migration_function_type*, const std::string& name = ""); - // Database-specific data migration. + template <schema_version v, schema_version base> + static void + data_migration_function (database_id, + data_migration_function_type*, + const std::string& name = ""); + + // Database-specific data migration, C++11 version: // template <schema_version v, schema_version base> static void data_migration_function (database&, - data_migration_function_type, + std::function<data_migration_function_type>, const std::string& name = ""); template <schema_version v, schema_version base> static void data_migration_function (database_id, - data_migration_function_type, + std::function<data_migration_function_type>, const std::string& name = ""); }; - // Static data migration function registration. + // Static data migration function registration, C++98/03 version: + // + template <schema_version v, schema_version base> + struct data_migration_entry + { + data_migration_entry (data_migration_function_type*, + const std::string& name = ""); + + data_migration_entry (database_id, + data_migration_function_type*, + const std::string& name = ""); + }; + + // Static data migration function registration, C++11 version: // template <schema_version v, schema_version base> struct data_migration_entry { - data_migration_entry (data_migration_function_type, + data_migration_entry (std::function<data_migration_function_type>, const std::string& name = ""); data_migration_entry (database_id, - data_migration_function_type, + std::function<data_migration_function_type>, const std::string& name = ""); }; } -- cgit v1.1