CSV format: serialization and deserialization of lists of described objects with options.
More...
#include <format.hpp>
|
| static constexpr std::string_view | MEDIA_TYPE = "text/csv" |
CSV format: serialization and deserialization of lists of described objects with options.
It is the format type used by generic codecs ( anch::codec::FormatCodec , anch-codec): it does not depend on them (its members follow the anch::codec::DataFormat concept). Values are lists of described objects ( anch::Mapping ): one record per object.
- Author
- Vincent Lachenal
- Since
- 0.3
◆ Options
◆ defaultOptions()
Default options (RFC 4180)
- Returns
- the default options
◆ deserialize()
| void anch::csv::CsvFormat::deserialize |
( |
std::vector< T > & | values, |
|
|
std::istream & | input, |
|
|
const Options & | options ) |
|
static |
Deserialize objects
- Parameters
-
| values | the objects (replaced) |
| input | the input stream |
| options | the options |
- Exceptions
-
| CsvError | on invalid CSV, conversion error or constraint violation |
◆ serialize()
template<std::ranges::input_range R>
requires
anch::Described<std::remove_cvref_t<std::ranges::range_value_t<R>>>
| void anch::csv::CsvFormat::serialize |
( |
const R & | values, |
|
|
std::ostream & | out, |
|
|
const Options & | options ) |
|
static |
Serialize objects (header, then one record per object)
- Parameters
-
| values | the objects |
| out | the output stream |
| options | the options |
- Exceptions
-
◆ MEDIA_TYPE
| std::string_view anch::csv::CsvFormat::MEDIA_TYPE = "text/csv" |
|
staticconstexpr |
The documentation for this struct was generated from the following file: