2017-01-13 19:09:58 +01:00
|
|
|
|
#ifndef CSVWRITER_H
|
|
|
|
|
|
#define CSVWRITER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <ostream>
|
2024-04-12 06:27:23 +02:00
|
|
|
|
#include <QString>
|
2017-02-04 11:53:20 +01:00
|
|
|
|
#include <QTextStream>
|
2017-01-13 19:09:58 +01:00
|
|
|
|
|
|
|
|
|
|
class CsvWriter {
|
|
|
|
|
|
public:
|
|
|
|
|
|
CsvWriter();
|
2017-02-04 11:53:20 +01:00
|
|
|
|
explicit CsvWriter(QTextStream *output);
|
|
|
|
|
|
void setDestination(QTextStream *output);
|
2017-01-13 19:09:58 +01:00
|
|
|
|
void setSeperator(QChar ch);
|
2017-02-04 11:53:20 +01:00
|
|
|
|
void setQuote(QChar ch);
|
2017-01-13 19:09:58 +01:00
|
|
|
|
void writeField(QString field);
|
2017-02-04 11:53:20 +01:00
|
|
|
|
void nextRow();
|
2017-01-13 19:09:58 +01:00
|
|
|
|
private:
|
|
|
|
|
|
QChar m_seperator = ',';
|
2017-02-04 11:53:20 +01:00
|
|
|
|
QChar m_quote = '"';
|
|
|
|
|
|
QTextStream *m_output = nullptr;
|
|
|
|
|
|
int m_column = 0;
|
2017-01-13 19:09:58 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CSVWRITER_H
|