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

libkdegames/kgame

kgamepropertyhandler.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
00004     Copyright (C) 2001 Martin Heni (kde at heni-online.de)
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., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef __KGAMEPROPERTYHANDLER_H_
00022 #define __KGAMEPROPERTYHANDLER_H_
00023 
00024 #include <QtCore/QObject>
00025 #include <QtCore/QMultiHash>
00026 
00027 #include "kgameproperty.h"
00028 #include <libkdegames_export.h>
00029 
00030 class QDataStream;
00031 class KGame;
00032 //class KGamePropertyBase;
00033 
00034 class KGamePropertyHandlerPrivate; // wow - what a name ;-)
00035 
00073 class KDEGAMES_EXPORT KGamePropertyHandler : public QObject
00074 {
00075     Q_OBJECT
00076 
00077 public:
00084     KGamePropertyHandler(QObject* parent = 0);
00085 
00091     KGamePropertyHandler(int id, const QObject* receiver, const char* sendf, const char* emitf, QObject* parent = 0);
00092     ~KGamePropertyHandler();
00093 
00105     void registerHandler(int id, const QObject *receiver, const char * send, const char *emit); 
00106 
00122     bool processMessage(QDataStream &stream, int id, bool isSender );
00123     
00127     int id() const;
00128     
00136     bool addProperty(KGamePropertyBase *data, const QString& name=QString());
00137 
00143     bool removeProperty(KGamePropertyBase *data);
00144 
00151     int uniquePropertyId();
00152 
00153 
00160     virtual bool load(QDataStream &stream);
00161 
00168     virtual bool save(QDataStream &stream);
00169     
00175     bool sendProperty(QDataStream &s);
00176 
00177     void sendLocked(bool l);
00178 
00184     void emitSignal(KGamePropertyBase *data);
00185 
00192     QString propertyName(int id) const;
00193 
00198     KGamePropertyBase *find(int id);
00199 
00213     void clear();
00214 
00219     void setId(int id);//AB: TODO: make this protected in KGamePropertyHandler!!
00220 
00225     void unlockProperties();
00226 
00235     void setPolicy(KGamePropertyBase::PropertyPolicy p, bool userspace=true);
00236 
00247     void lockDirectEmit();
00248 
00253     void unlockDirectEmit();
00254   
00259     KGamePropertyBase::PropertyPolicy policy();
00260 
00270     void lockProperties();
00271 
00276     void flush();
00277 
00281         QMultiHash<int, KGamePropertyBase*> &dict() const; 
00282 
00295     QString propertyValue(KGamePropertyBase* property);
00296 
00297 
00301     void Debug();
00302 
00303 
00304 Q_SIGNALS:
00315     void signalPropertyChanged(KGamePropertyBase *);
00316 
00324     void signalSendMessage(int msgid, QDataStream &, bool* sent); // AB shall we change bool* into bool& again?
00325 
00345     void signalRequestValue(KGamePropertyBase* property, QString& value);
00346 
00347 private:
00348     friend class KGamePropertyHandlerPrivate;
00349     KGamePropertyHandlerPrivate *const d;
00350 
00351     Q_DISABLE_COPY(KGamePropertyHandler)
00352 };
00353 
00354 #endif

libkdegames/kgame

Skip menu "libkdegames/kgame"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

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