Added TPropCast property casting function, added support for clean/dirty state in the world editor + check for unsaved changes when the window is closed

This commit is contained in:
parax0
2016-02-01 16:42:12 -07:00
parent 6669dd4367
commit 1a07a9c083
34 changed files with 242 additions and 163 deletions

View File

@@ -71,6 +71,8 @@ public:
~TTypedProperty() {}
virtual EPropertyType Type() const { return TypeEnum; }
static inline EPropertyType StaticType() { return TypeEnum; }
virtual TString ToString() const { return mValue.ToString(); }
virtual IPropertyValue* RawValue() { return &mValue; }
@@ -124,6 +126,7 @@ public:
}
EPropertyType Type() const { return eStructProperty; }
static inline EPropertyType StaticType() { return eStructProperty; }
virtual void Copy(const IProperty *pkProp);
@@ -161,6 +164,7 @@ public:
: CPropertyStruct(pTemp, pParent) {}
EPropertyType Type() const { return eArrayProperty; }
static inline EPropertyType StaticType() { return eArrayProperty; }
virtual IProperty* Clone(CPropertyStruct *pParent) const
{
@@ -179,5 +183,14 @@ public:
TString ElementName() const;
};
/*
* Function for casting properties. Returns null if the property is not actually the requested type.
*/
template <class PropertyClass>
PropertyClass* TPropCast(IProperty *pProp)
{
return (pProp && pProp->Type() == PropertyClass::StaticType() ? static_cast<PropertyClass*>(pProp) : nullptr);
}
#endif // IPROPERTY