summaryrefslogtreecommitdiffhomepage
path: root/csv/csv.h
blob: 7ae1ad5c8cba57c78914c83e16f2d98691b39efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include <QtGlobal>
#include <QObject>
#include <QStringList>
#include <QIODevice>
#include <QTextCodec>
#include <QRegExp>
#include <QtGlobal>

#ifdef BUILD_opentrack_csv
#   define CSV_EXPORT Q_DECL_EXPORT
#else
#   define CSV_EXPORT Q_DECL_IMPORT
#endif

class CSV_EXPORT CSV
{
public:
    QString readLine();
    QStringList parseLine();
    static QStringList parseLine(QString line);

    void setCodec(const char* codecName);
    static bool getGameData(const int gameID, unsigned char* table, QString& gamename);
private:
    QIODevice *m_device;
    QTextCodec *m_codec;
    QString m_string;
    int m_pos;
    QRegExp m_rx;
    CSV(QIODevice * device);
    CSV(QString &string);
};