From 7e2f5783ddd4e59bd69de939e78d998655fb04dd Mon Sep 17 00:00:00 2001 From: klaus triendl Date: Tue, 16 Jul 2024 22:15:43 +0200 Subject: [PATCH] First attempt to offer sqlite_orm as a named C++ module --- dev/alias.h | 2 +- dev/alias_traits.h | 2 +- dev/arg_values.h | 2 +- dev/arithmetic_tag.h | 2 +- dev/ast/excluded.h | 2 +- dev/ast/exists.h | 2 +- dev/ast/group_by.h | 2 +- dev/ast/into.h | 2 +- dev/ast/match.h | 2 +- dev/ast/rank.h | 2 +- dev/ast/set.h | 2 +- dev/ast/special_keywords.h | 2 +- dev/ast/upsert_clause.h | 2 +- dev/ast/where.h | 2 +- dev/ast_iterator.h | 2 +- dev/backup.h | 2 +- dev/carray.h | 2 +- dev/collate_argument.h | 2 +- dev/column_pointer.h | 2 +- dev/conditions.h | 4 ++-- dev/constraints.h | 2 +- dev/core_functions.h | 4 ++-- dev/cte_moniker.h | 2 +- dev/cte_storage.h | 4 ++-- dev/cte_types.h | 2 +- dev/eponymous_vtabs/dbstat.h | 2 +- dev/error_code.h | 4 ++-- dev/expression.h | 2 +- dev/field_printer.h | 2 +- dev/function.h | 2 +- dev/functional/config.h | 6 ++++++ dev/get_prepared_statement.h | 2 +- dev/indexed_column.h | 2 +- dev/is_std_ptr.h | 2 +- dev/journal_mode.h | 2 +- dev/limit_accessor.h | 2 +- dev/literal.h | 2 +- dev/member_traits/member_traits.h | 2 +- dev/object_from_column_builder.h | 2 +- dev/operators.h | 2 +- dev/pointer_value.h | 4 ++-- dev/pragma.h | 2 +- dev/prepared_statement.h | 2 +- dev/row_extractor.h | 2 +- dev/rowid.h | 2 +- dev/schema/column.h | 2 +- dev/schema/index.h | 2 +- dev/schema/table.h | 2 +- dev/schema/triggers.h | 2 +- dev/select_constraints.h | 2 +- dev/sqlite_schema_table.h | 2 +- dev/statement_binder.h | 2 +- dev/statement_finalizer.h | 2 +- dev/storage.h | 2 +- dev/storage_base.h | 2 +- dev/sync_schema_result.h | 2 +- dev/table_info.h | 2 +- dev/table_reference.h | 2 +- dev/type_is_nullable.h | 2 +- dev/type_printer.h | 2 +- dev/type_traits.h | 2 +- dev/util.h | 2 +- dev/values.h | 2 +- dev/xdestroy_handling.h | 6 +++--- examples/iteration.cpp | 6 ++++-- modules/sqlite_orm.ixx | 13 +++++++++++++ 66 files changed, 93 insertions(+), 72 deletions(-) create mode 100644 modules/sqlite_orm.ixx diff --git a/dev/alias.h b/dev/alias.h index 822b41be5..e964a6d68 100644 --- a/dev/alias.h +++ b/dev/alias.h @@ -17,7 +17,7 @@ #include "tags.h" #include "column_pointer.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { #ifdef SQLITE_ORM_WITH_CPP20_ALIASES diff --git a/dev/alias_traits.h b/dev/alias_traits.h index 5d64de530..95ce37c1c 100644 --- a/dev/alias_traits.h +++ b/dev/alias_traits.h @@ -10,7 +10,7 @@ #include "type_traits.h" #include "table_reference.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** @short Base class for a custom table alias, column alias or expression alias. */ diff --git a/dev/arg_values.h b/dev/arg_values.h index 515a1b12f..34f31f665 100644 --- a/dev/arg_values.h +++ b/dev/arg_values.h @@ -4,7 +4,7 @@ #include "row_extractor.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** @short Wrapper around a dynamically typed value object. */ diff --git a/dev/arithmetic_tag.h b/dev/arithmetic_tag.h index 26570fff6..c7dd076fc 100644 --- a/dev/arithmetic_tag.h +++ b/dev/arithmetic_tag.h @@ -3,7 +3,7 @@ #include "functional/mpl/conditional.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Helper classes used by statement_binder and row_extractor. diff --git a/dev/ast/excluded.h b/dev/ast/excluded.h index faea0a340..4bf5874cb 100644 --- a/dev/ast/excluded.h +++ b/dev/ast/excluded.h @@ -2,7 +2,7 @@ #include // std::move -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { template diff --git a/dev/ast/exists.h b/dev/ast/exists.h index b6d2a1cfd..0cbfb0ea3 100644 --- a/dev/ast/exists.h +++ b/dev/ast/exists.h @@ -4,7 +4,7 @@ #include "../tags.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { template diff --git a/dev/ast/group_by.h b/dev/ast/group_by.h index 966dc1550..29e9cb43f 100644 --- a/dev/ast/group_by.h +++ b/dev/ast/group_by.h @@ -6,7 +6,7 @@ #include "../functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { template diff --git a/dev/ast/into.h b/dev/ast/into.h index d2bba6a2e..70a390df2 100644 --- a/dev/ast/into.h +++ b/dev/ast/into.h @@ -2,7 +2,7 @@ #include "../functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { template diff --git a/dev/ast/match.h b/dev/ast/match.h index 5500e2820..b60bffa94 100644 --- a/dev/ast/match.h +++ b/dev/ast/match.h @@ -1,6 +1,6 @@ #pragma once -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { template diff --git a/dev/ast/rank.h b/dev/ast/rank.h index e71ec8723..9d0888ebf 100644 --- a/dev/ast/rank.h +++ b/dev/ast/rank.h @@ -1,6 +1,6 @@ #pragma once -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { struct rank_t {}; } diff --git a/dev/ast/set.h b/dev/ast/set.h index e5e66f2ea..c562f1093 100644 --- a/dev/ast/set.h +++ b/dev/ast/set.h @@ -9,7 +9,7 @@ #include "../tuple_helper/tuple_traits.h" #include "../table_name_collector.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/ast/special_keywords.h b/dev/ast/special_keywords.h index f553d123b..518c8f7dd 100644 --- a/dev/ast/special_keywords.h +++ b/dev/ast/special_keywords.h @@ -1,6 +1,6 @@ #pragma once -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { struct current_time_t {}; struct current_date_t {}; diff --git a/dev/ast/upsert_clause.h b/dev/ast/upsert_clause.h index 287abaace..a23e16d31 100644 --- a/dev/ast/upsert_clause.h +++ b/dev/ast/upsert_clause.h @@ -7,7 +7,7 @@ #include "../functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { #if SQLITE_VERSION_NUMBER >= 3024000 template diff --git a/dev/ast/where.h b/dev/ast/where.h index 29ca50021..03c518a48 100644 --- a/dev/ast/where.h +++ b/dev/ast/where.h @@ -7,7 +7,7 @@ #include "../functional/cxx_type_traits_polyfill.h" #include "../serialize_result_type.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { struct where_string { diff --git a/dev/ast_iterator.h b/dev/ast_iterator.h index 7e166566e..38e3a3f71 100644 --- a/dev/ast_iterator.h +++ b/dev/ast_iterator.h @@ -22,7 +22,7 @@ #include "ast/set.h" #include "ast/match.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/backup.h b/dev/backup.h index 73b62250e..7b89ec900 100644 --- a/dev/backup.h +++ b/dev/backup.h @@ -9,7 +9,7 @@ #include "error_code.h" #include "connection_holder.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/carray.h b/dev/carray.h index f0c7ab73a..d4984463f 100644 --- a/dev/carray.h +++ b/dev/carray.h @@ -19,7 +19,7 @@ #if SQLITE_VERSION_NUMBER >= 3020000 #ifdef SQLITE_ORM_INLINE_VARIABLES_SUPPORTED -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { #ifdef SQLITE_ORM_WITH_CPP20_ALIASES inline constexpr orm_pointer_type auto carray_pointer_tag = "carray"_pointer_type; diff --git a/dev/collate_argument.h b/dev/collate_argument.h index 720886622..6d83b663f 100644 --- a/dev/collate_argument.h +++ b/dev/collate_argument.h @@ -1,6 +1,6 @@ #pragma once -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/column_pointer.h b/dev/column_pointer.h index c2b6b75bd..89764b960 100644 --- a/dev/column_pointer.h +++ b/dev/column_pointer.h @@ -10,7 +10,7 @@ #include "alias_traits.h" #include "tags.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { /** * This class is used to store explicit mapped type T and its column descriptor (member pointer/getter/setter). diff --git a/dev/conditions.h b/dev/conditions.h index e1a1fccdc..2ad332065 100644 --- a/dev/conditions.h +++ b/dev/conditions.h @@ -25,7 +25,7 @@ #include "type_printer.h" #include "literal.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { @@ -844,7 +844,7 @@ namespace sqlite_orm { // Intentionally place operators for types classified as arithmetic or general operator arguments in the internal namespace // to facilitate ADL (Argument Dependent Lookup) - namespace internal { + _EXPORT_SQLITE_ORM namespace internal { template< class T, std::enable_if_t, is_operator_argument>::value, diff --git a/dev/constraints.h b/dev/constraints.h index eed1db455..a66611caf 100644 --- a/dev/constraints.h +++ b/dev/constraints.h @@ -18,7 +18,7 @@ #include "table_type_of.h" #include "type_printer.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/core_functions.h b/dev/core_functions.h index 4f4c8bd87..01fff897f 100644 --- a/dev/core_functions.h +++ b/dev/core_functions.h @@ -17,7 +17,7 @@ #include "table_reference.h" #include "ast/into.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { using int64 = sqlite_int64; using uint64 = sqlite_uint64; @@ -2040,7 +2040,7 @@ namespace sqlite_orm { // Intentionally place operators for types classified as arithmetic or general operator arguments in the internal namespace // to facilitate ADL (Argument Dependent Lookup) - namespace internal { + _EXPORT_SQLITE_ORM namespace internal { template, diff --git a/dev/cte_moniker.h b/dev/cte_moniker.h index 79e623ef9..f6d6c24f5 100644 --- a/dev/cte_moniker.h +++ b/dev/cte_moniker.h @@ -15,7 +15,7 @@ #include "alias.h" #if(SQLITE_VERSION_NUMBER >= 3008003) && defined(SQLITE_ORM_WITH_CTE) -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { /** diff --git a/dev/cte_storage.h b/dev/cte_storage.h index 61dca9102..f933d94c9 100644 --- a/dev/cte_storage.h +++ b/dev/cte_storage.h @@ -62,7 +62,7 @@ namespace sqlite_orm { // aliased column expressions, explicit or implicitly numbered template = true> - static auto make_cte_column(std::string name, const ColRef& /*finalColRef*/) { + auto make_cte_column(std::string name, const ColRef& /*finalColRef*/) { using object_type = aliased_field, F>; return sqlite_orm::make_column<>(std::move(name), &object_type::field); @@ -70,7 +70,7 @@ namespace sqlite_orm { // F O::* template = true> - static auto make_cte_column(std::string name, const ColRef& finalColRef) { + auto make_cte_column(std::string name, const ColRef& finalColRef) { using object_type = table_type_of_t; using column_type = column_t; diff --git a/dev/cte_types.h b/dev/cte_types.h index 7594da147..20ee296c3 100644 --- a/dev/cte_types.h +++ b/dev/cte_types.h @@ -10,7 +10,7 @@ #include "tuple_helper/tuple_fy.h" #if(SQLITE_VERSION_NUMBER >= 3008003) && defined(SQLITE_ORM_WITH_CTE) -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/eponymous_vtabs/dbstat.h b/dev/eponymous_vtabs/dbstat.h index 1b674ed9b..4a077faf2 100644 --- a/dev/eponymous_vtabs/dbstat.h +++ b/dev/eponymous_vtabs/dbstat.h @@ -7,7 +7,7 @@ #include "../schema/column.h" #include "../schema/table.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { #ifdef SQLITE_ENABLE_DBSTAT_VTAB struct dbstat { std::string name; diff --git a/dev/error_code.h b/dev/error_code.h index 7410c2687..263d37190 100644 --- a/dev/error_code.h +++ b/dev/error_code.h @@ -7,7 +7,7 @@ #include // std::ostringstream #include -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** @short Enables classifying sqlite error codes. @@ -50,7 +50,7 @@ namespace std { struct is_error_code_enum<::sqlite_orm::orm_error_code> : true_type {}; } -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { class orm_error_category : public std::error_category { public: diff --git a/dev/expression.h b/dev/expression.h index 657bf56e2..1ef926824 100644 --- a/dev/expression.h +++ b/dev/expression.h @@ -9,7 +9,7 @@ #include "functional/cxx_type_traits_polyfill.h" #include "tags.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/field_printer.h b/dev/field_printer.h index 6bd990348..e6ba95bb3 100644 --- a/dev/field_printer.h +++ b/dev/field_printer.h @@ -15,7 +15,7 @@ #include "is_std_ptr.h" #include "type_traits.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Is used to print members mapped to objects in storage_t::dump member function. diff --git a/dev/function.h b/dev/function.h index b26335ffc..2673de8b6 100644 --- a/dev/function.h +++ b/dev/function.h @@ -15,7 +15,7 @@ #include "type_traits.h" #include "tags.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { struct arg_values; diff --git a/dev/functional/config.h b/dev/functional/config.h index aa2ee2cba..d1e8b6cc2 100644 --- a/dev/functional/config.h +++ b/dev/functional/config.h @@ -2,6 +2,12 @@ #include "cxx_universal.h" +#ifdef _BUILD_SQLITE_ORM_MODULE +#define _EXPORT_SQLITE_ORM export +#else +#define _EXPORT_SQLITE_ORM +#endif + #if SQLITE_ORM_HAS_INCLUDE() #include #endif diff --git a/dev/get_prepared_statement.h b/dev/get_prepared_statement.h index 10848fa43..08b545151 100644 --- a/dev/get_prepared_statement.h +++ b/dev/get_prepared_statement.h @@ -12,7 +12,7 @@ #include "node_tuple.h" #include "expression_object_type.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { template auto& get(internal::prepared_statement_t>& statement) { diff --git a/dev/indexed_column.h b/dev/indexed_column.h index e8bd3f1d4..6638429a4 100644 --- a/dev/indexed_column.h +++ b/dev/indexed_column.h @@ -6,7 +6,7 @@ #include "functional/cxx_universal.h" #include "ast/where.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/is_std_ptr.h b/dev/is_std_ptr.h index dc48b1dc6..b884ec99a 100644 --- a/dev/is_std_ptr.h +++ b/dev/is_std_ptr.h @@ -2,7 +2,7 @@ #include #include -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Specialization for optional type (std::shared_ptr / std::unique_ptr). diff --git a/dev/journal_mode.h b/dev/journal_mode.h index b72defda1..d2dcd07c1 100644 --- a/dev/journal_mode.h +++ b/dev/journal_mode.h @@ -13,7 +13,7 @@ #undef DELETE #endif -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Caps case because of: diff --git a/dev/limit_accessor.h b/dev/limit_accessor.h index e87adbf82..e8404e823 100644 --- a/dev/limit_accessor.h +++ b/dev/limit_accessor.h @@ -7,7 +7,7 @@ #include "connection_holder.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/literal.h b/dev/literal.h index 65cb1b265..b58c3c79b 100644 --- a/dev/literal.h +++ b/dev/literal.h @@ -1,6 +1,6 @@ #pragma once -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { /* diff --git a/dev/member_traits/member_traits.h b/dev/member_traits/member_traits.h index 652d58ade..cb2042628 100644 --- a/dev/member_traits/member_traits.h +++ b/dev/member_traits/member_traits.h @@ -5,7 +5,7 @@ #include "../functional/cxx_universal.h" #include "../functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { // SFINAE friendly trait to get a member object pointer's field type template diff --git a/dev/object_from_column_builder.h b/dev/object_from_column_builder.h index 86aae7f40..4777cb7ae 100644 --- a/dev/object_from_column_builder.h +++ b/dev/object_from_column_builder.h @@ -11,7 +11,7 @@ #include "schema/column.h" #include "storage_lookup.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/operators.h b/dev/operators.h index d6cd2b225..0cb0d3676 100644 --- a/dev/operators.h +++ b/dev/operators.h @@ -8,7 +8,7 @@ #include "tags.h" #include "serialize_result_type.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/pointer_value.h b/dev/pointer_value.h index 9b21294da..1bd819999 100644 --- a/dev/pointer_value.h +++ b/dev/pointer_value.h @@ -13,7 +13,7 @@ #include "xdestroy_handling.h" #if SQLITE_VERSION_NUMBER >= 3020000 -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { #ifdef SQLITE_ORM_WITH_CPP20_ALIASES namespace internal { template @@ -184,7 +184,7 @@ namespace sqlite_orm { #endif } -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Wrap a pointer, its type and its deleter function for binding it to a statement. * diff --git a/dev/pragma.h b/dev/pragma.h index c30008cbc..47efe0325 100644 --- a/dev/pragma.h +++ b/dev/pragma.h @@ -14,7 +14,7 @@ #include "util.h" #include "serializing_util.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { struct storage_base; diff --git a/dev/prepared_statement.h b/dev/prepared_statement.h index 9dbe7d0d1..079dc8f93 100644 --- a/dev/prepared_statement.h +++ b/dev/prepared_statement.h @@ -20,7 +20,7 @@ #include "ast/upsert_clause.h" #include "ast/set.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/row_extractor.h b/dev/row_extractor.h index 42becde10..783d3a889 100644 --- a/dev/row_extractor.h +++ b/dev/row_extractor.h @@ -30,7 +30,7 @@ #include "is_std_ptr.h" #include "type_traits.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Helper for casting values originating from SQL to C++ typed values, usually from rows of a result set. diff --git a/dev/rowid.h b/dev/rowid.h index a99fe6d51..a8994fe79 100644 --- a/dev/rowid.h +++ b/dev/rowid.h @@ -2,7 +2,7 @@ #include // std::string -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/schema/column.h b/dev/schema/column.h index 45c95a367..42b2c28e8 100644 --- a/dev/schema/column.h +++ b/dev/schema/column.h @@ -15,7 +15,7 @@ #include "../type_is_nullable.h" #include "../constraints.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/schema/index.h b/dev/schema/index.h index a846e51d9..1814faaf7 100644 --- a/dev/schema/index.h +++ b/dev/schema/index.h @@ -9,7 +9,7 @@ #include "../indexed_column.h" #include "../table_type_of.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/schema/table.h b/dev/schema/table.h index 055e70be5..fb957631a 100644 --- a/dev/schema/table.h +++ b/dev/schema/table.h @@ -24,7 +24,7 @@ #include "../table_info.h" #include "column.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/schema/triggers.h b/dev/schema/triggers.h index a090c4015..b924219a8 100644 --- a/dev/schema/triggers.h +++ b/dev/schema/triggers.h @@ -13,7 +13,7 @@ // the event in the C++ code, to call the C++ user callback, with update hooks: https://www.sqlite.org/c3ref/update_hook.html) // It could be an interesting feature to bring to sqlite_orm that other libraries don't have ? -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { enum class trigger_timing { trigger_before, trigger_after, trigger_instead_of }; enum class trigger_type { trigger_delete, trigger_insert, trigger_update }; diff --git a/dev/select_constraints.h b/dev/select_constraints.h index 4b7226b1e..07bb4a6c8 100644 --- a/dev/select_constraints.h +++ b/dev/select_constraints.h @@ -22,7 +22,7 @@ #include "alias_traits.h" #include "cte_moniker.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { #ifdef SQLITE_ORM_OPTIONAL_SUPPORTED diff --git a/dev/sqlite_schema_table.h b/dev/sqlite_schema_table.h index 9dfda257c..da1818826 100644 --- a/dev/sqlite_schema_table.h +++ b/dev/sqlite_schema_table.h @@ -7,7 +7,7 @@ #include "column_pointer.h" #include "alias.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * SQLite's "schema table" that stores the schema for a database. * diff --git a/dev/statement_binder.h b/dev/statement_binder.h index 0473f7943..0d5c32d56 100644 --- a/dev/statement_binder.h +++ b/dev/statement_binder.h @@ -26,7 +26,7 @@ #include "xdestroy_handling.h" #include "pointer_value.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Helper class used for binding fields to sqlite3 statements. diff --git a/dev/statement_finalizer.h b/dev/statement_finalizer.h index d94950080..a9d2d98e9 100644 --- a/dev/statement_finalizer.h +++ b/dev/statement_finalizer.h @@ -4,7 +4,7 @@ #include // std::unique_ptr #include // std::integral_constant -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Guard class which finalizes `sqlite3_stmt` in dtor diff --git a/dev/storage.h b/dev/storage.h index a7bf160df..1c65adce2 100644 --- a/dev/storage.h +++ b/dev/storage.h @@ -58,7 +58,7 @@ #include "util.h" #include "serializing_util.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { /* diff --git a/dev/storage_base.h b/dev/storage_base.h index ddad55592..4360fa246 100644 --- a/dev/storage_base.h +++ b/dev/storage_base.h @@ -31,7 +31,7 @@ #include "udf_proxy.h" #include "serializing_util.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/sync_schema_result.h b/dev/sync_schema_result.h index e4df5cc96..e8d162edd 100644 --- a/dev/sync_schema_result.h +++ b/dev/sync_schema_result.h @@ -2,7 +2,7 @@ #include -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { enum class sync_schema_result { diff --git a/dev/table_info.h b/dev/table_info.h index 087a3c6f2..0fc5fa614 100644 --- a/dev/table_info.h +++ b/dev/table_info.h @@ -4,7 +4,7 @@ #include "functional/cxx_universal.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { struct table_info { int cid = 0; diff --git a/dev/table_reference.h b/dev/table_reference.h index 8b20c9162..412f2838b 100644 --- a/dev/table_reference.h +++ b/dev/table_reference.h @@ -7,7 +7,7 @@ #include "functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { /* * Identity wrapper around a mapped object, facilitating uniform column pointer expressions. diff --git a/dev/type_is_nullable.h b/dev/type_is_nullable.h index 9f161c110..b959a360d 100644 --- a/dev/type_is_nullable.h +++ b/dev/type_is_nullable.h @@ -6,7 +6,7 @@ #include "functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * This is class that tells `sqlite_orm` that type is nullable. Nullable types diff --git a/dev/type_printer.h b/dev/type_printer.h index 79df36b03..b5cfe08b0 100644 --- a/dev/type_printer.h +++ b/dev/type_printer.h @@ -9,7 +9,7 @@ #include "type_traits.h" #include "is_std_ptr.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * This class transforms a C++ type to a sqlite type name (int -> INTEGER, ...) diff --git a/dev/type_traits.h b/dev/type_traits.h index e55c22d8e..26fc97815 100644 --- a/dev/type_traits.h +++ b/dev/type_traits.h @@ -10,7 +10,7 @@ #include "functional/cxx_core_features.h" #include "functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { // C++ generic traits used throughout the library namespace internal { template diff --git a/dev/util.h b/dev/util.h index f162eeda9..3ab47d7e0 100644 --- a/dev/util.h +++ b/dev/util.h @@ -6,7 +6,7 @@ #include "error_code.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { /** * Escape the provided character in the given string by doubling it. diff --git a/dev/values.h b/dev/values.h index 68ce9639d..2643d47b2 100644 --- a/dev/values.h +++ b/dev/values.h @@ -7,7 +7,7 @@ #include "functional/cxx_universal.h" #include "functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { diff --git a/dev/xdestroy_handling.h b/dev/xdestroy_handling.h index 0b4b40afd..f9d8e63ca 100644 --- a/dev/xdestroy_handling.h +++ b/dev/xdestroy_handling.h @@ -8,14 +8,14 @@ #include "functional/cxx_universal.h" #include "functional/cxx_type_traits_polyfill.h" -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { using xdestroy_fn_t = void (*)(void*); using null_xdestroy_t = std::integral_constant; SQLITE_ORM_INLINE_VAR constexpr null_xdestroy_t null_xdestroy_f{}; } -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { namespace internal { #ifdef SQLITE_ORM_CONCEPTS_SUPPORTED /** @@ -173,7 +173,7 @@ namespace sqlite_orm { } } -namespace sqlite_orm { +_EXPORT_SQLITE_ORM namespace sqlite_orm { #ifdef SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED /** diff --git a/examples/iteration.cpp b/examples/iteration.cpp index 1ca54b8d3..a7c8bcc43 100644 --- a/examples/iteration.cpp +++ b/examples/iteration.cpp @@ -1,7 +1,9 @@ - -#include +#include +#include +#include #include #include +#include using std::cout; using std::endl; diff --git a/modules/sqlite_orm.ixx b/modules/sqlite_orm.ixx new file mode 100644 index 000000000..f40e3bc1a --- /dev/null +++ b/modules/sqlite_orm.ixx @@ -0,0 +1,13 @@ +// In a module-file, the optional `module;` must appear first; see [cpp.pre]. +module; + +#define _BUILD_SQLITE_ORM_MODULE + +export module sqlite_orm; + +#pragma warning(push) +#pragma warning(disable : 5244) // '#include ' in the purview of module 'sqlite_orm' appears erroneous. + +#include + +#pragma warning(pop)