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

libtdegames

  • libtdegames
  • kgame
kgamepropertyhandler.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) 2001 Martin Heni (martin@heni-online.de)
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#ifndef __KGAMEPROPERTYHANDLER_H_
22#define __KGAMEPROPERTYHANDLER_H_
23
24#include <tqobject.h>
25#include <tqintdict.h>
26
27#include "kgameproperty.h"
28#include <tdemacros.h>
29
30class TQDataStream;
31class KGame;
32class KPlayer;
33//class KGamePropertyBase;
34
35class KGamePropertyHandlerPrivate; // wow - what a name ;-)
36
72class TDE_EXPORT KGamePropertyHandler : public TQObject
73{
74 TQ_OBJECT
75
76
77public:
84 KGamePropertyHandler(TQObject* parent = 0);
85
91 KGamePropertyHandler(int id, const TQObject* receiver, const char* sendf, const char* emitf, TQObject* parent = 0);
92 ~KGamePropertyHandler();
93
105 void registerHandler(int id, const TQObject *receiver, const char * send, const char *emit);
106
122 bool processMessage(TQDataStream &stream, int id, bool isSender );
123
127 int id() const;
128
136 bool addProperty(KGamePropertyBase *data, TQString name=0);
137
143 bool removeProperty(KGamePropertyBase *data);
144
151 int uniquePropertyId();
152
153
160 virtual bool load(TQDataStream &stream);
161
168 virtual bool save(TQDataStream &stream);
169
175 bool sendProperty(TQDataStream &s);
176
177 void sendLocked(bool l);
178
184 void emitSignal(KGamePropertyBase *data);
185
192 TQString propertyName(int id) const;
193
198 KGamePropertyBase *find(int id);
199
213 void clear();
214
219 void setId(int id);//AB: TODO: make this protected in KGamePropertyHandler!!
220
225 void unlockProperties();
226
235 void setPolicy(KGamePropertyBase::PropertyPolicy p, bool userspace=true);
236
247 void lockDirectEmit();
248
253 void unlockDirectEmit();
254
259 KGamePropertyBase::PropertyPolicy policy();
260
270 void lockProperties();
271
276 void flush();
277
281 TQIntDict<KGamePropertyBase> &dict() const;
282
295 TQString propertyValue(KGamePropertyBase* property);
296
297
301 void Debug();
302
303
304signals:
315 void signalPropertyChanged(KGamePropertyBase *);
316
324 void signalSendMessage(int msgid, TQDataStream &, bool* sent); // AB shall we change bool* into bool& again?
325
345 void signalRequestValue(KGamePropertyBase* property, TQString& value);
346
347private:
348 void init();
349
350private:
351 KGamePropertyHandlerPrivate* d;
352};
353
354#endif
KGamePropertyBase
Base class of KGameProperty.
Definition kgameproperty.h:43
KGamePropertyBase::PropertyPolicy
PropertyPolicy
The policy of the property.
Definition kgameproperty.h:110
KGamePropertyHandler::setId
void setId(int id)
Use id as new ID for this KGamePropertyHandler.
Definition kgamepropertyhandler.cpp:88
KGamePropertyHandler::propertyValue
TQString propertyValue(KGamePropertyBase *property)
In several situations you just want to have a TQString of a KGameProperty object.
Definition kgamepropertyhandler.cpp:354
KGamePropertyHandler::load
virtual bool load(TQDataStream &stream)
Loads properties from the datastream.
Definition kgamepropertyhandler.cpp:188
KGamePropertyHandler::setPolicy
void setPolicy(KGamePropertyBase::PropertyPolicy p, bool userspace=true)
Set the policy for all kgame variables which are currently registerd in the KGame proeprty handler.
Definition kgamepropertyhandler.cpp:232
KGamePropertyHandler::lockProperties
void lockProperties()
Calls KGamePropertyBase::setReadOnly(true) for all properties of this handler.
Definition kgamepropertyhandler.cpp:255
KGamePropertyHandler::signalSendMessage
void signalSendMessage(int msgid, TQDataStream &, bool *sent)
This signal is emitted when a property needs to be sent.
KGamePropertyHandler::uniquePropertyId
int uniquePropertyId()
returns a unique property ID starting called usually with a base of KGamePropertyBase::IdAutomatic.
Definition kgamepropertyhandler.cpp:264
KGamePropertyHandler::removeProperty
bool removeProperty(KGamePropertyBase *data)
Removes a property from the handler.
Definition kgamepropertyhandler.cpp:142
KGamePropertyHandler::flush
void flush()
Sends all properties which are marked dirty over the network.
Definition kgamepropertyhandler.cpp:269
KGamePropertyHandler::dict
TQIntDict< KGamePropertyBase > & dict() const
Reference to the internal dictionary.
Definition kgamepropertyhandler.cpp:349
KGamePropertyHandler::unlockProperties
void unlockProperties()
Calls KGamePropertyBase::setReadOnly(false) for all properties of this player.
Definition kgamepropertyhandler.cpp:246
KGamePropertyHandler::signalRequestValue
void signalRequestValue(KGamePropertyBase *property, TQString &value)
If you call propertyValue with a non-standard KGameProperty it is possible that the value cannot auto...
KGamePropertyHandler::unlockDirectEmit
void unlockDirectEmit()
Removes the lock from the emitting of property signals.
Definition kgamepropertyhandler.cpp:288
KGamePropertyHandler::find
KGamePropertyBase * find(int id)
Definition kgamepropertyhandler.cpp:329
KGamePropertyHandler::registerHandler
void registerHandler(int id, const TQObject *receiver, const char *send, const char *emit)
Register the handler with a parent.
Definition kgamepropertyhandler.cpp:93
KGamePropertyHandler::lockDirectEmit
void lockDirectEmit()
Called by the KGame or KPlayer object or the handler itself to delay emmiting of signals.
Definition kgamepropertyhandler.cpp:283
KGamePropertyHandler::sendProperty
bool sendProperty(TQDataStream &s)
called by a property to send itself into the datastream.
Definition kgamepropertyhandler.cpp:322
KGamePropertyHandler::clear
void clear()
Clear the KGamePropertyHandler.
Definition kgamepropertyhandler.cpp:334
KGamePropertyHandler::save
virtual bool save(TQDataStream &stream)
Saves properties into the datastream.
Definition kgamepropertyhandler.cpp:210
KGamePropertyHandler::processMessage
bool processMessage(TQDataStream &stream, int id, bool isSender)
Main message process function.
Definition kgamepropertyhandler.cpp:106
KGamePropertyHandler::emitSignal
void emitSignal(KGamePropertyBase *data)
called by a property to emit a signal This call is simply forwarded to the parent object
Definition kgamepropertyhandler.cpp:303
KGamePropertyHandler::signalPropertyChanged
void signalPropertyChanged(KGamePropertyBase *)
This is emitted by a property.
KGamePropertyHandler::Debug
void Debug()
Writes some debug output to the console.
Definition kgamepropertyhandler.cpp:387
KGamePropertyHandler::propertyName
TQString propertyName(int id) const
Definition kgamepropertyhandler.cpp:172
KGamePropertyHandler::KGamePropertyHandler
KGamePropertyHandler(TQObject *parent=0)
Construct an unregistered KGamePropertyHandler.
Definition kgamepropertyhandler.cpp:60
KGamePropertyHandler::policy
KGamePropertyBase::PropertyPolicy policy()
Returns the default policy for this property handler.
Definition kgamepropertyhandler.cpp:227
KGamePropertyHandler::id
int id() const
Definition kgamepropertyhandler.cpp:83
KGamePropertyHandler::addProperty
bool addProperty(KGamePropertyBase *data, TQString name=0)
Adds a KGameProperty property to the handler.
Definition kgamepropertyhandler.cpp:151
KGame
The main KDE game object.
Definition kgame.h:63
KPlayer
Base class for a game player.
Definition kplayer.h:70

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.