File indexing completed on 2024-06-16 04:16:52
0001 /* 0002 * SPDX-FileCopyrightText: 2016 Laszlo Fazekas <mneko@freemail.hu> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CSV_READ_LINE_H_ 0008 #define CSV_READ_LINE_H_ 0009 0010 #include <QString> 0011 #include <QIODevice> 0012 #include <QByteArray> 0013 0014 #include "csv_layer_record.h" 0015 0016 /* The .png file names are within 20 characters, only the layer 0017 * names can be longer. If the length exceeds this, it will be 0018 * truncated. 0019 */ 0020 #define CSV_FIELD_MAX 50 0021 0022 class CSVReadLine 0023 { 0024 0025 public: 0026 CSVReadLine(); 0027 ~CSVReadLine(); 0028 0029 int nextLine(QIODevice* io); 0030 QString nextField(); 0031 void rewind(); 0032 0033 private: 0034 0035 QString splitNext(int* pos); 0036 bool setLayer(CSVLayerRecord* ); 0037 bool readFrame(int* pos); 0038 bool finalize(); 0039 int readImpl(QIODevice* io); 0040 0041 char m_separator; 0042 int m_row; 0043 QByteArray m_linebuf; 0044 int m_pos; 0045 }; 0046 0047 #endif