Changeset View
Changeset View
Standalone View
Standalone View
plugins/impex/csv/csv_read_line.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (c) 2016 Laszlo Fazekas <mneko@freemail.hu> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | * Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #ifndef CSV_READ_LINE_H_ | ||||
21 | #define CSV_READ_LINE_H_ | ||||
22 | | ||||
23 | #include <QString> | ||||
24 | #include <QIODevice> | ||||
25 | #include <QByteArray> | ||||
26 | | ||||
27 | #include "csv_layer_record.h" | ||||
28 | | ||||
29 | /* The .png file names are within 20 characters, only the layer | ||||
30 | * names can be longer. If the length exceeds this, it will be | ||||
31 | * truncated. | ||||
32 | */ | ||||
33 | #define CSV_FIELD_MAX 50 | ||||
34 | | ||||
35 | class CSVReadLine | ||||
36 | { | ||||
37 | | ||||
38 | public: | ||||
39 | CSVReadLine(); | ||||
40 | ~CSVReadLine(); | ||||
41 | | ||||
42 | int nextLine(QIODevice* io); | ||||
43 | QString nextField(); | ||||
44 | void rewind(); | ||||
45 | | ||||
46 | private: | ||||
47 | | ||||
48 | QString splitNext(int* pos); | ||||
49 | bool setLayer(CSVLayerRecord* ); | ||||
50 | bool readFrame(int* pos); | ||||
51 | bool finalize(); | ||||
52 | int readImpl(QIODevice* io); | ||||
53 | | ||||
54 | char m_separator; | ||||
55 | int m_row; | ||||
56 | QByteArray m_linebuf; | ||||
57 | int m_pos; | ||||
58 | }; | ||||
59 | | ||||
60 | #endif |