Skip to content

Commit

Permalink
Added includes of dependent headers
Browse files Browse the repository at this point in the history
* Added missing includes of dependent internal headers
* Cleaned up amalgamation files to only include the public facing high-level headers
  • Loading branch information
trueqbit committed Jul 17, 2024
1 parent 7e2f578 commit 2adf823
Show file tree
Hide file tree
Showing 40 changed files with 12,819 additions and 12,835 deletions.
2 changes: 1 addition & 1 deletion dev/alias.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <type_traits> // std::enable_if, std::is_same, std::conditional
#include <type_traits> // std::enable_if, std::is_same
#include <utility> // std::make_index_sequence, std::move
#include <string> // std::string
#include <sstream> // std::stringstream
Expand Down
1 change: 1 addition & 0 deletions dev/arithmetic_tag.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once

#include <type_traits> // std::is_integral

#include "functional/mpl/conditional.h"
Expand Down
1 change: 1 addition & 0 deletions dev/ast/match.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <utility>

_EXPORT_SQLITE_ORM namespace sqlite_orm {
namespace internal {
Expand Down
16 changes: 8 additions & 8 deletions dev/carray.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
* the deleter when the statement finishes.
*/
template<class P, class D>
carray_pointer_binding<P, D> bind_carray_pointer(P* p, D d) noexcept {
carray_pointer_binding<P, D> bind_carray_pointer(P * p, D d) noexcept {
return bind_pointer<carray_pointer_tag>(p, std::move(d));
}

template<class P>
static_carray_pointer_binding<P> bind_carray_pointer_statically(P* p) noexcept {
static_carray_pointer_binding<P> bind_carray_pointer_statically(P * p) noexcept {
return bind_pointer_statically<carray_pointer_tag>(p);
}

Expand All @@ -58,14 +58,14 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
*/
template<class P, class D>
[[deprecated("Use the better named function `bind_carray_pointer(...)`")]] carray_pointer_binding<P, D>
bindable_carray_pointer(P* p, D d) noexcept {
bindable_carray_pointer(P * p, D d) noexcept {
return bind_pointer<carray_pointer_tag>(p, std::move(d));
}

template<class P>
[[deprecated(
"Use the better named function `bind_carray_pointer_statically(...)` ")]] static_carray_pointer_binding<P>
statically_bindable_carray_pointer(P* p) noexcept {
statically_bindable_carray_pointer(P * p) noexcept {
return bind_pointer_statically<carray_pointer_tag>(p);
}
#else
Expand All @@ -89,7 +89,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
* the deleter when the statement finishes.
*/
template<class P, class D>
carray_pointer_binding<P, D> bind_carray_pointer(P* p, D d) noexcept {
carray_pointer_binding<P, D> bind_carray_pointer(P * p, D d) noexcept {
return bind_pointer<carray_pointer_type>(p, std::move(d));
}

Expand All @@ -100,20 +100,20 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
* and sqlite assumes the object pointed to is valid throughout the lifetime of a statement.
*/
template<class P>
static_carray_pointer_binding<P> bind_carray_pointer_statically(P* p) noexcept {
static_carray_pointer_binding<P> bind_carray_pointer_statically(P * p) noexcept {
return bind_pointer_statically<carray_pointer_type>(p);
}

template<class P, class D>
[[deprecated("Use the better named function `bind_carray_pointer(...)`")]] carray_pointer_binding<P, D>
bindable_carray_pointer(P* p, D d) noexcept {
bindable_carray_pointer(P * p, D d) noexcept {
return bind_carray_pointer(p, std::move(d));
}

template<class P>
[[deprecated(
"Use the better named function `bind_carray_pointer_statically(...)` ")]] static_carray_pointer_binding<P>
statically_bindable_carray_pointer(P* p) noexcept {
statically_bindable_carray_pointer(P * p) noexcept {
return bind_carray_pointer_statically(p);
}
#endif
Expand Down
1 change: 0 additions & 1 deletion dev/collate_argument.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
rtrim,
};
}

}
5 changes: 3 additions & 2 deletions dev/conditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <tuple> // std::tuple
#include <utility> // std::move, std::forward
#include <sstream> // std::stringstream
#include <iomanip> // std::flush

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
Expand Down Expand Up @@ -1234,8 +1235,8 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
* }
*/
template<class S>
internal::dynamic_order_by_t<internal::serializer_context<typename S::db_objects_type>>
dynamic_order_by(const S& storage) {
internal::dynamic_order_by_t<internal::serializer_context<typename S::db_objects_type>> dynamic_order_by(
const S& storage) {
internal::serializer_context_builder<S> builder(storage);
return builder();
}
Expand Down
2 changes: 1 addition & 1 deletion dev/constraints.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <type_traits> // std::is_base_of, std::false_type, std::true_type
#include <system_error> // std::system_error
#include <ostream> // std::ostream
#include <string> // std::string
#include <tuple> // std::tuple
#include <type_traits> // std::is_base_of, std::false_type, std::true_type

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
Expand Down
41 changes: 23 additions & 18 deletions dev/core_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1670,27 +1670,28 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
*/
template<class R = void, class... Args>
auto coalesce(Args... args)
-> internal::built_in_function_t<typename mpl::conditional_t< // choose R or common type
std::is_void<R>::value,
std::common_type<internal::field_type_or_type_t<Args>...>,
polyfill::type_identity<R>>::type,
internal::coalesce_string,
Args...> {
->internal::built_in_function_t<typename mpl::conditional_t< // choose R or common type
std::is_void<R>::value,
std::common_type<internal::field_type_or_type_t<Args>...>,
polyfill::type_identity<R>>::type,
internal::coalesce_string,
Args...> {
return {std::make_tuple(std::forward<Args>(args)...)};
}

/**
* IFNULL(X,Y) function https://www.sqlite.org/lang_corefunc.html#ifnull
*/
template<class R = void, class X, class Y>
auto ifnull(X x, Y y) -> internal::built_in_function_t<
typename mpl::conditional_t< // choose R or common type
std::is_void<R>::value,
std::common_type<internal::field_type_or_type_t<X>, internal::field_type_or_type_t<Y>>,
polyfill::type_identity<R>>::type,
internal::ifnull_string,
X,
Y> {
auto ifnull(X x, Y y)
->internal::built_in_function_t<
typename mpl::conditional_t< // choose R or common type
std::is_void<R>::value,
std::common_type<internal::field_type_or_type_t<X>, internal::field_type_or_type_t<Y>>,
polyfill::type_identity<R>>::type,
internal::ifnull_string,
X,
Y> {
return {std::make_tuple(std::move(x), std::move(y))};
}

Expand Down Expand Up @@ -1885,8 +1886,10 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
* The return type is the type of the first argument.
*/
template<class X, class Y, class... Rest>
internal::built_in_function_t<internal::unique_ptr_result_of<X>, internal::max_string, X, Y, Rest...>
max(X x, Y y, Rest... rest) {
internal::built_in_function_t<internal::unique_ptr_result_of<X>, internal::max_string, X, Y, Rest...> max(
X x,
Y y,
Rest... rest) {
return {std::tuple<X, Y, Rest...>{std::forward<X>(x), std::forward<Y>(y), std::forward<Rest>(rest)...}};
}

Expand All @@ -1895,8 +1898,10 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
* The return type is the type of the first argument.
*/
template<class X, class Y, class... Rest>
internal::built_in_function_t<internal::unique_ptr_result_of<X>, internal::min_string, X, Y, Rest...>
min(X x, Y y, Rest... rest) {
internal::built_in_function_t<internal::unique_ptr_result_of<X>, internal::min_string, X, Y, Rest...> min(
X x,
Y y,
Rest... rest) {
return {std::tuple<X, Y, Rest...>{std::forward<X>(x), std::forward<Y>(y), std::forward<Rest>(rest)...}};
}

Expand Down
11 changes: 5 additions & 6 deletions dev/error_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
value_is_null,
no_tables_specified,
};

}

namespace std {
Expand Down Expand Up @@ -134,7 +133,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<typename... T>
std::string get_error_message(sqlite3* db, T&&... args) {
std::string get_error_message(sqlite3 * db, T && ... args) {
std::ostringstream stream;
using unpack = int[];
(void)unpack{0, (stream << args, 0)...};
Expand All @@ -143,27 +142,27 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<typename... T>
[[noreturn]] void throw_error(sqlite3* db, T&&... args) {
[[noreturn]] void throw_error(sqlite3 * db, T && ... args) {
throw std::system_error{sqlite_errc(sqlite3_errcode(db)), get_error_message(db, std::forward<T>(args)...)};
}

inline std::system_error sqlite_to_system_error(int ev) {
return {sqlite_errc(ev)};
}

inline std::system_error sqlite_to_system_error(sqlite3* db) {
inline std::system_error sqlite_to_system_error(sqlite3 * db) {
return {sqlite_errc(sqlite3_errcode(db)), sqlite3_errmsg(db)};
}

[[noreturn]] inline void throw_translated_sqlite_error(int ev) {
throw sqlite_to_system_error(ev);
}

[[noreturn]] inline void throw_translated_sqlite_error(sqlite3* db) {
[[noreturn]] inline void throw_translated_sqlite_error(sqlite3 * db) {
throw sqlite_to_system_error(db);
}

[[noreturn]] inline void throw_translated_sqlite_error(sqlite3_stmt* stmt) {
[[noreturn]] inline void throw_translated_sqlite_error(sqlite3_stmt * stmt) {
throw sqlite_to_system_error(sqlite3_db_handle(stmt));
}
}
3 changes: 2 additions & 1 deletion dev/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <utility> // std::move, std::forward, std::declval
#include "functional/cxx_optional.h"

#include "functional/cxx_universal.h"
#include "functional/cxx_universal.h" // ::nullptr_t
#include "functional/cxx_type_traits_polyfill.h"
#include "tags.h"
#include "operators.h"

_EXPORT_SQLITE_ORM namespace sqlite_orm {

Expand Down
2 changes: 1 addition & 1 deletion dev/field_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#endif
#include "functional/cxx_optional.h"

#include "functional/cxx_universal.h"
#include "functional/cxx_universal.h" // ::nullptr_t
#include "functional/cxx_type_traits_polyfill.h"
#include "is_std_ptr.h"
#include "type_traits.h"
Expand Down
1 change: 1 addition & 0 deletions dev/functional/cxx_functional_polyfill.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once

#include <functional>
#if __cpp_lib_invoke < 201411L
#include <type_traits> // std::enable_if, std::is_member_object_pointer, std::is_member_function_pointer
Expand Down
22 changes: 11 additions & 11 deletions dev/get_prepared_statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
_EXPORT_SQLITE_ORM namespace sqlite_orm {

template<int N, class It, class L, class O>
auto& get(internal::prepared_statement_t<internal::insert_range_t<It, L, O>>& statement) {
auto& get(internal::prepared_statement_t<internal::insert_range_t<It, L, O>> & statement) {
return std::get<N>(statement.expression.range);
}

Expand All @@ -25,7 +25,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class It, class L, class O>
auto& get(internal::prepared_statement_t<internal::replace_range_t<It, L, O>>& statement) {
auto& get(internal::prepared_statement_t<internal::replace_range_t<It, L, O>> & statement) {
return std::get<N>(statement.expression.range);
}

Expand All @@ -35,7 +35,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class T, class... Ids>
auto& get(internal::prepared_statement_t<internal::get_t<T, Ids...>>& statement) {
auto& get(internal::prepared_statement_t<internal::get_t<T, Ids...>> & statement) {
return internal::get_ref(std::get<N>(statement.expression.ids));
}

Expand All @@ -45,7 +45,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class T, class... Ids>
auto& get(internal::prepared_statement_t<internal::get_pointer_t<T, Ids...>>& statement) {
auto& get(internal::prepared_statement_t<internal::get_pointer_t<T, Ids...>> & statement) {
return internal::get_ref(std::get<N>(statement.expression.ids));
}

Expand All @@ -56,7 +56,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {

#ifdef SQLITE_ORM_OPTIONAL_SUPPORTED
template<int N, class T, class... Ids>
auto& get(internal::prepared_statement_t<internal::get_optional_t<T, Ids...>>& statement) {
auto& get(internal::prepared_statement_t<internal::get_optional_t<T, Ids...>> & statement) {
return internal::get_ref(std::get<N>(statement.expression.ids));
}

Expand All @@ -67,7 +67,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
#endif // SQLITE_ORM_OPTIONAL_SUPPORTED

template<int N, class T, class... Ids>
auto& get(internal::prepared_statement_t<internal::remove_t<T, Ids...>>& statement) {
auto& get(internal::prepared_statement_t<internal::remove_t<T, Ids...>> & statement) {
return internal::get_ref(std::get<N>(statement.expression.ids));
}

Expand All @@ -77,7 +77,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class T>
auto& get(internal::prepared_statement_t<internal::update_t<T>>& statement) {
auto& get(internal::prepared_statement_t<internal::update_t<T>> & statement) {
static_assert(N == 0, "get<> works only with 0 argument for update statement");
return internal::get_ref(statement.expression.object);
}
Expand All @@ -89,7 +89,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class T, class... Cols>
auto& get(internal::prepared_statement_t<internal::insert_explicit<T, Cols...>>& statement) {
auto& get(internal::prepared_statement_t<internal::insert_explicit<T, Cols...>> & statement) {
static_assert(N == 0, "get<> works only with 0 argument for insert statement");
return internal::get_ref(statement.expression.obj);
}
Expand All @@ -101,7 +101,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class T>
auto& get(internal::prepared_statement_t<internal::replace_t<T>>& statement) {
auto& get(internal::prepared_statement_t<internal::replace_t<T>> & statement) {
static_assert(N == 0, "get<> works only with 0 argument for replace statement");
return internal::get_ref(statement.expression.object);
}
Expand All @@ -113,7 +113,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class T>
auto& get(internal::prepared_statement_t<internal::insert_t<T>>& statement) {
auto& get(internal::prepared_statement_t<internal::insert_t<T>> & statement) {
static_assert(N == 0, "get<> works only with 0 argument for insert statement");
return internal::get_ref(statement.expression.object);
}
Expand Down Expand Up @@ -150,7 +150,7 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
}

template<int N, class T>
auto& get(internal::prepared_statement_t<T>& statement) {
auto& get(internal::prepared_statement_t<T> & statement) {
using statement_type = std::remove_reference_t<decltype(statement)>;
using expression_type = internal::expression_type_t<statement_type>;
using node_tuple = internal::node_tuple_t<expression_type>;
Expand Down
5 changes: 4 additions & 1 deletion dev/implementations/storage_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
* e.g. usage of the dbstat table.
*/
#pragma once

#include <type_traits> // std::is_same
#include <sstream>
#include <sstream> // std::stringstream
#include <iomanip> // std::flush
#include <functional> // std::reference_wrapper, std::cref
#include <algorithm> // std::find_if, std::ranges::find

#include "../type_traits.h"
#include "../sqlite_schema_table.h"
#include "../eponymous_vtabs/dbstat.h"
#include "../type_traits.h"
Expand Down
1 change: 1 addition & 0 deletions dev/implementations/table_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* this file is also used to provide definitions of interface methods 'hitting the database'.
*/
#pragma once

#include <type_traits> // std::decay_t
#include <utility> // std::move
#include <algorithm> // std::find_if, std::ranges::find
Expand Down
1 change: 0 additions & 1 deletion dev/indexed_column.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,4 @@ _EXPORT_SQLITE_ORM namespace sqlite_orm {
internal::indexed_column_t<C> indexed_column(C column_or_expression) {
return {std::move(column_or_expression)};
}

}
Loading

0 comments on commit 2adf823

Please sign in to comment.