You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
838 B
C++
41 lines
838 B
C++
#ifndef CSVIMPORTER_H
|
|
#define CSVIMPORTER_H
|
|
|
|
#include "iimporter.h"
|
|
#include <QStringList>
|
|
#include <QObject>
|
|
|
|
class CORESHARED_EXPORT CsvImporter : public QObject, public IImporter
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit CsvImporter(const QMetaObject *metaObject, QObject *parent = nullptr);
|
|
|
|
// IImporter interface
|
|
public:
|
|
void setImportFile(const QString &fileName) override;
|
|
int recordCount() override;
|
|
QSharedPointer<QObject> nextRecord() override;
|
|
bool isError() override;
|
|
|
|
void setSeparator(const QString &separator);
|
|
|
|
signals:
|
|
void parseError();
|
|
void noSuchProperty(QString propName);
|
|
|
|
private:
|
|
void parseFile();
|
|
|
|
QString m_header;
|
|
QString m_separator;
|
|
QString m_fileName;
|
|
QStringList m_lines;
|
|
bool m_parsed;
|
|
bool m_error;
|
|
int m_currentRec;
|
|
};
|
|
|
|
#endif // CSVIMPORTER_H
|