Skip to content

Commit

Permalink
Added _EXPORT_SQLITE_ORM macro to clang-format's StatementMacros
Browse files Browse the repository at this point in the history
  • Loading branch information
trueqbit committed Jul 24, 2024
1 parent 996bcbc commit e7d7783
Show file tree
Hide file tree
Showing 54 changed files with 365 additions and 266 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ AttributeMacros: [SQLITE_ORM_CPP_LIKELY, SQLITE_ORM_CPP_UNLIKELY]
StatementMacros:
- __pragma
- _Pragma
- _EXPORT_SQLITE_ORM
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
Expand Down
3 changes: 2 additions & 1 deletion dev/alias.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
/**
* Using a column pointer, create a column reference to an aliased table column.
*
Expand Down
6 changes: 4 additions & 2 deletions dev/alias_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include "type_traits.h"
#include "table_reference.h"

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {

/** @short Base class for a custom table alias, column alias or expression alias.
*/
Expand Down Expand Up @@ -71,7 +72,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
template<class A>
concept orm_alias = std::derived_from<A, alias_tag>;
Expand Down
3 changes: 2 additions & 1 deletion dev/arg_values.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

#include "row_extractor.h"

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {

/** @short Wrapper around a dynamically typed value object.
*/
Expand Down
3 changes: 2 additions & 1 deletion dev/arithmetic_tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

#include "functional/mpl/conditional.h"

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {

/**
* Helper classes used by statement_binder and row_extractor.
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/excluded.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
template<class T>
internal::excluded_t<T> excluded(T expression) {
return {std::move(expression)};
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/exists.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
/**
* EXISTS(condition).
* Example: storage.select(columns(&Agent::code, &Agent::name, &Agent::workingArea, &Agent::comission),
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/group_by.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
/**
* GROUP BY column.
* Example: storage.get_all<Employee>(group_by(&Employee::name))
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/into.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
template<class T>
internal::into_t<T> into() {
return {};
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/match.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include <utility>
#endif

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
namespace internal {

template<class T, class X>
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/rank.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
inline internal::rank_t rank() {
return {};
}
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/set.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
/**
* SET keyword used in UPDATE ... SET queries.
* Args must have `assign_t` type. E.g. set(assign(&User::id, 5)) or set(c(&User::id) = 5)
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/special_keywords.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
inline internal::current_time_t current_time() {
return {};
}
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/upsert_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
#if SQLITE_VERSION_NUMBER >= 3024000
/**
* ON CONFLICT upsert clause builder function.
Expand Down
3 changes: 2 additions & 1 deletion dev/ast/where.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
/**
* WHERE clause. Use it to add WHERE conditions wherever you like.
* C is expression type. Can be any expression like: is_equal_t, is_null_t, exists_t etc
Expand Down
19 changes: 10 additions & 9 deletions dev/carray.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

#if SQLITE_VERSION_NUMBER >= 3020000
#ifdef SQLITE_ORM_INLINE_VARIABLES_SUPPORTED
_EXPORT_SQLITE_ORM 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;
Expand All @@ -43,12 +44,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 @@ -60,14 +61,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 @@ -91,7 +92,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 @@ -102,20 +103,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
3 changes: 2 additions & 1 deletion dev/column_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
/**
* Explicitly refer to a column, used in contexts
* where the automatic object mapping deduction needs to be overridden.
Expand Down
7 changes: 4 additions & 3 deletions dev/conditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
/**
* Explicit FROM function. Usage:
* `storage.select(&User::id, from<User>());`
Expand Down Expand Up @@ -1238,8 +1239,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
3 changes: 2 additions & 1 deletion dev/constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
#if SQLITE_VERSION_NUMBER >= 3031000
template<class T>
internal::generated_always_t<T> generated_always_as(T expression) {
Expand Down
44 changes: 20 additions & 24 deletions dev/core_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {

using int64 = sqlite_int64;
using uint64 = sqlite_uint64;
Expand Down Expand Up @@ -1673,28 +1674,27 @@ _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 @@ -1889,10 +1889,8 @@ _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 @@ -1901,10 +1899,8 @@ _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
3 changes: 2 additions & 1 deletion dev/cte_moniker.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ namespace sqlite_orm {
}
}

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
inline namespace literals {
/**
* cte_moniker<'n'> from a numeric literal.
Expand Down
3 changes: 2 additions & 1 deletion dev/eponymous_vtabs/dbstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include "../schema/table.h"
#include "../column_pointer.h"

_EXPORT_SQLITE_ORM namespace sqlite_orm {
_EXPORT_SQLITE_ORM
namespace sqlite_orm {
#ifdef SQLITE_ENABLE_DBSTAT_VTAB
struct dbstat {
std::string name;
Expand Down
Loading

0 comments on commit e7d7783

Please sign in to comment.