libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
Go to the source code of this file.
Data Structures | |
struct | GblVariant |
Macros | |
#define | GBL_VARIANT_INIT |
#define | GBL_VARIANT(name) |
#define | GblVariant_construct(...) |
#define | GblVariant_set(pVariant, ...) |
Typedefs | |
typedef GBL_RESULT(* | GblVariantConverterFn) (const GblVariant *pSelf, GblVariant *pOther) |
Functions | |
GblBool | GblVariant_checkTypeCompatible (GblType type) |
const char * | GblVariant_typeName (const GblVariant *pSelf) |
GblVariant structure and related functions.
This file contains the GblVariant type and its associated API. GblVariant is the core, fundamental dynamically-typed structure capable of representing any type that is known to the type system uniformly.
The convenience wrappers provide a wide variety of methods around a set of fundamental, low-level calls, which perform standard GblVariant lifetime and value management in a type-generic way:
GblVariant v; // Always construct a variant before using it GblVariant_constructValueCopy(&v GBL_FLOAT_TYPE, -17.0f); // You can now fetch its value as a float float f = 0.0f; GblVariant_valueCopy(&v, GBL_FLOAT_TYPE, &f); // or GblVariant_float() GBL_ASSERT(f == -17.0f); // You can now freely assign and change its value // Lets do so by "moving" a reference to a GblObject into it GblVariant_setValueMove(&v, GBL_OBJECT_TYPE, GBL_NEW(GblObject)); // ALWAYS call the destructor when it leaves scope to free resources // this will release the otherwise leaked reference to the new GblObject GblVariant_destruct(&v);
Definition in file gimbal_variant.h.
#define GBL_VARIANT_INIT |
Convience macro for GblVariant value initialization.
Definition at line 55 of file gimbal_variant.h.
#define GBL_VARIANT | ( | name | ) |
Convience macro for declaring and initalizing a GblVariant.
Definition at line 57 of file gimbal_variant.h.
#define GblVariant_construct | ( | ... | ) |
Convenience macro providing a generically-typed constructor method.
Definition at line 60 of file gimbal_variant.h.
#define GblVariant_set | ( | pVariant, | |
... | |||
) |
Convenience macro providing a generically-typed assignment method.
Definition at line 62 of file gimbal_variant.h.
typedef GBL_RESULT(* GblVariantConverterFn) (const GblVariant *pSelf, GblVariant *pOther) |
Function signature for a type converter to be used with GblVariant_registerConverter()
Definition at line 72 of file gimbal_variant.h.
Checks whether the given value can be represented by a GblVariant (implements GblIVariant)
const char * GblVariant_typeName | ( | const GblVariant * | pSelf | ) |
Retrives the GblType UUID of the value contained by the given variant.