Description of an object for every format (anch-json, ...). More...
#include <mapping.hpp>
Public Types | |
| using | Undescribed = void |
Description of an object for every format (anch-json, ...).
A type is described by specializing this class template with a registerObject function which registers its fields on the mapper of a format ( anch::ObjectMapper ). The function is a template (the mapper type is the one of each format).
The specialization has to be declared in the header of the type, just after it: every translation unit which uses the type sees its description. A description which is not visible changes the behaviour of formats and validation (the type is not described there) and violates the one definition rule: formats refuse undescribed objects at compile time, and anch-val refuses classes which are neither described nor scalars.
Fields are registered with their name and their member pointer, or a getter and / or a setter ( std::function ), and constraints (anch-val: anch::val::required , anch::val::minLength(1) , ...). The primary template marks types which are not described ( anch::Described ).
| T | the described type |
| using anch::Mapping< T >::Undescribed = void |
Marker of the primary template: T is not described