CSV mapper of a described type ( anch::Mapping , anch-utils): fields are columns.
More...
#include <mapper.hpp>
|
| | ObjectMapper () |
| const std::vector< Field > & | fields () const noexcept |
template<typename P, typename... C>
requires (anch::val::FieldConstraint<C, P> && ...) |
| ObjectMapper< T > & | registerField (const std::string &name, P T::*member, C &&... constraints) |
template<typename P, typename... C>
requires (anch::val::FieldConstraint<C, P> && ...) |
| ObjectMapper< T > & | registerField (const std::string &name, std::function< P(const T &)> getter, C &&... constraints) |
template<typename P, typename... C>
requires (anch::val::FieldConstraint<C, P> && ...) |
| ObjectMapper< T > & | registerField (const std::string &name, std::function< void(T &, const P &)> setter, C &&... constraints) |
template<typename P, typename... C>
requires (anch::val::FieldConstraint<C, P> && ...) |
| ObjectMapper< T > & | registerField (const std::string &name, std::function< P(const T &)> getter, std::function< void(T &, const P &)> setter, C &&... constraints) |
template<typename T>
class anch::csv::ObjectMapper< T >
CSV mapper of a described type ( anch::Mapping , anch-utils): fields are columns.
It satisfies the anch::ObjectMapper concept. Fields are scalars or optionalscalars ; fields registered with a member or a getter are written, fields registered with a member or a setter are read. Constraints are anch-val ones: anch::val::required makes the column required, value constraints are checked according to Options::readCheckConstraints and Options::writeCheckConstraints .
- Template Parameters
-
- Author
- Vincent Lachenal
- Since
- 0.3
◆ ObjectMapper()
◆ fields()
Fields getter
- Returns
- the fields, in registration order
◆ instance()
Get the mapper of T (built on first use)
- Returns
- the mapper
◆ registerField() [1/4]
Register field with its member (read and written)
- Parameters
-
| name | the column name |
| member | the member |
| constraints | the constraints |
- Returns
this
◆ registerField() [2/4]
Register field with its getter (written only)
- Parameters
-
| name | the column name |
| getter | the getter |
| constraints | the constraints |
- Returns
this
◆ registerField() [3/4]
template<typename T>
| ObjectMapper< T > & anch::csv::ObjectMapper< T >::registerField |
( |
const std::string & | name, |
|
|
std::function< P(const T &)> | getter, |
|
|
std::function< void(T &, const P &)> | setter, |
|
|
C &&... | constraints ) |
Register field with its getter and its setter
- Parameters
-
| name | the column name |
| getter | the getter |
| setter | the setter |
| constraints | the constraints |
- Returns
this
◆ registerField() [4/4]
Register field with its setter (read only)
- Parameters
-
| name | the column name |
| setter | the setter |
| constraints | the constraints |
- Returns
this
The documentation for this class was generated from the following file: