6#include <Common/assertion.h>
7#include <Common/primitive_type.h>
23template<
typename OuterType,
typename InnerType>
28 InnerType OuterType::* innerObjPtr,
32 std::string
valueToString(
const OuterType& outerObj)
const override;
35 const OuterType& outerObj,
36 std::vector<const ISdlResource*>& out_resources)
const override;
47 const OuterType& outerObj,
52 InnerType OuterType::* m_innerObjPtr;
58template<
typename OuterType,
typename InnerType>
60 InnerType OuterType::* const innerObjPtr,
64 std::string(innerObjField ? innerObjField->getTypeName() :
"unavailable"),
65 std::string(innerObjField ? innerObjField->getFieldName() :
"unavailable")),
67 m_innerObjPtr (innerObjPtr),
68 m_innerObjField(innerObjField)
70 PH_ASSERT(m_innerObjPtr);
71 PH_ASSERT(m_innerObjField);
73 PH_ASSERT_MSG(
static_cast<const SdlField*
>(m_innerObjField) !=
this,
74 "setting self as inner field is forbidden (will result in infinite recursive calls)");
81template<
typename OuterType,
typename InnerType>
84 m_innerObjField->ownedValueToDefault(outerObj.*m_innerObjPtr);
87template<
typename OuterType,
typename InnerType>
90 return m_innerObjField->valueToString(outerObj.*m_innerObjPtr);
93template<
typename OuterType,
typename InnerType>
95 const OuterType& outerObj,
96 std::vector<const ISdlResource*>& out_resources)
const
98 m_innerObjField->ownedResources(outerObj.*m_innerObjPtr, out_resources);
101template<
typename OuterType,
typename InnerType>
104 return m_innerObjField->ownedNativeData(outerObj.*m_innerObjPtr);
107template<
typename OuterType,
typename InnerType>
113 m_innerObjField->loadFromSdl(
114 outerObj.*m_innerObjPtr,
119template<
typename OuterType,
typename InnerType>
121 const OuterType& outerObj,
125 m_innerObjField->saveToSdl(
126 outerObj.*m_innerObjPtr,
SdlField & setEnableFallback(bool isFallbackEnabled)
Definition SdlField.h:118
bool isFallbackEnabled() const
Whether the field want to use built-in mechanism to handle I/O problems. An example of this is defaul...
Definition SdlField.h:99
std::string_view getDescription() const
Definition SdlField.h:84
SdlField & setImportance(EFieldImportance importance)
Sets the importance of the field. Different importance affect the underlying policy used during the i...
Definition SdlField.h:111
SdlField & setDescription(std::string descriptionStr)
Definition SdlField.h:104
EFieldImportance getImportance() const
Definition SdlField.h:94
Data that SDL input process can rely on.
Definition SdlInputContext.h:19
Definition SdlNativeData.h:88
Carries SDL representation of various data during the output process. Helps to write output data such...
Definition SdlOutputClause.h:14
Data that SDL output process can rely on.
Definition SdlOutputContext.h:19
A field that lives within an inner object.
Definition TSdlNestedField.h:25
void saveToSdl(const OuterType &outerObj, SdlOutputClause &out_clause, const SdlOutputContext &ctx) const override
Convert actual value back to SDL value. Saving a loaded value as SDL value should rarely fail–as load...
Definition TSdlNestedField.h:120
void loadFromSdl(OuterType &outerObj, const SdlInputClause &clause, const SdlInputContext &ctx) const override
Load SDL value to actual value and store it in the owner's field. Implementations are highly encourag...
Definition TSdlNestedField.h:108
SdlNativeData ownedNativeData(OuterType &outerObj) const override
Direct access to the field memory of an owner. Short-lived owner objects such as function parameter s...
Definition TSdlNestedField.h:102
void ownedValueToDefault(OuterType &outerObj) const override
Set the value of the field to a default one. Since the field class is templatized by Owner type,...
Definition TSdlNestedField.h:82
void ownedResources(const OuterType &outerObj, std::vector< const ISdlResource * > &out_resources) const override
Get all SDL resources associated by owner.
Definition TSdlNestedField.h:94
std::string valueToString(const OuterType &outerObj) const override
Convert the value of the field to human-readable string.
Definition TSdlNestedField.h:88
Abstraction for a value that is owned by some owner type. Governs how a field should be initialized o...
Definition TSdlOwnedField.h:15
friend class TSdlNestedField
Definition TSdlOwnedField.h:107
The root for all renderer implementations.
Definition EEngineProject.h:6