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
781 B
C++
41 lines
781 B
C++
#ifndef CSVIMPORTER_H
|
|
#define CSVIMPORTER_H
|
|
|
|
#include "iimporter.h"
|
|
#include <QStringList>
|
|
#include <QObject>
|
|
|
|
class CsvImporter : public QObject, public IImporter
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit CsvImporter(const QMetaObject *metaObject, QObject *parent = NULL);
|
|
|
|
// IImporter interface
|
|
public:
|
|
void setImportFile(const QString &fileName);
|
|
int recordCount();
|
|
QSharedPointer<QObject> nextRecord();
|
|
bool isError();
|
|
|
|
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
|