Changeset View
Changeset View
Standalone View
Standalone View
libkdegamesprivate/kgame/kgameproperty.h
Show First 20 Lines • Show All 749 Lines • ▼ Show 20 Line(s) | 749 | { | |||
---|---|---|---|---|---|
750 | send(v); | 750 | send(v); | ||
751 | setLocal(v); | 751 | setLocal(v); | ||
752 | } | 752 | } | ||
753 | 753 | | |||
754 | /** | 754 | /** | ||
755 | * Saves the object to a stream. | 755 | * Saves the object to a stream. | ||
756 | * @param stream The stream to save to | 756 | * @param stream The stream to save to | ||
757 | **/ | 757 | **/ | ||
758 | void save(QDataStream &stream) Q_DECL_OVERRIDE | 758 | void save(QDataStream &stream) override | ||
759 | { | 759 | { | ||
760 | stream << mData; | 760 | stream << mData; | ||
761 | } | 761 | } | ||
762 | 762 | | |||
763 | /** | 763 | /** | ||
764 | * @return The local value (see setLocal) if it is existing, | 764 | * @return The local value (see setLocal) if it is existing, | ||
765 | * otherwise the network value which is always consistent on every | 765 | * otherwise the network value which is always consistent on every | ||
766 | * client. | 766 | * client. | ||
Show All 9 Lines | |||||
776 | * This function is called automatically when a new value is received | 776 | * This function is called automatically when a new value is received | ||
777 | * over network (i.e. it has been sent using send on this or any | 777 | * over network (i.e. it has been sent using send on this or any | ||
778 | * other client) or when a game is loaded (and maybe on some other | 778 | * other client) or when a game is loaded (and maybe on some other | ||
779 | * events). | 779 | * events). | ||
780 | * | 780 | * | ||
781 | * Also calls emitSignal if isEmittingSignal is TRUE. | 781 | * Also calls emitSignal if isEmittingSignal is TRUE. | ||
782 | * @param s The stream to read from | 782 | * @param s The stream to read from | ||
783 | **/ | 783 | **/ | ||
784 | void load(QDataStream& s) Q_DECL_OVERRIDE | 784 | void load(QDataStream& s) override | ||
785 | { | 785 | { | ||
786 | s >> mData; | 786 | s >> mData; | ||
787 | setDirty(false); | 787 | setDirty(false); | ||
788 | if (isEmittingSignal()) { | 788 | if (isEmittingSignal()) { | ||
789 | emitSignal(); | 789 | emitSignal(); | ||
790 | } | 790 | } | ||
791 | } | 791 | } | ||
792 | 792 | | |||
Show All 36 Lines | |||||
829 | * Yeah, you can do it! | 829 | * Yeah, you can do it! | ||
830 | * \code | 830 | * \code | ||
831 | * int a = myGamePropertyInt; | 831 | * int a = myGamePropertyInt; | ||
832 | * \endcode | 832 | * \endcode | ||
833 | * If you don't see it: you don't have to use integerData.value() | 833 | * If you don't see it: you don't have to use integerData.value() | ||
834 | **/ | 834 | **/ | ||
835 | operator type() const { return value(); } | 835 | operator type() const { return value(); } | ||
836 | 836 | | |||
837 | const type_info* typeinfo() Q_DECL_OVERRIDE { return &typeid(type); } | 837 | const type_info* typeinfo() override { return &typeid(type); } | ||
838 | 838 | | |||
839 | private: | 839 | private: | ||
840 | void init() { } | 840 | void init() { } | ||
841 | 841 | | |||
842 | private: | 842 | private: | ||
843 | type mData; | 843 | type mData; | ||
844 | }; | 844 | }; | ||
845 | 845 | | |||
846 | 846 | | |||
847 | typedef KGameProperty<int> KGamePropertyInt; | 847 | typedef KGameProperty<int> KGamePropertyInt; | ||
848 | typedef KGameProperty<unsigned int> KGamePropertyUInt; | 848 | typedef KGameProperty<unsigned int> KGamePropertyUInt; | ||
849 | typedef KGameProperty<QString> KGamePropertyQString; | 849 | typedef KGameProperty<QString> KGamePropertyQString; | ||
850 | typedef KGameProperty<qint8> KGamePropertyBool; | 850 | typedef KGameProperty<qint8> KGamePropertyBool; | ||
851 | 851 | | |||
852 | #endif | 852 | #endif |