mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-11-29 22:36:19 +08:00
* First part * Plural * Update rfl.hpp * Documentation * Update rfl.hpp * Update processors.md * underlying_enums test * Update Parser_default.hpp * Fix typo in test
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#ifndef RFL_INTERNAL_PROCESSORS_HPP_
|
|
#define RFL_INTERNAL_PROCESSORS_HPP_
|
|
|
|
#include <type_traits>
|
|
|
|
#include "internal/is_no_field_names_v.hpp"
|
|
#include "internal/is_no_optionals_v.hpp"
|
|
#include "internal/is_underlying_enums_v.hpp"
|
|
|
|
namespace rfl {
|
|
|
|
template <class... Ps>
|
|
struct Processors;
|
|
|
|
template <>
|
|
struct Processors<> {
|
|
static constexpr bool all_required_ = false;
|
|
static constexpr bool no_field_names_ = false;
|
|
static constexpr bool underlying_enums_ = false;
|
|
|
|
template <class T, class NamedTupleType>
|
|
static auto process(NamedTupleType&& _named_tuple) {
|
|
return _named_tuple;
|
|
}
|
|
};
|
|
|
|
template <class Head, class... Tail>
|
|
struct Processors<Head, Tail...> {
|
|
static constexpr bool all_required_ =
|
|
std::disjunction_v<internal::is_no_optionals<Head>,
|
|
internal::is_no_optionals<Tail>...>;
|
|
|
|
static constexpr bool no_field_names_ =
|
|
std::disjunction_v<internal::is_no_field_names<Head>,
|
|
internal::is_no_field_names<Tail>...>;
|
|
|
|
static constexpr bool underlying_enums_ =
|
|
std::disjunction_v<internal::is_underlying_enums<Head>,
|
|
internal::is_underlying_enums<Tail>...>;
|
|
|
|
template <class T, class NamedTupleType>
|
|
static auto process(NamedTupleType&& _named_tuple) {
|
|
return Processors<Tail...>::template process<T>(
|
|
Head::template process<T>(std::move(_named_tuple)));
|
|
}
|
|
};
|
|
|
|
} // namespace rfl
|
|
|
|
#endif
|