libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_itable_variant.h
1#ifndef GIMBAL_ITABLE_VARIANT_H
2#define GIMBAL_ITABLE_VARIANT_H
3
5
6/*! \name Type System
7 * \brief Type UUID and cast operators
8 * @{
9 */
10#define GBL_ITABLE_VARIANT_TYPE (GBL_TYPEID(GblITableVariant)) //!< Type UUID for GblITableVariant
11#define GBL_ITABLE_VARIANT(self) (GBL_CAST(GblITableVariant, self)) //!< Casts a GblInstance to GblITableVariant
12#define GBL_ITABLE_VARIANT_CLASS(klass) (GBL_CLASS_CAST(GblITableVariant, klass)) //!< Casts a GblClass to GblITableVariantClass
13#define GBL_ITABLE_VARIANT_GET_CLASS(self) (GBL_CLASSOF(GblITableVariant, self)) //!< Gets a GblITableVariantClass from a GblInstance
14//! @}
15
16#define GBL_SELF_TYPE GblVariant
17
19
20/*! \struct GblITableVariantClass
21 * \extends GblInterface
22 * \brief GblClass structure for GblITableVariant
23 *
24 * Provides overridable virtual methods which are roughly
25 * analogous to the Lua __index, __newIndex, and __length
26 * metamethods used for managing table accesses.
27 *
28 * \sa GblITableVariant
29 */
30GBL_INTERFACE_DERIVE(GblITableVariant)
31 GBL_RESULT (*pFnIndex) (GBL_CSELF, const GblVariant* pKey, GblVariant* pValue);
32 GBL_RESULT (*pFnSetIndex)(GBL_CSELF, const GblVariant* pKey, GblVariant* pValue);
33 GBL_RESULT (*pFnNext) (GBL_CSELF, GblVariant* pKey, GblVariant* pValue);
34 GBL_RESULT (*pFnCount) (GBL_CSELF, size_t* pSize);
36
37/*! \struct GblITableVariant
38 * \brief Adds Lua table-like functionality to GblVariant-compatible types
39 *
40 * GblITableVariant is an extension interface of GblIVariant. It adds
41 * additional methods for implementing subscripting and iteration behavior
42 * on a GblVariant-compatible type.
43 *
44 * \note
45 * This whole mechanism is was inspired by Lua's metatables, and the
46 * virtual methods within the interface class are analogous to metamethods
47 *
48 * \sa GblITableVariantClass
49 */
50
51//! Returns the GblType UUID associated with GblITableVariant
52GBL_EXPORT GblType GblITableVariant_type(void) GBL_NOEXCEPT;
53
55
56#undef GBL_SELF_TYPE
57
58#endif // GIMBAL_ITABLE_VARIANT_H
#define GBL_CLASS_CAST(cType, klass)
#define GBL_NOEXCEPT
#define GBL_DECLS_BEGIN
#define GBL_TYPEID(instanceStruct)
#define GBL_INTERFACE_END
#define GBL_INTERFACE_DERIVE(...)
#define GBL_EXPORT
uintptr_t GblType
Meta Type UUID.
Definition gimbal_type.h:51