• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

  • libtdegames
  • highscore
khighscore.h
1/*
2 This file is part of the TDE games library
3 Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
4 Copyright (C) 2003 Nicolas Hadacek <hadacek@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
9
10 This library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20/*
21 $Id$
22*/
23#ifndef __KHIGHSCORE_H__
24#define __KHIGHSCORE_H__
25
26#include <tqstring.h>
27#include <tqobject.h>
28#include <tdemacros.h>
29class TDEConfig;
30class KFileLock;
31class KRawConfig;
32class KHighscorePrivate;
33
84class TDE_EXPORT KHighscore : public TQObject
85{
86 TQ_OBJECT
87
88public:
93 KHighscore(TQObject* parent = 0);
94
104 KHighscore(bool forceLocal, TQObject *parent);
105
112 void readCurrentConfig();
113
124 static void init(const char *appname);
125
141 bool lockForWriting(TQWidget *widget = 0);
142
149 void writeAndUnlock();
150
156 bool isLocked() const;
157
162 ~KHighscore();
163
171 void writeEntry(int entry, const TQString& key, const TQString& value);
172
177 void writeEntry(int entry, const TQString& key, int value);
178
184 void writeEntry(int entry, const TQString& key, const TQVariant &value);
185
197 TQString readEntry(int entry, const TQString& key, const TQString& pDefault = TQString()) const;
198
210 int readNumEntry(int entry, const TQString& key, int pDefault = -1) const;
211
219 TQVariant readPropertyEntry(int entry, const TQString &key, const TQVariant &pDefault) const;
220
225 bool hasEntry(int entry, const TQString& key) const;
226
244 TQStringList readList(const TQString& key, int lastEntry = 20) const;
245
257 void writeList(const TQString& key, const TQStringList& list);
258
266 bool hasTable() const;
267
271 void sync();
272
280 void setHighscoreGroup(const TQString& groupname = TQString());
281
287 const TQString& highscoreGroup() const;
288
289protected:
294 TQString group() const;
295
301 TDEConfig* config() const;
302
303 void init(bool forceLocal);
304
305private:
306 KHighscorePrivate* d;
307
308 static KFileLock *_lock; // lock on system-wide highscore file
309 static KRawConfig *_config; // config for system-wide highscore file
310};
311
312#endif
KHighscore::lockForWriting
bool lockForWriting(TQWidget *widget=0)
Definition khighscore.cpp:114
KHighscore::sync
void sync()
Definition khighscore.cpp:257
KHighscore::group
TQString group() const
Definition khighscore.cpp:246
KHighscore::readEntry
TQString readEntry(int entry, const TQString &key, const TQString &pDefault=TQString()) const
Reads an entry from the highscore table.
Definition khighscore.cpp:199
KHighscore::config
TDEConfig * config() const
Definition khighscore.cpp:163
KHighscore::isLocked
bool isLocked() const
Definition khighscore.cpp:85
KHighscore::readList
TQStringList readList(const TQString &key, int lastEntry=20) const
Reads a list of entries from the highscore table starting at 1 until lastEntry.
Definition khighscore.cpp:220
KHighscore::writeList
void writeList(const TQString &key, const TQStringList &list)
Writes a list of entries to the highscore table.
Definition khighscore.cpp:229
KHighscore::readPropertyEntry
TQVariant readPropertyEntry(int entry, const TQString &key, const TQVariant &pDefault) const
Read a TQVariant entry.
Definition khighscore.cpp:192
KHighscore::writeEntry
void writeEntry(int entry, const TQString &key, const TQString &value)
Definition khighscore.cpp:184
KHighscore::hasTable
bool hasTable() const
Definition khighscore.cpp:254
KHighscore::highscoreGroup
const TQString & highscoreGroup() const
Definition khighscore.cpp:241
KHighscore::KHighscore
KHighscore(TQObject *parent=0)
Definition khighscore.cpp:59
KHighscore::writeAndUnlock
void writeAndUnlock()
Definition khighscore.cpp:143
KHighscore::readNumEntry
int readNumEntry(int entry, const TQString &key, int pDefault=-1) const
Read a numeric value.
Definition khighscore.cpp:206
KHighscore::init
static void init(const char *appname)
Definition khighscore.cpp:95
KHighscore::readCurrentConfig
void readCurrentConfig()
Definition khighscore.cpp:90
KHighscore::hasEntry
bool hasEntry(int entry, const TQString &key) const
Definition khighscore.cpp:213
KHighscore::setHighscoreGroup
void setHighscoreGroup(const TQString &groupname=TQString())
Set the new highscore group.
Definition khighscore.cpp:236

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.15.0
This website is maintained by Timothy Pearson.