libkdegames Library API Documentation

khighscore.h

00001 /* 00002 This file is part of the KDE games library 00003 Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de) 00004 Copyright (C) 2003 Nicolas Hadacek <hadacek@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 /* 00021 $Id: khighscore.h,v 1.9 2003/10/12 13:32:56 bhards Exp $ 00022 */ 00023 #ifndef __KHIGHSCORE_H__ 00024 #define __KHIGHSCORE_H__ 00025 00026 #include <qstring.h> 00027 #include <qobject.h> 00028 00029 class KConfig; 00030 class KFileLock; 00031 class KRawConfig; 00032 class KHighscorePrivate; 00033 00084 class KHighscore : public QObject 00085 { 00086 Q_OBJECT 00087 public: 00092 KHighscore(QObject* parent = 0); 00093 00103 KHighscore(bool forceLocal, QObject *parent); 00104 00111 void readCurrentConfig(); 00112 00123 static void init(const char *appname); 00124 00140 bool lockForWriting(QWidget *widget = 0); 00141 00148 void writeAndUnlock(); 00149 00155 bool isLocked() const; 00156 00161 ~KHighscore(); 00162 00170 void writeEntry(int entry, const QString& key, const QString& value); 00171 00176 void writeEntry(int entry, const QString& key, int value); 00177 00183 void writeEntry(int entry, const QString& key, const QVariant &value); 00184 00196 QString readEntry(int entry, const QString& key, const QString& pDefault = QString::null) const; 00197 00209 int readNumEntry(int entry, const QString& key, int pDefault = -1) const; 00210 00218 QVariant readPropertyEntry(int entry, const QString &key, const QVariant &pDefault) const; 00219 00224 bool hasEntry(int entry, const QString& key) const; 00225 00243 QStringList readList(const QString& key, int lastEntry = 20) const; 00244 00256 void writeList(const QString& key, const QStringList& list); 00257 00265 bool hasTable() const; 00266 00270 void sync(); 00271 00279 void setHighscoreGroup(const QString& groupname = QString::null); 00280 00286 const QString& highscoreGroup() const; 00287 00288 protected: 00293 QString group() const; 00294 00300 KConfig* config() const; 00301 00302 void init(bool forceLocal); 00303 00304 private: 00305 KHighscorePrivate* d; 00306 00307 static KFileLock *_lock; // lock on system-wide highscore file 00308 static KRawConfig *_config; // config for system-wide highscore file 00309 }; 00310 00311 #endif
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 21 12:08:03 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003