7#include <Common/config.h>
8#include <Common/logging.h>
19template<
typename Owner,
typename SdlValueType = TSdlValue<
bool, Owner>>
22 static_assert(std::is_base_of_v<TSdlAbstractValue<bool, Owner>, SdlValueType>,
23 "SdlValueType should be a subclass of TSdlAbstractValue.");
26 template<
typename ValueType>
27 inline TSdlBool(std::string valueName, ValueType Owner::* const valuePtr) :
28 SdlValueType(
"bool",
std::move(valueName), valuePtr)
33 return value ?
"true" :
"false";
38 bool*
const boolPtr = this->
getValue(owner);
39 if constexpr(std::is_base_of_v<TSdlOptionalValue<bool, Owner>, SdlValueType>)
52 optBool = std::nullopt;
66 data.isNullClearable =
true;
82 if(clause.
value ==
"true" || clause.
value ==
"TRUE" || clause.
value ==
"True")
92 else if(clause.
value ==
"false" || clause.
value ==
"FALSE" || clause.
value ==
"False")
99 "Unrecognized SDL bool literal: {}, treating it as false.", clause.
value);
113 out_clause.
value = *value ?
"true" :
"false";
Data that SDL input process can rely on.
Definition SdlInputContext.h:19
Definition SdlNativeData.h:88
static auto permissiveElementSetter(SdlSetterVariant input, ElementType *out_elementPtr) -> bool
Given a valid target element, set its value in a permissive way (with auto conversions).
Definition SdlNativeData.ipp:349
std::size_t numElements
Hint for number of elements in this block of native data. For example, numElements would be 12 for an...
Definition SdlNativeData.h:99
static auto permissiveElementGetter(ElementType *elementPtr) -> SdlGetterVariant
Given a valid target element, get its value in a permissive way (with auto conversions).
Definition SdlNativeData.ipp:312
static SdlNativeData fromSingleElement(ElementType *elementPtr, ESdlDataFormat elementContainer, ESdlDataType elementType, bool canSet=false, bool canDirectAccess=false)
Creates native data for a single element pointer.
Definition SdlNativeData.ipp:86
Carries SDL representation of various data during the output process. Helps to write output data such...
Definition SdlOutputClause.h:14
std::string value
Stores stringified data of a clause. As the output clause generator knows best how its data look like...
Definition SdlOutputClause.h:29
bool isEmpty
If the clause carries no data and does not need to be written.
Definition SdlOutputClause.h:41
Data that SDL output process can rely on.
Definition SdlOutputContext.h:19
Definition SdlNativeData.h:24
A field class that binds a bool member variable.
Definition TSdlBool.h:21
void saveToSdl(const Owner &owner, 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 TSdlBool.h:106
std::string valueAsString(const bool &value) const override
Definition TSdlBool.h:31
TSdlBool(std::string valueName, ValueType Owner::*const valuePtr)
Definition TSdlBool.h:27
void loadFromSdl(Owner &owner, 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 TSdlBool.h:77
SdlNativeData ownedNativeData(Owner &owner) const override
Direct access to the field memory of an owner. Short-lived owner objects such as function parameter s...
Definition TSdlBool.h:36
void setValue(Owner &owner, T value) const override
Store a value.
Definition TSdlValue.ipp:38
const T * getConstValue(const Owner &owner) const override
Get a pointer to the stored value.
Definition TSdlValue.ipp:50
T * getValue(Owner &owner) const override
Get a pointer to the stored value.
Definition TSdlValue.ipp:44
T & valueRef(Owner &owner) const
Definition TSdlValue.ipp:132
The root for all renderer implementations.
Definition EEngineProject.h:6
TAnyPtr< false > AnyNonConstPtr
A type-safe, lightweight wrapper for any non-const raw pointer type.
Definition TAnyPtr.h:47
Low-level helpers for SDL. Helpers are in an additional sdl namespace.