• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kgoldrunner

kgrgameio.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  Copyright (C) 2006 by Ian Wadham
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public
00015  *  License along with this library; if not, write to the
00016  *  Free Software Foundation, Inc., 
00017  *  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018  ***************************************************************************/
00019 
00020 
00021 #ifndef _KGRGAMEIO_H_
00022 #define _KGRGAMEIO_H_
00023 
00024 #include <QByteArray>
00025 #include <QFile>
00026 
00027 #include "kgrconsts.h"
00028 
00030 enum IOStatus {OK, NotFound, NoRead, NoWrite, UnexpectedEOF};
00031 
00033 typedef struct {
00034     QString filePath;   
00035     Owner   owner;      
00036     int         nLevels;    
00037     char        rules;      
00038     QString     prefix;     
00039     char        skill;      
00040     QByteArray  name;       
00041     QByteArray  about;      
00042 } GameData;
00043 
00045 typedef struct {
00046     QString filePath;   
00047     int     level;      
00048     QByteArray  layout;     
00049     QByteArray  name;       
00050     QByteArray  hint;       
00051 } LevelData;
00052 
00080 class KGrGameIO : public QObject
00081 {
00082     Q_OBJECT
00083 public:
00087     KGrGameIO();
00088 
00092     IOStatus fetchGameListData (const QString & dir,
00093                                 QList<GameData *> & gameList);
00097     IOStatus fetchLevelData (const QString & dir, const QString & prefix,
00098                                 const int level, LevelData & d);
00099 
00100 private:
00101     QFile       openFile;
00102 
00103     QString     getFilePath (const QString & dir,
00104                                 const QString & prefix, const int level);
00105     char        getALine (const bool kgr3, QByteArray & line);
00106     QByteArray      removeNewline (const QByteArray & line);
00107     GameData *      initGameData (const QString & filePath);
00108 };
00109 
00110 #endif // _KGRGAMEIO_H_

kgoldrunner

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

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal