MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
CSV

CSV Utilities. More...

Classes

struct  mtcore::csv::Options
 CSV options for defining the CSV format. More...
 
struct  mtcore::csv::RowEnd
 Special output-only type for indicating the end of a row. More...
 
struct  mtcore::csv::ColEnd
 Special output-only type for indicating the end of a colum. More...
 

Typedefs

using mtcore::csv::Column = std::variant<i64, u64, Slice<const char>, f64>
 Column type.
 
using mtcore::csv::WriteElem = std::variant<i64, u64, Slice<const char>, f64, Slice<const Column>, RowEnd, ColEnd>
 Elements that can be written to a CSV writer.
 

Functions

template<WriterImpl WI>
io::Writer< csv::impl::Writer< WI > > mtcore::csv::writer (io::Writer< WI > &underlying, Options opts={})
 Creates a CSV writer which will encode the data before writing it out.
 

Detailed Description

CSV Utilities.

Typedef Documentation

◆ Column

using mtcore::csv::Column = std::variant<i64, u64, Slice<const char>, f64>

Column type.

Does not output separators if one of these types is printed on its own (needs to be in a slice of columns for separators to be printed).

Definition at line 32 of file csv/writer.hpp.

◆ WriteElem

using mtcore::csv::WriteElem = std::variant<i64, u64, Slice<const char>, f64, Slice<const Column>, RowEnd, ColEnd>

Elements that can be written to a CSV writer.

A Slice of column will automatically add column separators between slice elements and a row separator at the end. Generally, you will want to use a slice of columns. However, if you need more control, you can print each element manually and use ColEnd{} and RowEnd{} to indicate where separators should go.

Definition at line 40 of file csv/writer.hpp.

Function Documentation

◆ writer()

template<WriterImpl WI>
io::Writer< csv::impl::Writer< WI > > mtcore::csv::writer ( io::Writer< WI > & underlying,
Options opts = {} )

Creates a CSV writer which will encode the data before writing it out.

Uses another writer as the destination, which allows developers to easily switch where the output goes to.

Template Parameters
WIUnderlying writer to write to
Parameters
underlyingWriter to write to
optsCSV Options
Returns
A CSV writer

Definition at line 164 of file csv/writer.hpp.

164 {}) {
165 return io::Writer<csv::impl::Writer<WI>>{.underlying = csv::impl::Writer<WI>{underlying, opts}};
166 }
A writer that writes data to some sort of stream or buffer Note: the data elements written should be ...
Definition io/writer.hpp:51
Here is the caller graph for this function: