|
@@ -6,6 +6,9 @@
|
|
|
|
|
|
|
|
namespace BansheeEngine
|
|
namespace BansheeEngine
|
|
|
{
|
|
{
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Valid serializable script types.
|
|
|
|
|
+ */
|
|
|
enum class ScriptPrimitiveType
|
|
enum class ScriptPrimitiveType
|
|
|
{
|
|
{
|
|
|
Bool,
|
|
Bool,
|
|
@@ -38,20 +41,41 @@ namespace BansheeEngine
|
|
|
ComponentRef
|
|
ComponentRef
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Flags that are used to further define
|
|
|
|
|
+ * a field in a managed serializable object.
|
|
|
|
|
+ */
|
|
|
enum class ScriptFieldFlags
|
|
enum class ScriptFieldFlags
|
|
|
{
|
|
{
|
|
|
Serializable = 0x01,
|
|
Serializable = 0x01,
|
|
|
Inspectable = 0x02
|
|
Inspectable = 0x02
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains information about a type of a managed serializable object.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfo : public IReflectable
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfo : public IReflectable
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
virtual ~ManagedSerializableTypeInfo() {}
|
|
virtual ~ManagedSerializableTypeInfo() {}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Checks if the current type matches the provided type.
|
|
|
|
|
+ */
|
|
|
virtual bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const = 0;
|
|
virtual bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const = 0;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Checks does the managed type this object represents still exists.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @note e.g. If assemblies get refreshed user could have renamed or removed
|
|
|
|
|
+ * some types.
|
|
|
|
|
+ */
|
|
|
virtual bool isTypeLoaded() const = 0;
|
|
virtual bool isTypeLoaded() const = 0;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Returns the internal managed class of the type this object represents.
|
|
|
|
|
+ * Returns null if the type doesn't exist.
|
|
|
|
|
+ */
|
|
|
virtual ::MonoClass* getMonoClass() const = 0;
|
|
virtual ::MonoClass* getMonoClass() const = 0;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
@@ -60,18 +84,31 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableTypeInfoRTTI;
|
|
friend class ManagedSerializableTypeInfoRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains information about a type of a managed serializable primitive (e.g. int, float, etc.).
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoPrimitive : public ManagedSerializableTypeInfo
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoPrimitive : public ManagedSerializableTypeInfo
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- ScriptPrimitiveType mType;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::matches
|
|
|
|
|
+ */
|
|
|
|
|
+ bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
|
|
|
|
|
|
|
|
- bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const;
|
|
|
|
|
- bool isTypeLoaded() const;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::isTypeLoaded
|
|
|
|
|
+ */
|
|
|
|
|
+ bool isTypeLoaded() const override;
|
|
|
|
|
|
|
|
- ::MonoClass* getMonoClass() const;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::getMonoClass
|
|
|
|
|
+ */
|
|
|
|
|
+ ::MonoClass* getMonoClass() const override;
|
|
|
|
|
+
|
|
|
|
|
+ ScriptPrimitiveType mType;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
/* RTTI */
|
|
/* RTTI */
|
|
@@ -79,41 +116,67 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableTypeInfoPrimitiveRTTI;
|
|
friend class ManagedSerializableTypeInfoPrimitiveRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains information about a type of a managed serializable complex object (e.g. struct or class).
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoObject : public ManagedSerializableTypeInfo
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoObject : public ManagedSerializableTypeInfo
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::matches
|
|
|
|
|
+ */
|
|
|
|
|
+ bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::isTypeLoaded
|
|
|
|
|
+ */
|
|
|
|
|
+ bool isTypeLoaded() const override;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::getMonoClass
|
|
|
|
|
+ */
|
|
|
|
|
+ ::MonoClass* getMonoClass() const override;
|
|
|
|
|
+
|
|
|
String mTypeNamespace;
|
|
String mTypeNamespace;
|
|
|
String mTypeName;
|
|
String mTypeName;
|
|
|
bool mValueType;
|
|
bool mValueType;
|
|
|
UINT32 mTypeId;
|
|
UINT32 mTypeId;
|
|
|
|
|
|
|
|
- bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const;
|
|
|
|
|
- bool isTypeLoaded() const;
|
|
|
|
|
-
|
|
|
|
|
- ::MonoClass* getMonoClass() const;
|
|
|
|
|
-
|
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
/* RTTI */
|
|
/* RTTI */
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableTypeInfoObjectRTTI;
|
|
friend class ManagedSerializableTypeInfoObjectRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains information about a type of a managed serializable Array.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoArray : public ManagedSerializableTypeInfo
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoArray : public ManagedSerializableTypeInfo
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- ManagedSerializableTypeInfoPtr mElementType;
|
|
|
|
|
- UINT32 mRank;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::matches
|
|
|
|
|
+ */
|
|
|
|
|
+ bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
|
|
|
|
|
|
|
|
- bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const;
|
|
|
|
|
- bool isTypeLoaded() const;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::isTypeLoaded
|
|
|
|
|
+ */
|
|
|
|
|
+ bool isTypeLoaded() const override;
|
|
|
|
|
|
|
|
- ::MonoClass* getMonoClass() const;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::getMonoClass
|
|
|
|
|
+ */
|
|
|
|
|
+ ::MonoClass* getMonoClass() const override;
|
|
|
|
|
+
|
|
|
|
|
+ ManagedSerializableTypeInfoPtr mElementType;
|
|
|
|
|
+ UINT32 mRank;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
/* RTTI */
|
|
/* RTTI */
|
|
@@ -121,18 +184,31 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableTypeInfoArrayRTTI;
|
|
friend class ManagedSerializableTypeInfoArrayRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains information about a type of a managed serializable List.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoList : public ManagedSerializableTypeInfo
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoList : public ManagedSerializableTypeInfo
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- ManagedSerializableTypeInfoPtr mElementType;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::matches
|
|
|
|
|
+ */
|
|
|
|
|
+ bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::isTypeLoaded
|
|
|
|
|
+ */
|
|
|
|
|
+ bool isTypeLoaded() const override;
|
|
|
|
|
|
|
|
- bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const;
|
|
|
|
|
- bool isTypeLoaded() const;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::getMonoClass
|
|
|
|
|
+ */
|
|
|
|
|
+ ::MonoClass* getMonoClass() const override;
|
|
|
|
|
|
|
|
- ::MonoClass* getMonoClass() const;
|
|
|
|
|
|
|
+ ManagedSerializableTypeInfoPtr mElementType;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
/* RTTI */
|
|
/* RTTI */
|
|
@@ -140,19 +216,32 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableTypeInfoListRTTI;
|
|
friend class ManagedSerializableTypeInfoListRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains information about a type of a managed serializable Dictionary.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoDictionary : public ManagedSerializableTypeInfo
|
|
class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoDictionary : public ManagedSerializableTypeInfo
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- ManagedSerializableTypeInfoPtr mKeyType;
|
|
|
|
|
- ManagedSerializableTypeInfoPtr mValueType;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::matches
|
|
|
|
|
+ */
|
|
|
|
|
+ bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
|
|
|
|
|
|
|
|
- bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const;
|
|
|
|
|
- bool isTypeLoaded() const;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::isTypeLoaded
|
|
|
|
|
+ */
|
|
|
|
|
+ bool isTypeLoaded() const override;
|
|
|
|
|
|
|
|
- ::MonoClass* getMonoClass() const;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc ManagedSerializableTypeInfo::getMonoClass
|
|
|
|
|
+ */
|
|
|
|
|
+ ::MonoClass* getMonoClass() const override;
|
|
|
|
|
+
|
|
|
|
|
+ ManagedSerializableTypeInfoPtr mKeyType;
|
|
|
|
|
+ ManagedSerializableTypeInfoPtr mValueType;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
/* RTTI */
|
|
/* RTTI */
|
|
@@ -160,14 +249,22 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableTypeInfoDictionaryRTTI;
|
|
friend class ManagedSerializableTypeInfoDictionaryRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains data about a single field in a managed complex object.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableFieldInfo : public IReflectable
|
|
class BS_SCR_BE_EXPORT ManagedSerializableFieldInfo : public IReflectable
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
ManagedSerializableFieldInfo();
|
|
ManagedSerializableFieldInfo();
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Determines should the field be serialized when serializing the parent object.
|
|
|
|
|
+ */
|
|
|
|
|
+ bool isSerializable() const { return ((UINT32)mFlags & (UINT32)ScriptFieldFlags::Serializable) != 0; }
|
|
|
|
|
+
|
|
|
String mName;
|
|
String mName;
|
|
|
UINT32 mFieldId;
|
|
UINT32 mFieldId;
|
|
|
UINT32 mParentTypeId;
|
|
UINT32 mParentTypeId;
|
|
@@ -177,23 +274,41 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
MonoField* mMonoField;
|
|
MonoField* mMonoField;
|
|
|
|
|
|
|
|
- bool isSerializable() const { return ((UINT32)mFlags & (UINT32)ScriptFieldFlags::Serializable) != 0; }
|
|
|
|
|
-
|
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
/* RTTI */
|
|
/* RTTI */
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableFieldInfoRTTI;
|
|
friend class ManagedSerializableFieldInfoRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains data about fields of a complex object, and the object's
|
|
|
|
|
+ * class hierarchy if it belongs to one.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableObjectInfo : public IReflectable
|
|
class BS_SCR_BE_EXPORT ManagedSerializableObjectInfo : public IReflectable
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
ManagedSerializableObjectInfo();
|
|
ManagedSerializableObjectInfo();
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Returns the managed type name of the object's type, including the namespace in format
|
|
|
|
|
+ * "namespace.typename".
|
|
|
|
|
+ */
|
|
|
String getFullTypeName() const { return mTypeInfo->mTypeNamespace + "." + mTypeInfo->mTypeName; }
|
|
String getFullTypeName() const { return mTypeInfo->mTypeNamespace + "." + mTypeInfo->mTypeName; }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Attempts to find a field part of this object that matches the provided parameters.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param fieldInfo Object describing the managed field. Normally this will be a field
|
|
|
|
|
+ * that was deserialized and you need to ensure it still exists in
|
|
|
|
|
+ * its parent type, while retrieving the new field info.
|
|
|
|
|
+ * @param fieldTypeInfo Type information about the type containing the object. Used for
|
|
|
|
|
+ * debug purposes to ensure the current object's type matches.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return Found field info within this object, or null if not found.
|
|
|
|
|
+ */
|
|
|
ManagedSerializableFieldInfoPtr findMatchingField(const ManagedSerializableFieldInfoPtr& fieldInfo,
|
|
ManagedSerializableFieldInfoPtr findMatchingField(const ManagedSerializableFieldInfoPtr& fieldInfo,
|
|
|
const ManagedSerializableTypeInfoPtr& fieldTypeInfo) const;
|
|
const ManagedSerializableTypeInfoPtr& fieldTypeInfo) const;
|
|
|
|
|
|
|
@@ -212,9 +327,12 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableObjectInfoRTTI;
|
|
friend class ManagedSerializableObjectInfoRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains information about all managed serializable objects in a specific managed assembly.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BE_EXPORT ManagedSerializableAssemblyInfo : public IReflectable
|
|
class BS_SCR_BE_EXPORT ManagedSerializableAssemblyInfo : public IReflectable
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
@@ -229,6 +347,6 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class ManagedSerializableAssemblyInfoRTTI;
|
|
friend class ManagedSerializableAssemblyInfoRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const;
|
|
|
|
|
|
|
+ virtual RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|