Go to the documentation of this file.00001
00022 #ifndef DGVFILE_H
00023 #define DGVFILE_H
00024
00025 #include "DGVAliases.h"
00026
00027 #include <QFile>
00028 #include <QTextStream>
00029 #include <QStringList>
00030
00040 class DGV_EXPORT DGVFile
00041 {
00042 public:
00047 DGVFile();
00054 DGVFile(QString name, QString mode);
00055 virtual ~DGVFile();
00056
00061 bool open(QString name, QString mode);
00066 void close();
00067
00072 void writeLine(QString data);
00077 void writeIntegerArrayAsLine(Array<long,1> &data);
00082 void writeDoubleArrayAsLine(Array<double,1> &data);
00087 void writeComment(QString comment);
00088
00089
00090
00091
00097 QString readNextString();
00103 long readNextInteger();
00109 double readNextDouble();
00115 inline QStringList readLine()
00116 { return readNextLine(); }
00121 QStringList readNextLine();
00126 void readNextLineAsIntegers(Array<long,1> &values);
00131 void readNextLineAsDoubles(Array<double,1> &values);
00132
00137 inline void setSeparator(QString symbol)
00138 { separator = symbol; }
00143 inline void setCommentSymbol(QString symbol)
00144 { commentSymbol = symbol; }
00149 inline void ignoreComments(bool ignore)
00150 { comments = ignore; }
00151
00156 bool atEnd();
00161 inline void setVerboseMode(bool verbose)
00162 { verboseMode = verbose; }
00163
00164 protected:
00165 QString commentSymbol;
00166 QString separator;
00167 bool comments;
00168 bool openedIn;
00169 bool openedOut;
00170 bool openedAppend;
00171 bool verboseMode;
00172 QString fileName;
00173 QString fileMode;
00174
00175 QFile file;
00176 QTextStream *in;
00177 QTextStream *out;
00178 QTextStream *append;
00179 };
00180
00181 #endif // DGVFILE_H