template<typename T>
class anch::csv::ObjectReader< T >
Objects reader: records of a Reader are read as T objects.
With a header, columns are associated with fields by name (columns which are not fields are ignored, or refused with Options::ignoreUnknownColumns ; required fields columns have to be present: MISSING_COLUMN ) ; without header, by position: each registered field is a column, in registration order (columns of fields which are not read, getter only, are skipped), as ObjectWriter writes them. An empty field is an absent value ( std::nullopt ), an empty quoted field ( "" ) an empty string. Conversion errors ( CONVERSION ) and constraints violations ( CONSTRAINT_VIOLATION ) give the line and the column of the field.
Pet pet;
while(objectsReader.read(pet)) {
std::cout << pet.id << ' ' << pet.name << (pet.nickname ? " has a nickname" : "") << std::endl;
}
- Template Parameters
-
- Author
- Vincent Lachenal
- Since
- 0.3