ECSTASY
All in the name
Loading...
Searching...
No Matches
QueryableNeedAdjust.hpp
Go to the documentation of this file.
1
11
12#ifndef ECSTASY_QUERY_CONCEPTS_QUERYABLENEEDADJUST_HPP_
13#define ECSTASY_QUERY_CONCEPTS_QUERYABLENEEDADJUST_HPP_
14
15#include "Queryable.hpp"
16
17namespace ecstasy::query
18{
27 template <typename Q>
28 concept QueryableObjectNeedAdjust = requires(Q &queryable, std::size_t maxSize) {
30 requires QueryableObject<Q>;
31
32 // clang-format off
33 { queryable.adjustMask(maxSize) } -> std::same_as<void>;
34 // clang-format on
35 };
36
45 template <typename Q>
46 concept QueryableWrapperNeedAdjust = requires(Q &queryable, std::size_t maxSize) {
48 requires QueryableWrapper<Q>;
49
50 // clang-format off
51 { queryable->adjustMask(maxSize) } -> std::same_as<void>;
52 // clang-format on
53 };
54
63 template <typename Q>
65
81 template <typename T>
82 constexpr void adjustMask([[maybe_unused]] T &queryable, [[maybe_unused]] size_t maxSize) noexcept
83 {
84 }
85
87 template <QueryableNeedAdjust Q>
88 constexpr void adjustMask(Q &queryable, size_t maxSize)
89 {
90 if constexpr (QueryableWrapper<Q>)
91 queryable->adjustMask(maxSize);
92 else
93 queryable.adjustMask(maxSize);
94 }
95
105 template <typename T>
107
109 template <QueryableNeedAdjust T>
111
120 template <typename T>
122} // namespace ecstasy::query
123
124#endif /* !ECSTASY_QUERY_CONCEPTS_QUERYABLENEEDADJUST_HPP_ */
Contains the concepts for queryable objects.
Defines a Queryable type which has the adjustMask() implemented.
Defines a type that can be queried.
Definition Queryable.hpp:42
Defines a Queryable object type which has the adjustMask() implemented.
Defines a type that can be queried through a wrapper.
Definition Queryable.hpp:91
Defines a Queryable wrapper type which has the adjustMask() implemented.
Namespace regrouping the internal ecstasy query system.
Definition Condition.hpp:18
static constexpr bool is_queryable_with_adjust_v
Helper for is_queryable_with_adjust.
constexpr void adjustMask(T &queryable, size_t maxSize) noexcept
Adjust the queryable mask if needed.
Checks if the given type match the QueryableNeedAdjust concept.