• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kgoldrunner

  • sources
  • kde-4.14
  • kdegames
  • kgoldrunner
  • src
kgrgameio.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright 2006 Ian Wadham <iandw.au@gmail.com> *
3  * Copyright 2009 Ian Wadham <iandw.au@gmail.com> *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ****************************************************************************/
18 
19 #ifndef KGRGAMEIO_H
20 #define KGRGAMEIO_H
21 
22 #include "kgrglobals.h"
23 
24 #include <QFile>
25 
26 class QWidget;
27 
29 enum IOStatus {OK, NotFound, NoRead, NoWrite, UnexpectedEOF};
30 
58 class KGrGameIO : public QObject
59 {
60  Q_OBJECT
61 public:
67  KGrGameIO (QWidget * pView);
68 
72  IOStatus fetchGameListData (const Owner o, const QString & dir,
73  QList<KGrGameData *> & gameList,
74  QString & filePath);
75 
79  bool readLevelData (const QString & dir, const QString & prefix,
80  const int levelNo, KGrLevelData & d);
81 
86  IOStatus fetchLevelData (const QString & dir, const QString & prefix,
87  const int level, KGrLevelData & d,
88  QString & filePath);
89 
90  /*
91  * Rename a file, first removing any existing file that has the target name.
92  */
93  static bool safeRename (QWidget * theView, const QString & oldName,
94  const QString & newName);
95 
96 private:
97  QWidget * view;
98 
99  QFile openFile;
100 
101  QString getFilePath (const QString & dir,
102  const QString & prefix, const int level);
103  char getALine (const bool kgr3, QByteArray & line);
104  QByteArray removeNewline (const QByteArray & line);
105  KGrGameData * initGameData (Owner o);
106 };
107 
108 #endif // KGRGAMEIO_H
QWidget
UnexpectedEOF
Definition: kgrgameio.h:29
KGrGameIO
The KGrGameIO class handles I/O for text-files containing KGoldrunner games and levels.
Definition: kgrgameio.h:58
NotFound
Definition: kgrgameio.h:29
KGrGameIO::KGrGameIO
KGrGameIO(QWidget *pView)
Default constructor.
Definition: kgrgameio.cpp:27
KGrGameData
KGrGameData structure: contains attributes of a KGoldrunner game.
Definition: kgrglobals.h:88
QByteArray
KGrGameIO::fetchGameListData
IOStatus fetchGameListData(const Owner o, const QString &dir, QList< KGrGameData * > &gameList, QString &filePath)
Find and read data for games, into a list of KGrGameData structures.
Definition: kgrgameio.cpp:34
KGrGameIO::fetchLevelData
IOStatus fetchLevelData(const QString &dir, const QString &prefix, const int level, KGrLevelData &d, QString &filePath)
Find and read data for a level of a game, into a KGrLevelData structure.
Definition: kgrgameio.cpp:182
QFile
NoWrite
Definition: kgrgameio.h:29
KGrGameIO::readLevelData
bool readLevelData(const QString &dir, const QString &prefix, const int levelNo, KGrLevelData &d)
Find and read data for a level of a game.
Definition: kgrgameio.cpp:151
QObject
KGrLevelData
KGrLevelData structure: contains attributes of a KGoldrunner level.
Definition: kgrglobals.h:103
QString
QList< KGrGameData * >
NoRead
Definition: kgrgameio.h:29
IOStatus
IOStatus
Return values from I/O operations.
Definition: kgrgameio.h:29
kgrglobals.h
OK
Definition: kgrgameio.h:29
KGrGameIO::safeRename
static bool safeRename(QWidget *theView, const QString &oldName, const QString &newName)
Definition: kgrgameio.cpp:356
Owner
Owner
Definition: kgrglobals.h:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:24 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal