|
libGimbal 0.2.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
Go to the source code of this file.
Data Structures | |
| struct | GblObjectClass |
| class | GblObject |
Macros | |
| #define | GblObject_foreachChild(...) |
| #define | GblObject_foreachChildReverse(...) |
Type System | |
Type UUID and Cast operators | |
| #define | GBL_OBJECT_TYPE |
| #define | GBL_OBJECT(self) |
| #define | GBL_OBJECT_CLASS(klass) |
| #define | GBL_OBJECT_CLASSOF(self) |
Construction Macros | |
Helper macros for creating new GblObject instances. | |
| #define | GBL_NEW(...) |
| #define | GBL_NEW_AT(...) |
Typedefs | |
| typedef GblBool(* | GblObjectCmpFn) (const GblObject *pObj, void *pClosure) |
User-Operator Callbacks | |
Typedefs for applying various user-supplied functions over a GblObject. | |
| typedef GblBool(* | GblObjectIterFn) (GblObject *pChild, void *pClosure) |
Functions | |
| GblType | GblObject_type (void) |
| GblContext * | GblObject_findContext (GblObject *pSelf) |
Constructors | |
Methods for constructing GblObject-derived types. Each constructor takes a list of property names and values. Values for CONSTRUCT properties are set before GblObjectClass::pFnConstructed is called, and the remaining values are then set as regular writes, as though by GblObject_setProperties(). Construction fails, and the object is torn down, when:
Upon failure, the create functions return NULL, and the construct functions return the error with the given memory left destructed. The error remains available from the thread's last call record. Any other value which is rejected, either because its property is WRITE or because setting it fails, is skipped. The object is still constructed, the result is #GBL_RESULT_INCOMPLETE, and the object must be released as usual. Since #GBL_RESULT_INCOMPLETE is not a success code, callers of the construct functions should check for failure with GBL_RESULT_ERROR(), not GBL_RESULT_SUCCESS(). Unknown property names given as variants are skipped with a warning. Values passed to ACQUIRE properties are moved, and are consumed even when rejected or when construction fails. | |
| GblObject * | GblObject_create (GblType type,...) |
| GblObject * | GblObject_createExt (GblType type, size_t size,...) |
| GBL_RESULT | GblObject_construct (GblObject *pSelf, GblType type,...) |
| GblObject * | GblObject_createWithClass (GblObjectClass *pClass,...) |
| GblObject * | GblObject_createExtWithClass (GblObjectClass *pClass, size_t size,...) |
| GBL_RESULT | GblObject_constructWithClass (GblObject *pSelf, GblObjectClass *pClass,...) |
| GblObject * | GblObject_createVa (GblType type, va_list *pList) |
| GblObject * | GblObject_createExtVa (GblType type, size_t size, va_list *pList) |
| GBL_RESULT | GblObject_constructVa (GblObject *pSelf, GblType type, va_list *pList) |
| GblObject * | GblObject_createVaWithClass (GblObjectClass *pClass, va_list *pList) |
| GblObject * | GblObject_createExtVaWithClass (GblObjectClass *pClass, size_t size, va_list *pList) |
| GBL_RESULT | GblObject_constructVaWithClass (GblObject *pSelf, GblObjectClass *pClass, va_list *pList) |
| GblObject * | GblObject_createVariants (GblType type, size_t propertyCount, const char *pNames[], GblVariant *pValues) |
| GblObject * | GblObject_createVariantsExt (GblType type, size_t size, size_t propertyCount, const char *pNames[], GblVariant *pValues) |
| GBL_RESULT | GblObject_constructVariants (GblObject *pSelf, GblType type, size_t propertyCount, const char *pNames[], GblVariant *pValues) |
| GblObject * | GblObject_createVariantsWithClass (GblObjectClass *pClass, size_t propertyCount, const char *pNames[], GblVariant *pValues) |
| GblObject * | GblObject_createVariantsExtWithClass (GblObjectClass *pClass, size_t size, size_t propertyCount, const char *pNames[], GblVariant *pValues) |
| GBL_RESULT | GblObject_constructVariantsWithClass (GblObject *pSelf, GblObjectClass *pClass, size_t propertyCount, const char *pNames[], GblVariant *pValues) |
GblObject structure and related functions.
This file contains the type definitions and API for GblObject and GblObjectClass. This is the instantiable type which provides the OO meat of the instantiable types– such as properties, hierarchical relationships, event management, generic construction, named instances, etc.
Definition in file gimbal_object.h.
| #define GBL_OBJECT_TYPE |
Definition at line 38 of file gimbal_object.h.
| #define GBL_OBJECT | ( | self | ) |
Casts a GblInstance to a GblObject.
Definition at line 39 of file gimbal_object.h.
| #define GBL_OBJECT_CLASS | ( | klass | ) |
Casts a GblClass to a GblObjectClass.
Definition at line 40 of file gimbal_object.h.
| #define GBL_OBJECT_CLASSOF | ( | self | ) |
Gets a GblObjectClass from a GblInstance.
Definition at line 41 of file gimbal_object.h.
| #define GBL_NEW | ( | ... | ) |
DSL macro used to heap-construct a GblObject-derived type.
It takes the struct name followed by an optional list of property KV pairs.
Definition at line 52 of file gimbal_object.h.
| #define GBL_NEW_AT | ( | ... | ) |
DSL macro used to placement-construct a GblObject-derived type It takes the struct name followed by an optional list of property KV pairs.
Definition at line 57 of file gimbal_object.h.
| #define GblObject_foreachChild | ( | ... | ) |
For-loop style iteration over the children of a GblObject.
Iterates over every child within the given object, setting the item variable to the current child. Optionally takes in a type parameter to specify the type of the children to iterate over.
Definition at line 66 of file gimbal_object.h.
| #define GblObject_foreachChildReverse | ( | ... | ) |
For-loop style iteration over the children of a GblObject, in reverse order.
Iterates over every child within the given object, setting the item variable to the current child. Optionally takes in a type parameter to specify the type of the children to iterate over.
Definition at line 73 of file gimbal_object.h.
Comparator callback function which gets called with a GblObject and an arbitrary closure, returning true if the object matches the desired criteria.
Definition at line 78 of file gimbal_object.h.
Iterator callback function which gets called over every child of a GblObject, being passed back a GblObject and an arbitrary closure, returning true should iteration cease early.
Definition at line 111 of file gimbal_object.h.
Creates an object-derived type on the heap, initializing it with a NULL-terminated K,V pair listing of properties.
Variant of GblObject_create(), where the object is created with an extended size.
| GBL_RESULT GblObject_construct | ( | GblObject * | pSelf, |
| GblType | type, | ||
| ... ) |
Constructs an object-derived type in-place, initializing it with a NULL-terminated K,V pair listing of properties.
| GblObject * GblObject_createWithClass | ( | GblObjectClass * | pClass, |
| ... ) |
Creates an object-derived type on the heap, with the given class, initializing it with a NULL-terminated K,V pair property list.
| GblObject * GblObject_createExtWithClass | ( | GblObjectClass * | pClass, |
| size_t | size, | ||
| ... ) |
Variant of GblObject_createWithClass(), where the object is created with an extended size.
| GBL_RESULT GblObject_constructWithClass | ( | GblObject * | pSelf, |
| GblObjectClass * | pClass, | ||
| ... ) |
Constructs an object-derived type in-place, with the given class, initializing it with a NULL-terminated K,V pair property list.
Variant of GblObject_create(), where the property list is provided as a va_list pointer.
Variant of GblObject_createVaList(), 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_createExtVaWithClass | ( | GblObjectClass * | pClass, |
| size_t | size, | ||
| va_list * | pList ) |
Variant of GblObject_createVaListWithClass(), 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.
| 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 corresponding array of names.
| 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_constructVariants | ( | GblObject * | pSelf, |
| GblType | type, | ||
| size_t | propertyCount, | ||
| const char * | pNames[], | ||
| GblVariant * | pValues ) |
Creates an object-derived type in-place, initializing it with an array of property values and a corresponding array of names.
| 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 given class.
| 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.
| 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 the given class.
| GblContext * GblObject_findContext | ( | GblObject * | pSelf | ) |