csvpp 1.2.0
CSV parsing / writing libraries
|
Map-based Writer iterator. More...
#include <csv.hpp>
Public Types | |
using | value_type = void |
using | difference_type = void |
using | pointer = void |
using | reference = void |
using | iterator_category = std::output_iterator_tag |
Public Member Functions | |
Map_writer_iter (std::ostream &output_stream, const std::vector< Header > &headers, const Default_value &default_val={}, const char delimiter=',', const char quote='"') | |
Use a std::ostream for CSV output. | |
Map_writer_iter (const std::string &filename, const std::vector< Header > &headers, const Default_value &default_val={}, const char delimiter=',', const char quote='"') | |
Open a file for CSV output. | |
Map_writer_iter & | operator* () |
No-op. | |
Map_writer_iter & | operator++ () |
No-op. | |
Map_writer_iter & | operator++ (int) |
No-op. | |
template<typename K , typename T , typename std::enable_if_t< std::is_convertible_v< Header, K >, int > = 0> | |
Map_writer_iter & | operator= (const std::map< K, T > &row) |
Write a row. | |
Map-based Writer iterator.
Output iterator accepting a std::map to write as a CSV row
|
inline |
Use a std::ostream for CSV output.
output_stream | std::ostream to write to |
headers | Field headers to use. This specifies the header row and order |
default_val | Default value to write to a field if not specified in row input |
delimiter | Delimiter character |
quote | Quote character |
output_stream
must not be destroyed or written to during the lifetime of this Writer
|
inline |
Open a file for CSV output.
filename | Path to file to write to. Any existing file will be overwritten |
headers | Field headers to use. This specifies the header row and order |
default_val | Default value to write to a field if not specified in row input |
delimiter | Delimiter character |
quote | Quote character |
output_stream
must not be destroyed or written to during the lifetime of this Writer IO_error | if there is an error opening the file |
|
inline |
Write a row.
row | std::map containing header to field pairs. If row contains keys not in the specified header, the associated values will be ignored. If the map is missing headers, their values will be filled with default_val |
IO_error | if there is an error writing |