2
3
4
5
6
7
8
9
10
11
12#ifndef GIMBAL_PROPERTY_H
13#define GIMBAL_PROPERTY_H
15#include "../instances/gimbal_box.h"
18
19
20
22#define GBL_PROPERTY(self) (GBL_CAST(GblProperty, self))
24#define GBL_PROPERTY_GET_CLASS(self) (GBL_CLASSOF(GblProperty, self))
31
32
33
35#define GBL_PROPERTIES(object, ...) GBL_PROPERTIES_
(object, __VA_ARGS__)
37#define GBL_PROPERTIES_REGISTER( ...) GBL_PROPERTIES_REGISTER_
(__VA_ARGS__)
40#define GBL_SELF_TYPE GblProperty
47typedef GblBool (*GblPropertyIterFn)(
const GblProperty* pProp,
void* pClosure);
50
51
66
67
68
69
70
71
72
73
74
75
76
77
78
79
82 GBL_RESULT (*pFnInitOptionalArgs)(
GBL_SELF, size_t argCount, va_list* pVaList);
84 GBL_RESULT (*pFnDefaultValue) (
GBL_CSELF, GblVariant* pValue);
86 GBL_RESULT (*pFnCheckValue) (
GBL_CSELF,
const GblVariant* pValue);
88 GBL_RESULT (*pFnValidateValue) (
GBL_CSELF, GblVariant* pValue);
90 GBL_RESULT (*pFnCompareValues) (
GBL_CSELF,
const GblVariant* pV1,
const GblVariant* pV2,
int* pResult);
94
95
96
97
98
99
100
101
102
103
131 GblProperty_next (
GblType objectType,
132 const GblProperty* pPrev,
137 GblPropertyIterFn pFnIt,
145 size_t optionalArgCount,
152 size_t optionalArgCount,
160 size_t optionalArgCount,
168 size_t optionalArgCount,
171GBL_EXPORT GBL_RESULT GblProperty_createOrConstruct(GblProperty** ppSelf,
176 size_t optionalArgCount,
187 const GblVariant* pV1,
192#define GBL_PROPERTIES_(object, ...)
193 GBL_PROPERTIES_IDS_
(object, __VA_ARGS__)
194 GBL_PROPERTIES_REGISTER_DEFINE_
(object, __VA_ARGS__)
196#define GBL_PROPERTIES_REGISTER_(...)
199#define GBL_PROPERTIES_REGISTER_1(object)
200 GBL_PROPERTIES_REGISTER_2
(object, NULL
)
202#define GBL_PROPERTIES_REGISTER_2(object, list)
204 for(size_t p = 0
; p < object##_Property_Id_count; ++p) {
205 object##_registerProperty_(p,
210#define GBL_PROPERTIES_IDS_(object, ...)
211 typedef enum object##_Property_Id_ {
213 object##_Property_Id_count
214 } object##_Property_Id_;
216#define GBL_PROPERTY_ID_(object, property)
217 GBL_PROPERTY_ID__
(object, GBL_EVAL property)
219#define GBL_PROPERTY_ID__(...)
220 GBL_PROPERTY_ID___
(__VA_ARGS__)
222#define GBL_PROPERTY_ID___(object, name, type, flags, ...)
223 object##_Property_Id_##name,
225#define GBL_PROPERTIES_REGISTER_DEFINE_(object, ...)
227 GBL_INLINE GBL_RESULT object##_registerProperty_(GblEnum id,
231 GblProperty* pProp = ppProp? *ppProp : GBL_NULL;
237 GBL_CTX_CALL(GblProperty_install(object##_type(), pProp));
238 if(ppProp) *ppProp = pProp;
243#define GBL_PROPERTY_REGISTER_(object, property)
244 GBL_PROPERTY_REGISTER__
(object, GBL_EVAL property)
246#define GBL_PROPERTY_REGISTER__(...)
247 GBL_PROPERTY_REGISTER___
(__VA_ARGS__)
249#define GBL_PROPERTY_REGISTER___(object, name, type, ...)
250 case object##_Property_Id_##name:
252 type##_PROPERTY_TYPE,
256 GBL_PROPERTY_VARARGS_
((__VA_ARGS__))));
259#define GBL_PROPERTY_VARARGS_(...)
262#define GBL_PROPERTY_VARARGS__1(flags)
265#define GBL_PROPERTY_VARARGS__N(...)
268#define GBL_PROPERTY_FLAGS_MASK_(...)
269 GBL_MAP(GBL_PROPERTY_FLAGS_MASK__
, __VA_ARGS__)0
271#define GBL_PROPERTY_FLAGS_MASK__(suffix)
272 GBL_PROPERTY_FLAG_##suffix |
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CTX_VERIFY_CALL(...)
#define GBL_CTX_CALL(...)
#define GBL_CTX_BEGIN(...)
#define GBL_CTX_VERIFY(...)
#define GBL_FORWARD_DECLARE_STRUCT(S)
#define GBL_TYPEID(instanceStruct)
#define GBL_INSTANCE_DERIVE(derivedInstance, baseInstance)
#define GBL_PRIVATE_BEGIN
#define GBL_DECLARE_ENUM(E)
#define GBL_CLASS_DERIVE(...)
#define GBL_PRIVATE_END
Private data structure.
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)
#define GBL_VA_OVERLOAD_CALL(BASE, SUFFIXER,...)
#define GBL_TUPLE_REST(X,...)
#define GBL_TUPLE_FIRST(...)
#define GBL_TUPLE_FOREACH(MACRO_, DATA_, TUPLE_)
#define GBL_VA_OVERLOAD_SUFFIXER_1_N(...)
#define GBL_VA_OVERLOAD_SUFFIXER_ARGC(...)
#define GBL_MAP(f,...)
Applies the function macro f to each of the remaining parameters.
GBL_PROPERTY_FLAG
Flags used to denote property attributes.
@ GBL_PROPERTY_FLAG_READ
Property value can be read.
@ GBL_PROPERTY_FLAG_SAVE_LOAD
Property is both savable and loadable.
@ GBL_PROPERTY_FLAG_ABSTRACT
Property must be implemented by deriving type.
@ GBL_PROPERTY_FLAG_WRITE
Property value can be modified.
@ GBL_PROPERTY_FLAG_LOAD
Property is deserialized when loading.
@ GBL_PROPERTY_FLAG_SAVE
Property is serialized when saving.
@ GBL_PROPERTY_FLAG_CONSTRUCT
Property must be given to the constructor.
@ GBL_PROPERTY_FLAG_OVERRIDE
Property overrides an existing property.
@ GBL_PROPERTY_FLAG_READ_WRITE
Property is both readable and writable.
@ GBL_PROPERTY_FLAG_ALL
Mask for all property flags.
#define GBL_PROPERTY_TYPE
Type UUID for GblProperty.
#define GBL_PROPERTIES_REGISTER(...)
Registeres the list of properties which were declared with GBL_PROPERTIES()
uint32_t GblFlags
Standard-sized flags type, 32-bits across platforms.
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
uintptr_t GblQuark
Uniquely identifiable interned string type.
Represents a string-indexed member of a GblObject.