kgamepropertyhandler.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __KGAMEPROPERTYHANDLER_H_
00022 #define __KGAMEPROPERTYHANDLER_H_
00023
00024 #include <qobject.h>
00025 #include <qintdict.h>
00026
00027 #include "kgameproperty.h"
00028 #include <kdemacros.h>
00029
00030 class QDataStream;
00031 class KGame;
00032 class KPlayer;
00033
00034
00035 class KGamePropertyHandlerPrivate;
00036
00072 class KDE_EXPORT KGamePropertyHandler : public QObject
00073 {
00074 Q_OBJECT
00075
00076 public:
00083 KGamePropertyHandler(QObject* parent = 0);
00084
00090 KGamePropertyHandler(int id, const QObject* receiver, const char* sendf, const char* emitf, QObject* parent = 0);
00091 ~KGamePropertyHandler();
00092
00104 void registerHandler(int id, const QObject *receiver, const char * send, const char *emit);
00105
00121 bool processMessage(QDataStream &stream, int id, bool isSender );
00122
00126 int id() const;
00127
00135 bool addProperty(KGamePropertyBase *data, QString name=0);
00136
00142 bool removeProperty(KGamePropertyBase *data);
00143
00150 int uniquePropertyId();
00151
00152
00159 virtual bool load(QDataStream &stream);
00160
00167 virtual bool save(QDataStream &stream);
00168
00174 bool sendProperty(QDataStream &s);
00175
00176 void sendLocked(bool l);
00177
00183 void emitSignal(KGamePropertyBase *data);
00184
00191 QString propertyName(int id) const;
00192
00197 KGamePropertyBase *find(int id);
00198
00212 void clear();
00213
00218 void setId(int id);
00219
00224 void unlockProperties();
00225
00234 void setPolicy(KGamePropertyBase::PropertyPolicy p, bool userspace=true);
00235
00246 void lockDirectEmit();
00247
00252 void unlockDirectEmit();
00253
00258 KGamePropertyBase::PropertyPolicy policy();
00259
00269 void lockProperties();
00270
00275 void flush();
00276
00280 QIntDict<KGamePropertyBase> &dict() const;
00281
00294 QString propertyValue(KGamePropertyBase* property);
00295
00296
00300 void Debug();
00301
00302
00303 signals:
00314 void signalPropertyChanged(KGamePropertyBase *);
00315
00323 void signalSendMessage(int msgid, QDataStream &, bool* sent);
00324
00344 void signalRequestValue(KGamePropertyBase* property, QString& value);
00345
00346 private:
00347 void init();
00348
00349 private:
00350 KGamePropertyHandlerPrivate* d;
00351 };
00352
00353 #endif
|