#include <kgameproperty.h>
Inheritance diagram for KGamePropertyBase:


Public Types | |
| enum | PropertyDataIds { IdGroup = 1, IdUserId = 2, IdAsyncInput = 3, IdTurn = 4, IdName = 5, IdGameStatus = 6, IdMaxPlayer = 7, IdMinPlayer = 8, IdGrabInput = 16, IdReleaseInput = 17, IdCommand, IdUser = 256, IdAutomatic = 0x7000 } |
| enum | PropertyCommandIds { CmdLock = 1, CmdAt = 51, CmdResize = 52, CmdFill = 53, CmdSort = 54, CmdInsert = 61, CmdAppend = 62, CmdRemove = 63, CmdClear = 64 } |
| Commands for advanced properties (Q_INT8). More... | |
| enum | PropertyPolicy { PolicyUndefined = 0, PolicyClean = 1, PolicyDirty = 2, PolicyLocal = 3 } |
| The policy of the property. More... | |
Public Member Functions | |
| KGamePropertyBase (int id, KGamePropertyHandler *owner) | |
| Constructs a KGamePropertyBase object and calls registerData. | |
| KGamePropertyBase (int id, KGame *parent) | |
| KGamePropertyBase (int id, KPlayer *parent) | |
| KGamePropertyBase () | |
| Creates a KGamePropertyBase object without an owner. | |
| virtual | ~KGamePropertyBase () |
| void | setPolicy (PropertyPolicy p) |
| Changes the consistency policy of a property. | |
| PropertyPolicy | policy () const |
| void | setEmittingSignal (bool p) |
| Sets this property to emit a signal on value changed. | |
| bool | isEmittingSignal () const |
| See also setEmittingSignal. | |
| void | setOptimized (bool p) |
| Sets this property to try to optimize signal and network handling by not sending it out when the property value is not changed. | |
| bool | isOptimized () const |
| See also setOptimize. | |
| bool | isDirty () const |
| bool | isLocked () const |
| A locked property can only be changed by the player who has set the lock. | |
| bool | lock () |
| A locked property can only be changed by the player who has set the lock. | |
| bool | unlock (bool force=false) |
| A locked property can only be changed by the player who has set the lock. | |
| virtual void | load (QDataStream &s)=0 |
| This will read the value of this property from the stream. | |
| virtual void | save (QDataStream &s)=0 |
| Write the value into a stream. | |
| virtual void | command (QDataStream &stream, int msgid, bool isSender=false) |
| send a command to advanced properties like arrays | |
| int | id () const |
| virtual const type_info * | typeinfo () |
| int | registerData (int id, KGamePropertyHandler *owner, PropertyPolicy p, QString name=0) |
| You have to register a KGamePropertyBase before you can use it. | |
| int | registerData (int id, KGamePropertyHandler *owner, QString name=0) |
| This is an overloaded member function, provided for convenience. | |
| int | registerData (int id, KGame *owner, QString name=0) |
| This is an overloaded member function, provided for convenience. | |
| int | registerData (int id, KPlayer *owner, QString name=0) |
| This is an overloaded member function, provided for convenience. | |
| int | registerData (KGamePropertyHandler *owner, PropertyPolicy p=PolicyUndefined, QString name=0) |
| This is an overloaded member function, provided for convenience. | |
| void | unregisterData () |
Protected Member Functions | |
| void | setLock (bool l) |
| A locked property can only be changed by the player who has set the lock. | |
| void | setDirty (bool d) |
| Sets the "dirty" flag of the property. | |
| bool | sendProperty () |
| Forward the data to the owner of this property which then sends it over network. | |
| bool | sendProperty (const QByteArray &b) |
| Forward the data to the owner of this property which then sends it over network. | |
| void | emitSignal () |
| Causes the parent object to emit a signal on value change. | |
Protected Attributes | |
| KGamePropertyHandler * | mOwner |
| KGamePropertyBase::Flags | mFlags |
Friends | |
| class | KGamePropertyHandler |
Classes | |
| union | Flags |
The KGamePropertyBase class is the base class of KGameProperty. See KGameProperty for further information.
Definition at line 42 of file kgameproperty.h.
|
|
Commands for advanced properties (Q_INT8).
Definition at line 71 of file kgameproperty.h. |
|
|
Definition at line 45 of file kgameproperty.h. |
|
|
The policy of the property. This can be PolicyClean (setValue uses send), PolicyDirty (setValue uses changeValue) or PolicyLocal (setValue uses setLocal). A "clean" policy means that the property is always the same on every client. This is achieved by calling send which actually changes the value only when the message from the MessageServer is received. A "dirty" policy means that as soon as setValue is called the property is changed immediately. And additionally sent over network. This can sometimes lead to bugs as the other clients do not immediately have the same value. For more information see changeValue. PolicyLocal means that a KGameProperty behaves like ever "normal" variable. Whenever setValue is called (e.g. using "=") the value of the property is changes immediately without sending it over network. You might want to use this if you are sure that all clients set the property at the same time. Definition at line 109 of file kgameproperty.h. |
|
||||||||||||
|
Constructs a KGamePropertyBase object and calls registerData.
Definition at line 44 of file kgameproperty.cpp. References registerData(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 32 of file kgameproperty.cpp. References registerData(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 38 of file kgameproperty.cpp. References registerData(). Here is the call graph for this function: ![]() |
|
|
Creates a KGamePropertyBase object without an owner. Remember to call registerData! Definition at line 50 of file kgameproperty.cpp. |
|
|
Definition at line 55 of file kgameproperty.cpp. References unregisterData(). Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
send a command to advanced properties like arrays
Reimplemented in KGamePropertyArray< type >, and KGamePropertyList< type >. Definition at line 195 of file kgameproperty.cpp. References KGamePropertyBase::Flags::bits, CmdLock, KGamePropertyBase::Flags::locked, and mFlags. Referenced by KGamePropertyList< type >::command(), KGamePropertyArray< type >::command(), and KGamePropertyHandler::processMessage(). |
|
|
Causes the parent object to emit a signal on value change.
Definition at line 185 of file kgameproperty.cpp. References KGamePropertyHandler::emitSignal(), id(), and mOwner. Referenced by KGameProperty< type >::load(), and KGameProperty< type >::setLocal(). Here is the call graph for this function: ![]() |
|
|
Definition at line 238 of file kgameproperty.h. Referenced by KGamePropertyHandler::addProperty(), KPlayer::emitSignal(), emitSignal(), KGamePropertyHandler::propertyValue(), KGamePropertyHandler::removeProperty(), KGameProperty< type >::setValue(), KGameDialogConnectionConfig::slotPropertyChanged(), KGameDialogGeneralConfig::slotPropertyChanged(), and KGameChat::slotPropertyChanged(). |
|
|
Definition at line 180 of file kgameproperty.h. |
|
|
See also setEmittingSignal.
Definition at line 163 of file kgameproperty.h. Referenced by KGameProperty< type >::load(), and KGameProperty< type >::setLocal(). |
|
|
A locked property can only be changed by the player who has set the lock. See also setLocked
Definition at line 187 of file kgameproperty.h. Referenced by lock(), KGameProperty< type >::send(), KGameProperty< type >::setLocal(), and unlock(). |
|
|
See also setOptimize.
Definition at line 175 of file kgameproperty.h. Referenced by KGameProperty< type >::send(), and KGameProperty< type >::setLocal(). |
|
|
This will read the value of this property from the stream. You MUST overwrite this method in order to use this class
Implemented in KGameProperty< type >, KGamePropertyArray< type >, and KGamePropertyList< type >. |
|
|
A locked property can only be changed by the player who has set the lock. You can only call this if isLocked is false. A message is sent over network so that the property is locked for all players except you.
Definition at line 152 of file kgameproperty.cpp. References isLocked(), and setLock(). Here is the call graph for this function: ![]() |
|
|
Definition at line 150 of file kgameproperty.h. Referenced by KGamePropertyArray< type >::assign(), KGamePropertyArray< type >::duplicate(), KGamePropertyArray< type >::fill(), KGamePropertyHandler::processMessage(), KGamePropertyArray< type >::resize(), KGamePropertyArray< type >::setAt(), KGamePropertyArray< type >::setRawData(), KGameProperty< type >::setValue(), and KGamePropertyArray< type >::sort(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. In particular you can use this function to create properties which will have an automatic id assigned. The new id is returned. Definition at line 85 of file kgameproperty.cpp. References registerData(). Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 82 of file kgameproperty.cpp. References KPlayer::dataHandler(), and registerData(). Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 79 of file kgameproperty.cpp. References KGame::dataHandler(), and registerData(). Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 88 of file kgameproperty.cpp. References PolicyUndefined, and registerData(). Here is the call graph for this function: ![]() |
|
||||||||||||||||||||
|
You have to register a KGamePropertyBase before you can use it. You MUST call this before you can use KGamePropertyBase!
Definition at line 91 of file kgameproperty.cpp. References KGamePropertyHandler::addProperty(), mOwner, KGamePropertyHandler::policy(), PolicyUndefined, setPolicy(), and KGamePropertyHandler::uniquePropertyId(). Referenced by KGamePropertyBase(), and registerData(). Here is the call graph for this function: ![]() |
|
|
Write the value into a stream. MUST be overwritten Implemented in KGameProperty< type >, KGamePropertyArray< type >, and KGamePropertyList< type >. Referenced by sendProperty(). |
|
|
Forward the data to the owner of this property which then sends it over network. save is used to store the data into a stream so you have to make sure that function is working properly if you implement your own property! This function is used by send to send the data over network. This does not send the current value but the explicitly given value.
Definition at line 138 of file kgameproperty.cpp. References KGameMessage::createPropertyHeader(), mOwner, and KGamePropertyHandler::sendProperty(). Here is the call graph for this function: ![]() |
|
|
Forward the data to the owner of this property which then sends it over network. save is used to store the data into a stream so you have to make sure that function is working properly if you implement your own property! Note: this sends the current property! Might be obsolete - KGamePropertyArray still uses it. Is this a bug or correct? Definition at line 124 of file kgameproperty.cpp. References KGameMessage::createPropertyHeader(), mOwner, save(), and KGamePropertyHandler::sendProperty(). Referenced by KGamePropertyArray< type >::assign(), KGamePropertyArray< type >::duplicate(), KGameProperty< type >::send(), and KGamePropertyArray< type >::setRawData(). Here is the call graph for this function: ![]() |
|
|
Sets the "dirty" flag of the property. If a property is "dirty" i.e. KGameProperty::setLocal has been called there is no guarantee that all clients share the same value. You have to ensure this yourself e.g. by calling KGameProperty::setLocal on every client. You can also ignore the dirty flag and continue working withe the property depending on your situation. Definition at line 316 of file kgameproperty.h. Referenced by KGameProperty< type >::load(), and KGameProperty< type >::setLocal(). |
|
|
Sets this property to emit a signal on value changed. As the proerties do not inehrit QObject for optimisation this signal is emited via the KPlayer or KGame object Definition at line 157 of file kgameproperty.h. |
|
|
A locked property can only be changed by the player who has set the lock. You can only call this if isLocked is false. A message is sent over network so that the property is locked for all players except you. Usually you use lock and unlock to access this property Definition at line 170 of file kgameproperty.cpp. References CmdLock, KGameMessage::createPropertyCommand(), IdCommand, and mOwner. Referenced by lock(), and unlock(). Here is the call graph for this function: ![]() |
|
|
Sets this property to try to optimize signal and network handling by not sending it out when the property value is not changed.
Definition at line 169 of file kgameproperty.h. |
|
|
Changes the consistency policy of a property. The PropertyPolicy is one of PolicyClean (defaulz), PolicyDirty or PolicyLocal. It is up to you to decide how you want to work. Definition at line 145 of file kgameproperty.h. Referenced by registerData(). |
|
|
Reimplemented in KGameProperty< type >. Definition at line 244 of file kgameproperty.h. Referenced by KGamePropertyHandler::propertyValue(). |
|
|
A locked property can only be changed by the player who has set the lock. You can only call this if isLocked is false. A message is sent over network so that the property is locked for all players except you.
Definition at line 161 of file kgameproperty.cpp. References isLocked(), and setLock(). Here is the call graph for this function: ![]() |
|
|
Definition at line 115 of file kgameproperty.cpp. References mOwner, and KGamePropertyHandler::removeProperty(). Referenced by ~KGamePropertyBase(). Here is the call graph for this function: ![]() |
|
|
Definition at line 375 of file kgameproperty.h. |
|
|
Referenced by command(). |
|
|
Definition at line 352 of file kgameproperty.h. Referenced by emitSignal(), KGamePropertyArray< type >::fill(), registerData(), KGamePropertyArray< type >::resize(), sendProperty(), KGamePropertyArray< type >::setAt(), setLock(), KGamePropertyArray< type >::sort(), and unregisterData(). |
1.4.6