Merge pull request #31 from lioncash/properties

Property: Make use of override where applicable
This commit is contained in:
LC 2020-06-12 13:17:05 -04:00 committed by GitHub
commit 10cbcd4024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 162 additions and 157 deletions

View File

@ -3,24 +3,24 @@
#include "IProperty.h" #include "IProperty.h"
class CAnimationProperty : public TSerializeableTypedProperty< uint32, EPropertyType::Animation > class CAnimationProperty : public TSerializeableTypedProperty<uint32, EPropertyType::Animation>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CAnimationProperty(EGame Game) explicit CAnimationProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& rArc) const void SerializeValue(void* pData, IArchive& rArc) const override
{ {
rArc.SerializePrimitive( (uint32&) ValueRef(pData), SH_HexDisplay ); rArc.SerializePrimitive((uint32&)ValueRef(pData), SH_HexDisplay);
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return TString::HexString( (uint32) Value(pData) ); return TString::HexString(static_cast<uint32>(Value(pData)));
} }
}; };

View File

@ -9,26 +9,26 @@ class CAnimationSetProperty : public TSerializeableTypedProperty< CAnimationPara
friend class IProperty; friend class IProperty;
protected: protected:
CAnimationSetProperty(EGame Game) explicit CAnimationSetProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{ {
mDefaultValue.SetGame(Game); mDefaultValue.SetGame(Game);
} }
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
ValueRef(pData).Serialize(Arc); ValueRef(pData).Serialize(Arc);
} }
virtual const char* HashableTypeName() const const char* HashableTypeName() const override
{ {
return (Game() <= EGame::Echoes ? "AnimationSet" : "CharacterAnimationSet"); return Game() <= EGame::Echoes ? "AnimationSet" : "CharacterAnimationSet";
} }
virtual CAnimationParameters GetSerializationDefaultValue() CAnimationParameters GetSerializationDefaultValue() override
{ {
return CAnimationParameters( Game() ); return CAnimationParameters(Game());
} }
}; };

View File

@ -5,16 +5,19 @@
struct SScriptArray struct SScriptArray
{ {
int Count; int Count = 0;
std::vector<char> Array; std::vector<char> Array;
SScriptArray() SScriptArray() = default;
: Count(0)
{}
inline bool operator==(const SScriptArray& rkOther) const bool operator==(const SScriptArray& other) const
{ {
return( Count == rkOther.Count && Array == rkOther.Array ); return Count == other.Count && Array == other.Array;
}
bool operator!=(const SScriptArray& other) const
{
return !operator==(other);
} }
}; };
@ -29,7 +32,7 @@ class CArrayProperty : public TTypedProperty<uint32, EPropertyType::Array>
* value and we respond by updating the allocated space, handling item destruction * value and we respond by updating the allocated space, handling item destruction
* and construction, etc. * and construction, etc.
*/ */
IProperty* mpItemArchetype; IProperty* mpItemArchetype = nullptr;
/** Internal functions */ /** Internal functions */
SScriptArray& _GetInternalArray(void* pData) const SScriptArray& _GetInternalArray(void* pData) const
@ -44,75 +47,74 @@ class CArrayProperty : public TTypedProperty<uint32, EPropertyType::Array>
} }
protected: protected:
CArrayProperty(EGame Game) explicit CArrayProperty(EGame Game)
: TTypedProperty(Game) : TTypedProperty(Game)
, mpItemArchetype(nullptr)
{} {}
public: public:
virtual ~CArrayProperty() { delete mpItemArchetype; } ~CArrayProperty() override { delete mpItemArchetype; }
virtual uint32 DataSize() const uint32 DataSize() const override
{ {
return sizeof(SScriptArray); return sizeof(SScriptArray);
} }
virtual uint32 DataAlignment() const uint32 DataAlignment() const override
{ {
return alignof(SScriptArray); return alignof(SScriptArray);
} }
virtual void Construct(void* pData) const void Construct(void* pData) const override
{ {
new(ValuePtr(pData)) SScriptArray; new(ValuePtr(pData)) SScriptArray;
} }
virtual void Destruct(void* pData) const void Destruct(void* pData) const override
{ {
RevertToDefault(pData); RevertToDefault(pData);
_GetInternalArray(pData).~SScriptArray(); _GetInternalArray(pData).~SScriptArray();
} }
virtual bool MatchesDefault(void* pData) const bool MatchesDefault(void* pData) const override
{ {
return ArrayCount(pData) == 0; return ArrayCount(pData) == 0;
} }
virtual void RevertToDefault(void* pData) const void RevertToDefault(void* pData) const override
{ {
Resize(pData, 0); Resize(pData, 0);
ValueRef(pData) = 0; ValueRef(pData) = 0;
} }
virtual bool CanHaveDefault() const bool CanHaveDefault() const override
{ {
return true; return true;
} }
virtual bool IsPointerType() const bool IsPointerType() const override
{ {
return true; return true;
} }
virtual void* GetChildDataPointer(void* pPropertyData) const void* GetChildDataPointer(void* pPropertyData) const override
{ {
return _GetInternalArray(pPropertyData).Array.data(); return _GetInternalArray(pPropertyData).Array.data();
} }
virtual void PropertyValueChanged(void* pPropertyData) void PropertyValueChanged(void* pPropertyData) override
{ {
SScriptArray& rArray = _GetInternalArray(pPropertyData); SScriptArray& rArray = _GetInternalArray(pPropertyData);
rArray.Count = Math::Max(rArray.Count, 0); rArray.Count = Math::Max(rArray.Count, 0);
Resize(pPropertyData, rArray.Count); Resize(pPropertyData, rArray.Count);
} }
virtual void Serialize(IArchive& rArc) void Serialize(IArchive& rArc) override
{ {
TTypedProperty::Serialize(rArc); TTypedProperty::Serialize(rArc);
rArc << SerialParameter("ItemArchetype", mpItemArchetype); rArc << SerialParameter("ItemArchetype", mpItemArchetype);
} }
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
uint32 Count = ArrayCount(pData); uint32 Count = ArrayCount(pData);
Arc.SerializeArraySize(Count); Arc.SerializeArraySize(Count);
@ -131,14 +133,14 @@ public:
} }
} }
virtual void InitFromArchetype(IProperty* pOther) void InitFromArchetype(IProperty* pOther) override
{ {
TTypedProperty::InitFromArchetype(pOther); TTypedProperty::InitFromArchetype(pOther);
CArrayProperty* pOtherArray = static_cast<CArrayProperty*>(pOther); CArrayProperty* pOtherArray = static_cast<CArrayProperty*>(pOther);
mpItemArchetype = IProperty::CreateCopy(pOtherArray->mpItemArchetype); mpItemArchetype = IProperty::CreateCopy(pOtherArray->mpItemArchetype);
} }
virtual void PostInitialize() void PostInitialize() override
{ {
TTypedProperty::PostInitialize(); TTypedProperty::PostInitialize();
mpItemArchetype->Initialize(this, mpScriptTemplate, 0); mpItemArchetype->Initialize(this, mpScriptTemplate, 0);

View File

@ -11,44 +11,44 @@ class CAssetProperty : public TSerializeableTypedProperty<CAssetID, EPropertyTyp
CResTypeFilter mTypeFilter; CResTypeFilter mTypeFilter;
protected: protected:
CAssetProperty(EGame Game) explicit CAssetProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{ {
mDefaultValue = CAssetID::InvalidID( mGame ); mDefaultValue = CAssetID::InvalidID( mGame );
} }
public: public:
virtual void Serialize(IArchive& rArc) void Serialize(IArchive& rArc) override
{ {
TSerializeableTypedProperty::Serialize(rArc); TSerializeableTypedProperty::Serialize(rArc);
CAssetProperty* pArchetype = static_cast<CAssetProperty*>(mpArchetype); CAssetProperty* pArchetype = static_cast<CAssetProperty*>(mpArchetype);
rArc << SerialParameter("TypeFilter", mTypeFilter, pArchetype ? SH_Optional : 0, pArchetype ? pArchetype->mTypeFilter : CResTypeFilter()); rArc << SerialParameter("TypeFilter", mTypeFilter, pArchetype ? SH_Optional : 0, pArchetype ? pArchetype->mTypeFilter : CResTypeFilter());
} }
virtual bool ShouldSerialize() const bool ShouldSerialize() const override
{ {
CAssetProperty* pArchetype = static_cast<CAssetProperty*>(mpArchetype); CAssetProperty* pArchetype = static_cast<CAssetProperty*>(mpArchetype);
return TSerializeableTypedProperty::ShouldSerialize() || return TSerializeableTypedProperty::ShouldSerialize() ||
mTypeFilter != pArchetype->mTypeFilter; mTypeFilter != pArchetype->mTypeFilter;
} }
virtual void InitFromArchetype(IProperty* pOther) void InitFromArchetype(IProperty* pOther) override
{ {
TTypedProperty::InitFromArchetype(pOther); TTypedProperty::InitFromArchetype(pOther);
mTypeFilter = static_cast<CAssetProperty*>(pOther)->mTypeFilter; mTypeFilter = static_cast<CAssetProperty*>(pOther)->mTypeFilter;
} }
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( ValueRef(pData), 0 ); Arc.SerializePrimitive( ValueRef(pData), 0 );
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return Value(pData).ToString(); return Value(pData).ToString();
} }
virtual CAssetID GetSerializationDefaultValue() CAssetID GetSerializationDefaultValue() override
{ {
return CAssetID::InvalidID(Game()); return CAssetID::InvalidID(Game());
} }

View File

@ -3,22 +3,22 @@
#include "IProperty.h" #include "IProperty.h"
class CBoolProperty : public TSerializeableTypedProperty< bool, EPropertyType::Bool > class CBoolProperty : public TSerializeableTypedProperty<bool, EPropertyType::Bool>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CBoolProperty(EGame Game) explicit CBoolProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( ValueRef(pData), 0 ); Arc.SerializePrimitive(ValueRef(pData), 0);
} }
virtual TString ValueAsString(void* pData) TString ValueAsString(void* pData) const override
{ {
return Value(pData) ? "true" : "false"; return Value(pData) ? "true" : "false";
} }

View File

@ -3,24 +3,24 @@
#include "IProperty.h" #include "IProperty.h"
class CByteProperty : public TNumericalProperty< int8, EPropertyType::Byte > class CByteProperty : public TNumericalProperty<int8, EPropertyType::Byte>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CByteProperty(EGame Game) explicit CByteProperty(EGame Game)
: TNumericalProperty(Game) : TNumericalProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( (int8&) ValueRef(pData), 0 ); Arc.SerializePrimitive((int8&)ValueRef(pData), 0);
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return TString::FromInt32( (int32) Value(pData), 0, 10 ); return TString::FromInt32((int32)Value(pData), 0, 10);
} }
}; };

View File

@ -4,17 +4,17 @@
#include "IProperty.h" #include "IProperty.h"
#include "CFloatProperty.h" #include "CFloatProperty.h"
class CColorProperty : public TSerializeableTypedProperty< CColor, EPropertyType::Color > class CColorProperty : public TSerializeableTypedProperty<CColor, EPropertyType::Color>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CColorProperty(EGame Game) explicit CColorProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{} {}
public: public:
virtual void PostInitialize() void PostInitialize() override
{ {
CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "R"); CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "R");
CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "G"); CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "G");
@ -23,7 +23,7 @@ public:
TPropCast<CFloatProperty>( mChildren.back() )->SetDefaultValue(1.0f); TPropCast<CFloatProperty>( mChildren.back() )->SetDefaultValue(1.0f);
} }
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
ValueRef(pData).Serialize(Arc); ValueRef(pData).Serialize(Arc);
} }

View File

@ -19,19 +19,21 @@ class TEnumPropertyBase : public TSerializeableTypedProperty<int32, TypeEnum>
struct SEnumValue struct SEnumValue
{ {
TString Name; TString Name;
uint32 ID; uint32 ID = 0;
SEnumValue()
: ID(0)
{}
SEnumValue() = default;
SEnumValue(const TString& rkInName, uint32 InID) SEnumValue(const TString& rkInName, uint32 InID)
: Name(rkInName), ID(InID) {} : Name(rkInName), ID(InID) {}
inline bool operator==(const SEnumValue& rkOther) const bool operator==(const SEnumValue& other) const
{ {
return( Name == rkOther.Name && ID == rkOther.ID ); return Name == other.Name && ID == other.ID;
}
bool operator!=(const SEnumValue& other) const
{
return !operator==(other);
} }
void Serialize(IArchive& rArc) void Serialize(IArchive& rArc)
@ -47,13 +49,13 @@ class TEnumPropertyBase : public TSerializeableTypedProperty<int32, TypeEnum>
protected: protected:
/** Constructor */ /** Constructor */
TEnumPropertyBase(EGame Game) explicit TEnumPropertyBase(EGame Game)
: base(Game) : base(Game)
, mOverrideTypeName(false) , mOverrideTypeName(false)
{} {}
public: public:
virtual const char* HashableTypeName() const const char* HashableTypeName() const override
{ {
if (base::mpArchetype) if (base::mpArchetype)
return base::mpArchetype->HashableTypeName(); return base::mpArchetype->HashableTypeName();
@ -65,7 +67,7 @@ public:
return "choice"; return "choice";
} }
virtual void Serialize(IArchive& rArc) void Serialize(IArchive& rArc) override
{ {
// Skip TSerializeableTypedProperty, serialize default value ourselves so we can set SH_HexDisplay // Skip TSerializeableTypedProperty, serialize default value ourselves so we can set SH_HexDisplay
TTypedProperty<int32, TypeEnum>::Serialize(rArc); TTypedProperty<int32, TypeEnum>::Serialize(rArc);
@ -87,21 +89,21 @@ public:
} }
} }
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( (uint32&) base::ValueRef(pData), 0 ); Arc.SerializePrimitive((uint32&)base::ValueRef(pData), 0);
} }
virtual void InitFromArchetype(IProperty* pOther) void InitFromArchetype(IProperty* pOther) override
{ {
TTypedProperty<int32, TypeEnum>::InitFromArchetype(pOther); TTypedProperty<int32, TypeEnum>::InitFromArchetype(pOther);
TEnumPropertyBase* pOtherEnum = static_cast<TEnumPropertyBase*>(pOther); TEnumPropertyBase* pOtherEnum = static_cast<TEnumPropertyBase*>(pOther);
mValues = pOtherEnum->mValues; mValues = pOtherEnum->mValues;
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return TString::FromInt32( base::Value(pData), 0, 10 ); return TString::FromInt32(base::Value(pData), 0, 10);
} }
void AddValue(TString ValueName, uint32 ValueID) void AddValue(TString ValueName, uint32 ValueID)
@ -109,7 +111,7 @@ public:
mValues.push_back( SEnumValue(ValueName, ValueID) ); mValues.push_back( SEnumValue(ValueName, ValueID) );
} }
inline uint32 NumPossibleValues() const { return mValues.size(); } uint32 NumPossibleValues() const { return mValues.size(); }
uint32 ValueIndex(uint32 ID) const uint32 ValueIndex(uint32 ID) const
{ {
@ -166,8 +168,8 @@ public:
} }
}; };
typedef TEnumPropertyBase<EPropertyType::Choice> CChoiceProperty; using CChoiceProperty = TEnumPropertyBase<EPropertyType::Choice>;
typedef TEnumPropertyBase<EPropertyType::Enum> CEnumProperty; using CEnumProperty = TEnumPropertyBase<EPropertyType::Enum>;
// Specialization of TPropCast to allow interchangeable casting, as both types are the same thing // Specialization of TPropCast to allow interchangeable casting, as both types are the same thing
template<> template<>

View File

@ -10,19 +10,21 @@ class CFlagsProperty : public TSerializeableTypedProperty<uint32, EPropertyType:
struct SBitFlag struct SBitFlag
{ {
TString Name; TString Name;
uint32 Mask; uint32 Mask = 0;
SBitFlag()
: Mask(0)
{}
SBitFlag() = default;
SBitFlag(const TString& rkInName, uint32 InMask) SBitFlag(const TString& rkInName, uint32 InMask)
: Name(rkInName), Mask(InMask) : Name(rkInName), Mask(InMask)
{} {}
bool operator==(const SBitFlag& rkOther) const bool operator==(const SBitFlag& other) const
{ {
return( Name == rkOther.Name && Mask == rkOther.Mask ); return Name == other.Name && Mask == other.Mask;
}
bool operator!=(const SBitFlag& other) const
{
return !operator==(other);
} }
void Serialize(IArchive& rArc) void Serialize(IArchive& rArc)
@ -32,36 +34,35 @@ class CFlagsProperty : public TSerializeableTypedProperty<uint32, EPropertyType:
} }
}; };
std::vector<SBitFlag> mBitFlags; std::vector<SBitFlag> mBitFlags;
uint32 mAllFlags; uint32 mAllFlags = 0;
CFlagsProperty(EGame Game) explicit CFlagsProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
, mAllFlags(0)
{} {}
public: public:
inline uint32 NumFlags() const uint32 NumFlags() const
{ {
return mBitFlags.size(); return mBitFlags.size();
} }
inline TString FlagName(uint32 Idx) const TString FlagName(uint32 Idx) const
{ {
ASSERT(Idx >= 0 && Idx < mBitFlags.size()); ASSERT(Idx >= 0 && Idx < mBitFlags.size());
return mBitFlags[Idx].Name; return mBitFlags[Idx].Name;
} }
inline uint32 FlagMask(uint32 Idx) const uint32 FlagMask(uint32 Idx) const
{ {
ASSERT(Idx >= 0 && Idx < mBitFlags.size()); ASSERT(Idx >= 0 && Idx < mBitFlags.size());
return mBitFlags[Idx].Mask; return mBitFlags[Idx].Mask;
} }
virtual void Serialize(IArchive& rArc); void Serialize(IArchive& rArc) override;
virtual void PostInitialize(); void PostInitialize() override;
virtual void SerializeValue(void* pData, IArchive& rArc) const; void SerializeValue(void* pData, IArchive& rArc) const override;
virtual void InitFromArchetype(IProperty* pOther); void InitFromArchetype(IProperty* pOther) override;
virtual TString ValueAsString(void* pData) const; TString ValueAsString(void* pData) const override;
/** /**
* Checks whether there are any unrecognized bits toggled on in the property value. * Checks whether there are any unrecognized bits toggled on in the property value.

View File

@ -3,24 +3,24 @@
#include "IProperty.h" #include "IProperty.h"
class CFloatProperty : public TNumericalProperty< float, EPropertyType::Float > class CFloatProperty : public TNumericalProperty<float, EPropertyType::Float>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CFloatProperty(EGame Game) explicit CFloatProperty(EGame Game)
: TNumericalProperty(Game) : TNumericalProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( (float&) ValueRef(pData), 0 ); Arc.SerializePrimitive((float&)ValueRef(pData), 0);
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return TString::FromFloat( Value(pData) ); return TString::FromFloat(Value(pData));
} }
}; };

View File

@ -3,17 +3,17 @@
#include "IProperty.h" #include "IProperty.h"
class CGuidProperty : public TTypedProperty< std::vector<char>, EPropertyType::Guid > class CGuidProperty : public TTypedProperty<std::vector<char>, EPropertyType::Guid>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CGuidProperty(EGame Game) explicit CGuidProperty(EGame Game)
: TTypedProperty(Game) : TTypedProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc << SerialParameter("Data", ValueRef(pData)); Arc << SerialParameter("Data", ValueRef(pData));
} }

View File

@ -3,24 +3,24 @@
#include "IProperty.h" #include "IProperty.h"
class CIntProperty : public TNumericalProperty< int32, EPropertyType::Int > class CIntProperty : public TNumericalProperty<int32, EPropertyType::Int>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CIntProperty(EGame Game) explicit CIntProperty(EGame Game)
: TNumericalProperty(Game) : TNumericalProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( ValueRef(pData), 0 ); Arc.SerializePrimitive(ValueRef(pData), 0);
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return TString::FromInt32( Value(pData), 0, 10 ); return TString::FromInt32(Value(pData), 0, 10);
} }
}; };

View File

@ -7,22 +7,22 @@ class CPointerProperty : public TTypedProperty<void*, EPropertyType::Pointer>
{ {
friend class IProperty; friend class IProperty;
CPointerProperty(EGame Game) explicit CPointerProperty(EGame Game)
: TTypedProperty(Game) : TTypedProperty(Game)
{} {}
public: public:
virtual bool IsPointerType() const bool IsPointerType() const override
{ {
return true; return true;
} }
virtual void* GetChildDataPointer(void* pPropertyData) const void* GetChildDataPointer(void* pPropertyData) const override
{ {
return ValueRef(pPropertyData); return ValueRef(pPropertyData);
} }
virtual void SerializeValue(void* pData, IArchive& rArc) const void SerializeValue(void* pData, IArchive& rArc) const override
{ {
// pointers are not serializable, this shouldn't happen // pointers are not serializable, this shouldn't happen
ASSERT(false); ASSERT(false);

View File

@ -3,16 +3,16 @@
#include "IProperty.h" #include "IProperty.h"
class CSequenceProperty : public TTypedProperty< int32, EPropertyType::Sequence > class CSequenceProperty : public TTypedProperty<int32, EPropertyType::Sequence>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CSequenceProperty(EGame Game) explicit CSequenceProperty(EGame Game)
: TTypedProperty(Game) : TTypedProperty(Game)
{} {}
virtual void SerializeValue(void* pData, IArchive& rArc) const void SerializeValue(void* pData, IArchive& rArc) const override
{} {}
}; };

View File

@ -8,19 +8,19 @@ class CShortProperty : public TNumericalProperty< int16, EPropertyType::Short >
friend class IProperty; friend class IProperty;
protected: protected:
CShortProperty(EGame Game) explicit CShortProperty(EGame Game)
: TNumericalProperty(Game) : TNumericalProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( ValueRef(pData), 0 ); Arc.SerializePrimitive(ValueRef(pData), 0);
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return TString::FromInt32( (int32) Value(pData), 0, 10 ); return TString::FromInt32((int32)Value(pData), 0, 10);
} }
}; };

View File

@ -3,24 +3,24 @@
#include "IProperty.h" #include "IProperty.h"
class CSoundProperty : public TSerializeableTypedProperty< int32, EPropertyType::Sound > class CSoundProperty : public TSerializeableTypedProperty<int32, EPropertyType::Sound>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CSoundProperty(EGame Game) explicit CSoundProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( ValueRef(pData), 0 ); Arc.SerializePrimitive(ValueRef(pData), 0);
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return TString::FromInt32( Value(pData), 0, 10 ); return TString::FromInt32(Value(pData), 0, 10);
} }
}; };

View File

@ -3,17 +3,17 @@
#include "IProperty.h" #include "IProperty.h"
class CSplineProperty : public TTypedProperty< std::vector<char>, EPropertyType::Spline > class CSplineProperty : public TTypedProperty<std::vector<char>, EPropertyType::Spline>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CSplineProperty(EGame Game) explicit CSplineProperty(EGame Game)
: TTypedProperty(Game) : TTypedProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc << SerialParameter("Data", ValueRef(pData)); Arc << SerialParameter("Data", ValueRef(pData));
} }

View File

@ -3,22 +3,22 @@
#include "IProperty.h" #include "IProperty.h"
class CStringProperty : public TSerializeableTypedProperty< TString, EPropertyType::String > class CStringProperty : public TSerializeableTypedProperty<TString, EPropertyType::String>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CStringProperty(EGame Game) explicit CStringProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{} {}
public: public:
virtual void SerializeValue(void* pData, IArchive& Arc) const void SerializeValue(void* pData, IArchive& Arc) const override
{ {
Arc.SerializePrimitive( ValueRef(pData), 0 ); Arc.SerializePrimitive(ValueRef(pData), 0);
} }
virtual TString ValueAsString(void* pData) const TString ValueAsString(void* pData) const override
{ {
return Value(pData); return Value(pData);
} }

View File

@ -9,30 +9,30 @@ class CStructProperty : public IProperty
public: public:
// Must be a valid type for TPropertyRef // Must be a valid type for TPropertyRef
typedef void* ValueType; using ValueType = void*;
protected: protected:
CStructProperty(EGame Game) explicit CStructProperty(EGame Game)
: IProperty(Game) : IProperty(Game)
{} {}
public: public:
virtual EPropertyType Type() const; EPropertyType Type() const override;
virtual void PostInitialize(); void PostInitialize() override;
virtual uint32 DataSize() const; uint32 DataSize() const override;
virtual uint32 DataAlignment() const; uint32 DataAlignment() const override;
virtual void Construct(void* pData) const; void Construct(void* pData) const override;
virtual void Destruct(void* pData) const; void Destruct(void* pData) const override;
virtual bool MatchesDefault(void* pData) const; bool MatchesDefault(void* pData) const override;
virtual void RevertToDefault(void* pData) const; void RevertToDefault(void* pData) const override;
virtual void SetDefaultFromData(void* pData); void SetDefaultFromData(void* pData) override;
virtual const char* HashableTypeName() const; const char* HashableTypeName() const override;
virtual void Serialize(IArchive& rArc); void Serialize(IArchive& rArc) override;
virtual void SerializeValue(void* pData, IArchive& Arc) const; void SerializeValue(void* pData, IArchive& Arc) const override;
virtual void InitFromArchetype(IProperty* pOther); void InitFromArchetype(IProperty* pOther) override;
virtual bool ShouldSerialize() const; bool ShouldSerialize() const override;
inline static EPropertyType StaticType() { return EPropertyType::Struct; } static EPropertyType StaticType() { return EPropertyType::Struct; }
}; };
#endif #endif

View File

@ -3,29 +3,29 @@
#include "IProperty.h" #include "IProperty.h"
class CVectorProperty : public TSerializeableTypedProperty< CVector3f, EPropertyType::Vector > class CVectorProperty : public TSerializeableTypedProperty<CVector3f, EPropertyType::Vector>
{ {
friend class IProperty; friend class IProperty;
protected: protected:
CVectorProperty(EGame Game) explicit CVectorProperty(EGame Game)
: TSerializeableTypedProperty(Game) : TSerializeableTypedProperty(Game)
{} {}
public: public:
virtual void PostInitialize() override void PostInitialize() override
{ {
CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "X"); CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "X");
CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "Y"); CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "Y");
CreateIntrinsic(EPropertyType::Float, this, mOffset + 8, "Z"); CreateIntrinsic(EPropertyType::Float, this, mOffset + 8, "Z");
} }
virtual void SerializeValue(void* pData, IArchive& Arc) const override void SerializeValue(void* pData, IArchive& Arc) const override
{ {
ValueRef(pData).Serialize(Arc); ValueRef(pData).Serialize(Arc);
} }
virtual TString ValueAsString(void* pData) const override TString ValueAsString(void* pData) const override
{ {
return Value(pData).ToString(); return Value(pData).ToString();
} }