moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / ksfilereader.h
blob25c56b96441781327dd230889892a9742cd5ba27
1 /***************************************************************************
2 ksfilereader.h - description
3 -------------------
4 begin : Tue Jan 28 2003
5 copyright : (C) 2003 by Heiko Evermann
6 email : heiko@evermann.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef KSFILEREADER_H
19 #define KSFILEREADER_H
21 #include <qobject.h>
22 #include <qstringlist.h>
24 /**@class KSFileReader
25 *This class will read an entire file into a QStringList, where each item
26 *in the list is a line in the file. It can then access each line in the
27 *list very quickly.
28 *@author Heiko Evermann
29 *@version 1.0
32 class QFile;
33 class QString;
35 class KSFileReader : public QObject {
36 Q_OBJECT
37 public:
38 /**Constructor. Read an entire file into a QStringList object.
39 *@p file the file to be read
41 KSFileReader( QFile& file);
43 /**Destructor*/
44 ~KSFileReader();
46 /**@return TRUE if we are not yet at the end of the file.
48 bool hasMoreLines();
50 /**Read a line from the file, and increment the "current line" counter.
51 *@return the line that we read, as a QString.
53 QString& readLine();
55 /**Go to a specific line in the file.
56 *@p i the line number to skip to.
58 bool setLine(int i);
60 private:
61 /** After loading the whole file, we split it into lines and keep them here. */
62 QStringList lines;
63 /** How many lines do we have in the file? */
64 int numLines;
65 /** Which line are we at? */
66 int curLine;
69 #endif