libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_object.h
Go to the documentation of this file.
1/*! \file
2 * \brief GblObject structure and related functions
3 * \ingroup meta
4 *
5 * This file contains the type definitions and API for
6 * GblObject and GblObjectClass. This is the instantiable
7 * type which provides the OO meat of the instantiable types--
8 * such as properties, hierarchial relationships, event management,
9 * generic construction, named instances, etc.
10 *
11 * \author 2023, 2024, 2025 Falco Girgis
12 * \author 2025 Agustín Bellagamba
13 * \copyright MIT License
14 *
15 * \todo
16 * - Uninstall all signals upon class destructor (with property uninstallation)
17 * - Get rid of GblObject_findContext()
18 * - GblObject_set/addChildren() with propertyChange() signal
19 *
20 * \test
21 * - GblObjectClass::pFnConstructed() with CONSTRUCTOR properties.
22 * - GblObjectClass::pFnInitialized() with WRITE properties.
23 * - GblObject_isConstructing().
24 * - GblObject_isInstantiating().
25 * - GblObject implementing ABSTRACT properties from GblInterface.
26 */
27#ifndef GIMBAL_OBJECT_H
28#define GIMBAL_OBJECT_H
29
30#include "gimbal_box.h"
31#include "../ifaces/gimbal_itable_variant.h"
32#include "../ifaces/gimbal_ievent_receiver.h"
33#include "../properties/gimbal_property.h"
34#include "../../containers/gimbal_ring_list.h"
35
36/*! \name Type System
37 * \brief Type UUID and Cast operators
38 * @{
39 */
40#define GBL_OBJECT_TYPE GBL_TYPEID(GblObject) //!< GblType UUID for GblObject
41#define GBL_OBJECT(self) GBL_CAST(GblObject, self) //!< Casts a GblInstance to a GblObject
42#define GBL_OBJECT_CLASS(klass) GBL_CLASS_CAST(GblObject, klass) //!< Casts a GblClass to a GblObjectClass
43#define GBL_OBJECT_GET_CLASS(self) GBL_CLASSOF(GblObject, self) //!< Gets a GblObjectClass from a GblInstance
44//! @}
45
46/*! \name Construction Macros
47 * \brief Helper macros for creating new GblObject instances.
48 * @{
49 */
50
51 /*! \brief DSL macro used to heap-construct a GblObject-derived type.
52 * It takes the struct name followed by an optional list of property KV pairs.
53 */
54#define GBL_NEW(/*type, ("key", value),*/ ...) GBL_OBJECT_NEW(__VA_ARGS__)
55
56/*! \brief DSL macro used to placement-construct a GblObject-derived type
57 * It takes the struct name followed by an optional list of property KV pairs.
58 */
59#define GBL_NEW_AT(/*type, self, ("key", value),*/ ...) GBL_OBJECT_NEW_AT(__VA_ARGS__)
60
61//! @}
62
63#define GBL_SELF_TYPE GblObject
64
66
68
69/*! \struct GblObjectClass
70 * \extends GblBoxClass
71 * \implements GblITableVariantClass
72 * \implements GblIEventReceiverClass
73 * \brief GblClass structure for GblObject
74 *
75 * GblObjectClass provides the virtual table for all types
76 * deriving from GblObject. It provides a constructor, event
77 * handlers, as well as accessors for reading and writing properties.
78 */
79GBL_CLASS_DERIVE(GblObject, GblBox,
80 GblITableVariant, GblIEventReceiver)
81 //! Virtual method called during construction after CONSTRUCT properties but before extra WRITE properties are set
82 GBL_RESULT (*pFnConstructed) (GBL_SELF);
83 //! Virtual method called when the object has been fully instantiated with all properties it was created with (including extra WRITE properties being set).
84 GBL_RESULT (*pFnInstantiated)(GBL_SELF);
85 //! Virtual method for reading properties
86 GBL_RESULT (*pFnProperty) (GBL_CSELF, const GblProperty* pProp, GblVariant* pValue);
87 //! Virtaul method for writing properties
88 GBL_RESULT (*pFnSetProperty) (GBL_SELF, const GblProperty* pProp, GblVariant* pValue);
90
91/*! \class GblObject
92 * \extends GblBox
93 * \implements GblITableVariant
94 * \implements GblIEventReceiver
95 * \ingroup meta
96 * \brief Main Object-Oriented Instance with Properties, EventReceivers, and Parenting
97 *
98 * A GblObject is the default, full-blown object-oriented instantiable type.
99 * It is analogous to Qt's "QObject" or GNOME's "GObject" root type. It extends
100 * GblBox to add the following additonal functionality:
101 * - properties
102 * - GblVariant table operations
103 * - constructor / post-constructor
104 * - event handling and filtering
105 * - object parenting and hierarchy
106 * - object name
107 *
108 * \note
109 * A GblObject by default has the same size of a GblBox. Additional data for
110 * fields such as name, parent, children, event filters, etc are created lazily
111 * and are stored within GblBox::pFields.
112 *
113 * \sa GblBox, GblObjectClass, GblProperty
114 */
116
117//! \cond
118GBL_PROPERTIES(GblObject,
119 (name, GBL_GENERIC, (READ, WRITE, LOAD, SAVE), GBL_STRING_TYPE),
120 (parent, GBL_GENERIC, (READ, WRITE), GBL_OBJECT_TYPE),
121 (children, GBL_GENERIC, (READ, WRITE, IN, OUT), GBL_RING_LIST_TYPE),
122 (userdata, GBL_GENERIC, (READ, WRITE), GBL_POINTER_TYPE),
123 (refCount, GBL_GENERIC, (READ), GBL_UINT16_TYPE)
124// (class, GBL_GENERIC, (READ, WRITE, CONSTRUCT), GBL_POINTER_TYPE)
125)
126
127GBL_SIGNALS(GblObject,
128 (propertyChange, (GBL_INSTANCE_TYPE, pReciever), (GBL_BOX_TYPE, pProperty))
129)
130//! \endcond
131
132//! Returns the GblType UUID associated with GblObject
134
135/*! \name Constructors
136 * \brief Methods for constructing GblObject-derived types.
137 * @{
138 */
139//! Creates an object-derived type on the heap, intializing it with a NULL-terminated K,V pair listing of properties
141//! Variant of GblObject_create(), where the object is created with an extended size
142GBL_EXPORT GblObject* GblObject_createExt (GblType type, size_t size, ...) GBL_NOEXCEPT;
143//! Constructs an object-derived type in-place, initializing it with a NULL-terminated K,V pair listing of properties
145//! Creates an object-derived type on the heap, with the given class, initializing it with a NULL-terminated K,V pair property list
146GBL_EXPORT GblObject* GblObject_createWithClass (GblObjectClass* pClass, ...) GBL_NOEXCEPT;
147//! Variant of GblObject_createWithClass(), where the object is created with an extended size
148GBL_EXPORT GblObject* GblObject_createExtWithClass (GblObjectClass* pClass, size_t size, ...) GBL_NOEXCEPT;
149//! Constructs an object-derived type in-place, with the given class, initializing it with a NULL-terminated K,V pair property list
150GBL_EXPORT GBL_RESULT GblObject_constructWithClass (GBL_SELF, GblObjectClass* pClass, ...) GBL_NOEXCEPT;
151//! Variant of GblObject_create(), where the property list is provided as a va_list pointer
152GBL_EXPORT GblObject* GblObject_createVa (GblType type, va_list* pList) GBL_NOEXCEPT;
153//! Variant of GblObject_createVaList(), where the object is created with an extended size
154GBL_EXPORT GblObject* GblObject_createExtVa (GblType type, size_t size, va_list* pList) GBL_NOEXCEPT;
155//! Variant of GblObject_construct(), where the property list is provided as a va_list pointer
157//! Variant of GblObject_createWithClass(), where the property list is provided as a va_list pointer
158GBL_EXPORT GblObject* GblObject_createVaWithClass (GblObjectClass* pClass, va_list* pList) GBL_NOEXCEPT;
159//! Variant of GblObject_createVaListWithClass(), where the object is allocated with an extended size
160GBL_EXPORT GblObject* GblObject_createExtVaWithClass (GblObjectClass* pClass,
161 size_t size,
162 va_list* pList) GBL_NOEXCEPT;
163//! Variant of GblObjecT_constructWithClass(), where the property list is provided as a va_list pointer
165 GblObjectClass* pClass,
166 va_list* pList) GBL_NOEXCEPT;
167//! Creates an object-derived type on the heap, initializing it with an array of property values and a corresponding array of names
169 size_t propertyCount,
170 const char* pNames[],
171 GblVariant* pValues) GBL_NOEXCEPT;
172//! Variant of GblObject_createVariants(), where the object is allocated with an extended size
174 size_t size,
175 size_t propertyCount,
176 const char* pNames[],
177 GblVariant* pValues) GBL_NOEXCEPT;
178//! Creates an object-derived type in-place, initiailzing it with an array of property values and a corresponding array of names
180 GblType type,
181 size_t propertyCount,
182 const char* pNames[],
183 GblVariant* pValues) GBL_NOEXCEPT;
184//! Variant of GblObject_createVariants(), where the object is constructed with a weak reference to the given class
186 (GblObjectClass* pClass,
187 size_t propertyCount,
188 const char* pNames[],
189 GblVariant* pValues) GBL_NOEXCEPT;
190//! Variant of GblObject_createVariantsWithClass(), where the object is allocated with an extended size
192 (GblObjectClass* pClass,
193 size_t size,
194 size_t propertyCount,
195 const char* pNames[],
196 GblVariant* pValues) GBL_NOEXCEPT;
197//! Variant of GblObject_constructVariants(), where the object is constructed with a weak reference to the given class
199 (GBL_SELF,
200 GblObjectClass* pClass,
201 size_t propertyCount,
202 const char* pNames[],
203 GblVariant* pValues) GBL_NOEXCEPT;
204//! @}
205
206/*! \name Reading Properties
207 * \brief Methods for retrieving property values.
208 * \relatesalso GblObject
209 * @{
210 */
211//! Looks up the property on the object by name, storing its value in the pointer passed as a variadic argument
212GBL_EXPORT GBL_RESULT GblObject_property (GBL_CSELF, const char* pName, ...) GBL_NOEXCEPT;
213//! Looks up the property on the object by quark (faster), storing its value in the pointer passed as a variadic argument
215//! Variant of GblObject_property() with the pointer for storing the value specified by a pointer to a va_list
216GBL_EXPORT GBL_RESULT GblObject_propertyVaList (GBL_CSELF, const char* pName, va_list* pList) GBL_NOEXCEPT;
217//! Variant of GblObject_propertyVaList() with the name being specified by a quark (faster lookups)
219//! Fetches the value of the specified property, storing it within a variant
220GBL_EXPORT GBL_RESULT GblObject_propertyVariant (GBL_CSELF, const char* pName, GblVariant* pValue) GBL_NOEXCEPT;
221//! Variant of GblObject_propertyVariant(), with the property name specified as a quark (faster lookups)
223//! Takes a NULL-terminated K,V pair list of string property names and pointers to store their values within
225//! Variant of GblObject_properties() with the NULL-terminated K,V pair list being specified as a pointer to a va_list
227//! Looks up multiple properties by the names provided by the \p pNames list and stores them within the array of GblVariants
229 size_t count,
230 const char* pNames[],
231 GblVariant* pValue) GBL_NOEXCEPT;
232
233/*! \name Writing Properties
234 * \brief Methods for settingproperty values.
235 * \relatesalso GblObject
236 * @{
237 */
238//! Sets the property with the given string name to the value given by the pointer passed through the variadic argument list
239GBL_EXPORT GBL_RESULT GblObject_setProperty (GBL_SELF, const char* pName, ...) GBL_NOEXCEPT;
240//! Variant of GblObject_setProperty() with the name being specified as a quark (for faster lookups)
242//! Variant of GblObject_setProperty() with the pointer for storing the value being specified as a pointer to a va_list
243GBL_EXPORT GBL_RESULT GblObject_setPropertyVa (GBL_SELF, const char* pName, va_list* pList) GBL_NOEXCEPT;
244//! Variant of GblObject_setPropertyVaList() with the name being specified as a quark (for faster lookups)
246//! Variant of GblObject_setProperty() where the property value is provided as a GblVariant
247GBL_EXPORT GBL_RESULT GblObject_setPropertyVariant (GBL_SELF, const char* pName, GblVariant* pValue) GBL_NOEXCEPT;
248//! Variant of GblObject_setPropertyVariant() where the property name is provided as a quark (for faster lookups)
250//! Sets multiple properties by taking a NULL-terminated K,V pairs list of string names and pointers to store the values within
252//! Variant of Gblobject_setProperties() where the NULL-termianted K,V pairs list is specified as apointer to a va_list
254//! Sets the properties specified by the list of names to the corresponding values specified as the list of GblVariants
256 size_t count,
257 const char* pNames[],
258 GblVariant* pValue) GBL_NOEXCEPT;
259//! @}
260
261/*! \name Property Notification
262 * \brief Methods involving property changed notifiers.
263 * \relatesalso GblObject
264 * @{
265 */
266//! Notifies any listeners that the value of a property has changed internally, by emitting the "propertyChanged" signal.
268//! Equivalent to GblObject_emitPropertyChange(), except that the property lookup is done more efficiently by using a quark for its name.
270//! Disables or enables emission of the "propertyChange" signal, returning its previous enablement. Typically you want to only do this temporarily and restore its previous state when done.
272//! Returns true if emission of the "propertyChange" signal has been blocked on the current object or false if it is enabled.
274//! @}
275
276/*! \name State Management
277 * \brief Methods for querying GblObject state.
278 * \relatesalso GblObject
279 * @{
280 */
281//! Returns true from the time the object has been allocated to the time its final (possibly optional) initial properties have been set.
283//! Returns true immediately after type initializers are called, but before GblObject::pFnConstructed() is called with the initial constructor properties.
285//! @}
286
287/*! \name Name Accessors
288 * \brief Methods for reading and writing object name
289 * \relatesalso GblObject
290 * @{
291 */
292//! Retrieves the name of the given object or returns an empty string if it doesn't have one
294//! Sets the name of the given object to \p pName, making a copy of its contents to store internally
296//! Sets the name of the given object to \p pRef, taking ownership of the given reference
298//! @}
299
300/*! \name Hierarchy Management
301 * \brief Methods for parenting, traversing, or querying object trees
302 * \relatesalso GblObject
303 * @{
304 */
305//! Returns a poiner to the parent of the given object, or NULL if it doesn't have one
307//! Sets the parent of the given object to \p pParent
309//! Adds \p pChild as a child of the given object, setting itself as the parent
311//! Removes \p pChild from being a child of the given object, setting its parent to NULL
313//! Returns the number of levels deep the given object is in the object tree formed by its ancestors
315//! Returns a pointer to the first child of the given object, or NULL if it has none
317//! Returns the number of children with the given object as their parent
319//! Returns the index of the given object in its parent's list of children
321//! Returns the next sibling after the given object, forming a linked list of their parents' children
323//! Returns the next sibling after the given object that is of \p type, or NULL if there isn't one
325//! Returns the next sibling after the given object with the given name, or NULL if there isn't one
327//! Returns the previous sibling before the given object, forming a linked list of their parents' children
329//! Returns the previous sibling before the given object that is of \p type, or NULL if there isn't one
331//! Returns the previous sibling before the given object with the given name, or NULL if there isn't one
333
334
335//! Returns a pointer to the closest ancestor object of the given object that is of \p ancestorType, or NULL if there isn't one
337//! Returns a pointer to the first ancestor found with the given name or NULL if none were found
339//! Returns a pointer to the ancestor object of the given object at the specified \p height, with 1 being the direct parent
341//! Starting at the root object, returns a pointer to the ancestor of the given object at the specified depth, or NULL if there isn't one
343//! Searches through the list of children on the given object, returning a pointer to the first one with the given type, or NULL if there isn't one
345//! Searches through the list of children on the given object, returning a pointer to the first one with the given name, or NULL if there isn't one
347//! Iterates sequentially over the list of children on the given object, returning a pointer to the one at the given type, or NULL if there isn't one
349//! Iterates sequentially over the list of siblings to the given object, returning a pointer to the first one of the given type, or NULL if there isn't one
351//! Iterates sequentially over the list of siblings to the given object, returning a pointer to the first one with the given name, or NULL if there isn't one
353//! Iterates sequentially over thelist of siblings to the given object, returning a pointer to the one at the given index, or NULL if there isn't one
355//! @}
356
357/*! \name Event Management
358 * \brief Methods for sending, notifying, and filtering events
359 * \relatesalso GblObject
360 * @{
361 */
362//! Emits an event upwards through the object hierarchy, notifying the parent of the given object of the event
364//! Notifies the given object of an event, which first propagates through its event filters before going through its event handler and propagating up if still unhandled
366//! Installs the event filter on the given object, allowing it to intercept event notifications
367GBL_EXPORT GBL_RESULT GblObject_installEventFilter (GBL_SELF, GblIEventReceiver* pFilter) GBL_NOEXCEPT;
368//! Removes the event filter from the given object, so that it no longer intercepts event notifications
369GBL_EXPORT GBL_RESULT GblObject_uninstallEventFilter (GBL_SELF, GblIEventReceiver* pFilter) GBL_NOEXCEPT;
370//! Returns the number of event filters currently installed on the given object
372//! Returns a pointer to the event filter installed on the given object at the \p index position
373GBL_EXPORT GblIEventReceiver* GblObject_eventFilter (GBL_CSELF, size_t index) GBL_NOEXCEPT;
374//! @}
375
376//! \deprecated
378
380
381///\cond
382#define GBL_OBJECT_NEW(...) GBL_VA_OVERLOAD_CALL(GBL_OBJECT_NEW, GBL_VA_OVERLOAD_SUFFIXER_1_N, __VA_ARGS__)
383
384#define GBL_OBJECT_NEW_1(typeName) ((typeName*)GblObject_create(GBL_TYPEID(typeName), GBL_NULL))
385#define GBL_OBJECT_NEW_N(...) ((GBL_TUPLE_FIRST(__VA_ARGS__)*)GblObject_create(GBL_TYPEID(GBL_TUPLE_FIRST(__VA_ARGS__)),
386 GBL_TUPLE_REST(__VA_ARGS__), NULL))
387
388#define GBL_OBJECT_NEW_AT(cType, instance, ...) (GblObject_construct(instance,GBL_TYPEID(cType), __VA_ARGS__, NULL))
389///\endcond
390
391#undef GBL_SELF_TYPE
392
393#endif // GIMBAL_OBJECT_H
#define GBL_NULL
#define GBL_NOEXCEPT
#define GBL_DECLS_BEGIN
#define GBL_FORWARD_DECLARE_STRUCT(S)
#define GBL_TYPEID(instanceStruct)
#define GBL_CLASS_DERIVE(...)
#define GBL_EXPORT
#define GBL_CLASS_END
#define GBL_INSTANCE_DERIVE_EMPTY(derived, base)
#define GBL_VA_OVERLOAD_CALL(BASE, SUFFIXER,...)
#define GBL_TUPLE_REST(X,...)
#define GBL_TUPLE_FIRST(...)
#define GBL_VA_OVERLOAD_SUFFIXER_1_N(...)
GblObject * GblObject_createVariants(GblType type, size_t propertyCount, const char *pNames[], GblVariant *pValues)
Creates an object-derived type on the heap, initializing it with an array of property values and a co...
GBL_RESULT GblObject_constructWithClass(GblObject *pSelf, GblObjectClass *pClass,...)
Constructs an object-derived type in-place, with the given class, initializing it with a NULL-termina...
GblObject * GblObject_createVariantsWithClass(GblObjectClass *pClass, size_t propertyCount, const char *pNames[], GblVariant *pValues)
Variant of GblObject_createVariants(), where the object is constructed with a weak reference to the g...
GblObject * GblObject_createVa(GblType type, va_list *pList)
Variant of GblObject_create(), where the property list is provided as a va_list pointer.
GblObject * GblObject_createExtVaWithClass(GblObjectClass *pClass, size_t size, va_list *pList)
Variant of GblObject_createVaListWithClass(), where the object is allocated with an extended size.
GblObject * GblObject_createWithClass(GblObjectClass *pClass,...)
Creates an object-derived type on the heap, with the given class, initializing it with a NULL-termina...
GBL_RESULT GblObject_construct(GblObject *pSelf, GblType type,...)
Constructs an object-derived type in-place, initializing it with a NULL-terminated K,...
GblObject * GblObject_createExtVa(GblType type, size_t size, va_list *pList)
Variant of GblObject_createVaList(), where the object is created with an extended size.
GBL_RESULT GblObject_constructVariantsWithClass(GblObject *pSelf, GblObjectClass *pClass, size_t propertyCount, const char *pNames[], GblVariant *pValues)
Variant of GblObject_constructVariants(), where the object is constructed with a weak reference to th...
GblType GblObject_type(void)
Returns the GblType UUID associated with GblObject.
GblObject * GblObject_createExt(GblType type, size_t size,...)
Variant of GblObject_create(), where the object is created with an extended size.
GBL_RESULT GblObject_constructVa(GblObject *pSelf, GblType type, va_list *pList)
Variant of GblObject_construct(), where the property list is provided as a va_list pointer.
GblObject * GblObject_createVaWithClass(GblObjectClass *pClass, va_list *pList)
Variant of GblObject_createWithClass(), where the property list is provided as a va_list pointer.
GblObject * GblObject_create(GblType type,...)
Creates an object-derived type on the heap, intializing it with a NULL-terminated K,...
GblObject * GblObject_createExtWithClass(GblObjectClass *pClass, size_t size,...)
Variant of GblObject_createWithClass(), where the object is created with an extended size.
GblContext * GblObject_findContext(GblObject *pSelf)
GblObject * GblObject_createVariantsExt(GblType type, size_t size, size_t propertyCount, const char *pNames[], GblVariant *pValues)
Variant of GblObject_createVariants(), where the object is allocated with an extended size.
GBL_RESULT GblObject_constructVaWithClass(GblObject *pSelf, GblObjectClass *pClass, va_list *pList)
Variant of GblObjecT_constructWithClass(), where the property list is provided as a va_list pointer.
GBL_RESULT GblObject_constructVariants(GblObject *pSelf, GblType type, size_t propertyCount, const char *pNames[], GblVariant *pValues)
Creates an object-derived type in-place, initiailzing it with an array of property values and a corre...
#define GBL_OBJECT_TYPE
GblType UUID for GblObject.
GblObject * GblObject_createVariantsExtWithClass(GblObjectClass *pClass, size_t size, size_t propertyCount, const char *pNames[], GblVariant *pValues)
Variant of GblObject_createVariantsWithClass(), where the object is allocated with an extended size.
#define GBL_UINT16_TYPE
Builtin ID for uint16_t GblVariant type.
#define GBL_STRING_TYPE
Builtin ID for string GblVariant type.
#define GBL_PROPERTIES(object,...)
Declares a list of properties for the given object/instance structure.
#define GBL_RING_LIST_TYPE
Type UUID for GblRingList.
#define GBL_SIGNALS(instanceStruct,...)
Declares a list of signals to be associated with the given instanceStruct.
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
#define GBL_POINTER_TYPE
uintptr_t GblType
Meta Type UUID.
Definition gimbal_type.h:52
uintptr_t GblQuark
Uniquely identifiable interned string type.
const char GblStringRef
Reference-counted, const char*-compatible string type.
Main Object-Oriented Instance with Properties, EventReceivers, and Parenting.
void GblObject_addChild(GblObject *pSelf, GblObject *pChild)
Adds pChild as a child of the given object, setting itself as the parent.
GBL_RESULT GblObject_properties(const GblObject *pSelf,...)
Takes a NULL-terminated K,V pair list of string property names and pointers to store their values wit...
GblObject * GblObject_findBaseByDepth(const GblObject *pSelf, size_t depth)
Starting at the root object, returns a pointer to the ancestor of the given object at the specified d...
GblObject * GblObject_parent(const GblObject *pSelf)
Returns a poiner to the parent of the given object, or NULL if it doesn't have one.
size_t GblObject_depth(const GblObject *pSelf)
Returns the number of levels deep the given object is in the object tree formed by its ancestors.
GBL_RESULT GblObject_emitPropertyChange(const GblObject *pSelf, const char *pName)
Notifies any listeners that the value of a property has changed internally, by emitting the "property...
GBL_RESULT GblObject_setPropertiesVa(GblObject *pSelf, va_list *pList)
Variant of Gblobject_setProperties() where the NULL-termianted K,V pairs list is specified as apointe...
GblObject * GblObject_findChildByIndex(const GblObject *pSelf, size_t index)
Iterates sequentially over the list of children on the given object, returning a pointer to the one a...
GblObject * GblObject_siblingPreviousByName(const GblObject *pSelf, const char *pName)
Returns the previous sibling before the given object with the given name, or NULL if there isn't one.
GblBool GblObject_isInstantiating(const GblObject *pSelf)
Returns true from the time the object has been allocated to the time its final (possibly optional) in...
GblObject * GblObject_findSiblingByType(const GblObject *pSelf, GblType siblingType)
Iterates sequentially over the list of siblings to the given object, returning a pointer to the first...
void GblObject_setParent(GblObject *pSelf, GblObject *pParent)
Sets the parent of the given object to pParent.
GblBool GblObject_propertyChangeBlocked(const GblObject *pSelf)
Returns true if emission of the "propertyChange" signal has been blocked on the current object or fal...
GblObject * GblObject_findSiblingByName(const GblObject *pSelf, const char *pName)
Iterates sequentially over the list of siblings to the given object, returning a pointer to the first...
GblObject * GblObject_findAncestorByType(const GblObject *pSelf, GblType ancestorType)
Returns a pointer to the closest ancestor object of the given object that is of ancestorType,...
GblObject * GblObject_siblingNext(const GblObject *pSelf)
Returns the next sibling after the given object, forming a linked list of their parents' children.
GBL_RESULT GblObject_property(const GblObject *pSelf, const char *pName,...)
Looks up the property on the object by name, storing its value in the pointer passed as a variadic ar...
GBL_RESULT GblObject_propertyVariant(const GblObject *pSelf, const char *pName, GblVariant *pValue)
Fetches the value of the specified property, storing it within a variant.
GBL_RESULT GblObject_setProperty(GblObject *pSelf, const char *pName,...)
Sets the property with the given string name to the value given by the pointer passed through the var...
GBL_RESULT GblObject_propertiesVa(const GblObject *pSelf, va_list *pList)
Variant of GblObject_properties() with the NULL-terminated K,V pair list being specified as a pointer...
GBL_RESULT GblObject_propertyVaByQuark(const GblObject *pSelf, GblQuark name, va_list *pList)
Variant of GblObject_propertyVaList() with the name being specified by a quark (faster lookups)
GblObject * GblObject_siblingPreviousByType(const GblObject *pSelf, GblType type)
Returns the previous sibling before the given object that is of type, or NULL if there isn't one.
GblBool GblObject_removeChild(GblObject *pSelf, GblObject *pChild)
Removes pChild from being a child of the given object, setting its parent to NULL.
GBL_RESULT GblObject_setPropertyVariant(GblObject *pSelf, const char *pName, GblVariant *pValue)
Variant of GblObject_setProperty() where the property value is provided as a GblVariant.
size_t GblObject_childCount(const GblObject *pSelf)
Returns the number of children with the given object as their parent.
GblBool GblObject_blockPropertyChange(GblObject *pSelf, GblBool blocked)
Disables or enables emission of the "propertyChange" signal, returning its previous enablement....
GblObject * GblObject_findChildByType(const GblObject *pSelf, GblType childType)
Searches through the list of children on the given object, returning a pointer to the first one with ...
GBL_RESULT GblObject_propertyByQuark(const GblObject *pSelf, GblQuark name,...)
Looks up the property on the object by quark (faster), storing its value in the pointer passed as a v...
GblObject * GblObject_childFirst(const GblObject *pSelf)
Returns a pointer to the first child of the given object, or NULL if it has none.
GBL_RESULT GblObject_emitPropertyChangeByQuark(const GblObject *pSelf, GblQuark name)
Equivalent to GblObject_emitPropertyChange(), except that the property lookup is done more efficientl...
void GblObject_setName(GblObject *pSelf, const char *pName)
Sets the name of the given object to pName, making a copy of its contents to store internally.
GblIEventReceiver * GblObject_eventFilter(const GblObject *pSelf, size_t index)
Returns a pointer to the event filter installed on the given object at the index position.
GBL_RESULT GblObject_propertyVaList(const GblObject *pSelf, const char *pName, va_list *pList)
Variant of GblObject_property() with the pointer for storing the value specified by a pointer to a va...
GBL_RESULT GblObject_propertiesVariants(const GblObject *pSelf, size_t count, const char *pNames[], GblVariant *pValue)
Looks up multiple properties by the names provided by the pNames list and stores them within the arra...
GBL_RESULT GblObject_sendEvent(GblObject *pSelf, GblEvent *pEvent)
Emits an event upwards through the object hierarchy, notifying the parent of the given object of the ...
GBL_RESULT GblObject_setPropertyVa(GblObject *pSelf, const char *pName, va_list *pList)
Variant of GblObject_setProperty() with the pointer for storing the value being specified as a pointe...
GblObject * GblObject_findSiblingByIndex(const GblObject *pSelf, size_t index)
Iterates sequentially over thelist of siblings to the given object, returning a pointer to the one at...
GBL_RESULT GblObject_setPropertyVaListByQuark(GblObject *pSelf, GblQuark name, va_list *pList)
Variant of GblObject_setPropertyVaList() with the name being specified as a quark (for faster lookups...
GblStringRef * GblObject_name(const GblObject *pSelf)
Retrieves the name of the given object or returns an empty string if it doesn't have one.
GBL_RESULT GblObject_installEventFilter(GblObject *pSelf, GblIEventReceiver *pFilter)
Installs the event filter on the given object, allowing it to intercept event notifications.
GblObject * GblObject_findAncestorByName(const GblObject *pSelf, const char *pName)
Returns a pointer to the first ancestor found with the given name or NULL if none were found.
GBL_RESULT GblObject_uninstallEventFilter(GblObject *pSelf, GblIEventReceiver *pFilter)
Removes the event filter from the given object, so that it no longer intercepts event notifications.
size_t GblObject_eventFilterCount(const GblObject *pSelf)
Returns the number of event filters currently installed on the given object.
GBL_RESULT GblObject_propertyVariantByQuark(const GblObject *pSelf, GblQuark name, GblVariant *pValue)
Variant of GblObject_propertyVariant(), with the property name specified as a quark (faster lookups)
void GblObject_setNameRef(GblObject *pSelf, GblStringRef *pRef)
Sets the name of the given object to pRef, taking ownership of the given reference.
size_t GblObject_childIndex(const GblObject *pSelf)
Returns the index of the given object in its parent's list of children.
GblObject * GblObject_siblingPrevious(const GblObject *pSelf)
Returns the previous sibling before the given object, forming a linked list of their parents' childre...
GBL_RESULT GblObject_setProperties(GblObject *pSelf,...)
Sets multiple properties by taking a NULL-terminated K,V pairs list of string names and pointers to s...
GBL_RESULT GblObject_setPropertyByQuark(GblObject *pSelf, GblQuark quark,...)
Variant of GblObject_setProperty() with the name being specified as a quark (for faster lookups)
GBL_RESULT GblObject_notifyEvent(GblObject *pSelf, GblEvent *pEvent)
Notifies the given object of an event, which first propagates through its event filters before going ...
GblObject * GblObject_siblingNextByName(const GblObject *pSelf, const char *pName)
Returns the next sibling after the given object with the given name, or NULL if there isn't one.
GblObject * GblObject_siblingNextByType(const GblObject *pSelf, GblType type)
Returns the next sibling after the given object that is of type, or NULL if there isn't one.
GBL_RESULT GblObject_setPropertyVariantByQuark(GblObject *pSelf, GblQuark name, GblVariant *pValue)
Variant of GblObject_setPropertyVariant() where the property name is provided as a quark (for faster ...
GBL_RESULT GblObject_setPropertiesVariants(GblObject *pSelf, size_t count, const char *pNames[], GblVariant *pValue)
Sets the properties specified by the list of names to the corresponding values specified as the list ...
GblBool GblObject_isConstructing(const GblObject *pSelf)
Returns true immediately after type initializers are called, but before GblObject::pFnConstructed() i...
GblObject * GblObject_findAncestorByHeight(const GblObject *pSelf, size_t height)
Returns a pointer to the ancestor object of the given object at the specified height,...
GblObject * GblObject_findChildByName(const GblObject *pSelf, const char *pName)
Searches through the list of children on the given object, returning a pointer to the first one with ...