Class CSVWriter

Class Documentation

class CSVWriter

CSVWriter.

based on the following: http://thispointer.com/how-to-write-data-in-a-csv-file-in-c/

Public Functions

inline CSVWriter(const std::string &filename, const std::string &delm = ",")
CSVWriter() = default

Default constructor.

~CSVWriter() = default

Default destructor.

CSVWriter(const CSVWriter&) = default
CSVWriter &operator=(const CSVWriter&) = default
CSVWriter(CSVWriter&&) = default
CSVWriter &operator=(CSVWriter&&) = default
void setFilename(const std::string &filename)

filename setter

std::string getFilename() const

filename getter

void setDelimeter(const std::string &delimeter)

delimeter setter

std::string getDelimeter() const

delimeter getter

void setLineCount(const int line_count)

line_count setter

int getLineCount() const

line_count getter

template<typename T>
inline std::optional<size_t> writeDataInRow(T first, T last)

This Function accepts a range and appends all the elements in the range to the last row, seperated by delimeter (Default is comma)

Parameters
  • first – Iterator to the first element

  • last – Iterator to the last element