|
- #pragma once
-
- #include "order_by.h"
- #include "order_by/order_direction.h"
-
- namespace cpphibernate
- {
-
- namespace __impl
- {
-
- /* order_by_t */
-
- template<typename... T_order_directions>
- struct order_by_t
- : public tag_modifier
- , public tag_equality_comparable<tag_modifier>
- {
- using order_directions_type = hana::basic_tuple<T_order_directions...>;
-
- order_directions_type order_directions;
- };
-
- /* order_by_builder */
-
- template<typename X, typename>
- struct order_by_builder
- {
- template<typename... T_args>
- static constexpr decltype(auto) apply(T_args&&...)
- { static_assert(sizeof...(T_args) == -1, "Invalid parameters for order_by(...)!"); }
- };
-
- template<typename... T_order_directions>
- struct order_by_builder<
- mp::list<T_order_directions...>,
- mp::enable_if_t<mp::is_true_v<is_order_direction_v<mp::decay_t<T_order_directions>>...>>>
- {
- static constexpr decltype(auto) apply(T_order_directions&&...)
- {
- using order_by_type = order_by_t<mp::decay_t<T_order_directions>...>;
- return order_by_type { };
- }
- };
-
- }
-
- /* is_order_by_modifier */
-
- template<typename T>
- struct is_order_by_modifier
- : public mp::is_specialization_of<T, __impl::order_by_t>
- { };
-
- }
|