Mapper of a format on which anch::Mapping registers the fields of T.
More...
#include <mapping.hpp>
template<typename M, typename T>
&& requires(M& mapper, const std::string& name, int T::* member, std::function<int(const T&)> getter,
std::function<void(T&, const int&)> setter) {
{ mapper.registerField(name, member) } -> std::same_as<M&>;
{ mapper.registerField(name, getter) } -> std::same_as<M&>;
{ mapper.registerField(name, setter) } -> std::same_as<M&>;
{ mapper.registerField(name, getter, setter) } -> std::same_as<M&>;
}
Mapper of a format on which anch::Mapping registers the fields of T.
Definition mapping.hpp:88
Mapper of a format on which anch::Mapping registers the fields of T.
A mapper registers fields with their name and:
- a member pointer: registerField(name, &T::member, constraints...) ;
- a getter: registerField(name, std::function<P(const T&)>, constraints...) (written only) ;
- a setter: registerField(name, std::function<void(T&, const P&)>, constraints...) (read only) ;
- a getter and a setter.
Each function returns the mapper (fluent registration). Descriptions only use these forms, common to formats: a format deduces how it maps a field from its type (anch-json maps fields of std::optional , pointers, collections and maps with the mapper of their value type). Constraints are anch-val ones ; a format which does not support one of them refuses it at compile time.
- Template Parameters
-
| M | the mapper type |
| T | the object type |
- Since
- 0.3