libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_builtin_types.h
Go to the documentation of this file.
1/*! \file
2 * \brief Builtin type UUIDs and Semi-Private GblType API
3 * \ingroup meta
4 *
5 * This is a semi-private header which gets automatically
6 * included by gimbal_type.h, providing support for all
7 * builtin, auto-registered types as well as advanced
8 * type configuration flags for root types.
9 *
10 * \author 2023 Falco Girgis
11 * \copyright MIT License
12 */
13
14#include "../../core/gimbal_typedefs.h"
15#include "../../core/gimbal_decls.h"
16
17#ifndef GIMBAL_BUILTIN_TYPES_H
18#define GIMBAL_BUILTIN_TYPES_H
19
21
22/*! \name Builtin Indices
23 * \brief Definitions providing each builtin type's index
24 * @{
25 */
26#define GBL_TYPE_BUILTIN_INDEX_PROTOCOL 0 //!< Index of the builtin protocol type
27#define GBL_TYPE_BUILTIN_INDEX_STATIC_CLASS 1 //!< Index of the builtin static class type
28#define GBL_TYPE_BUILTIN_INDEX_INTERFACE 2 //!< Index of the builtin interface type
29#define GBL_TYPE_BUILTIN_INDEX_INSTANCE 3 //!< Index of the builtin instance type
30#define GBL_TYPE_BUILTIN_INDEX_IVARIANT 4 //!< Index of the builtin GblIVariant type
31#define GBL_TYPE_BUILTIN_INDEX_NIL 5 //!< Index of the builtin nil type
32#define GBL_TYPE_BUILTIN_INDEX_BOOL 6 //!< Index of the builtin GblBool type
33#define GBL_TYPE_BUILTIN_INDEX_CHAR 7 //!< Index of the builtin char type
34#define GBL_TYPE_BUILTIN_INDEX_UINT8 8 //!< Index of the builtin uint8_t type
35#define GBL_TYPE_BUILTIN_INDEX_INT16 9 //!< Index of the builtin int16_t type
36#define GBL_TYPE_BUILTIN_INDEX_UINT16 10 //!< Index of the builtin uint16_t type
37#define GBL_TYPE_BUILTIN_INDEX_INT32 11 //!< Index of the builtin int32_t type
38#define GBL_TYPE_BUILTIN_INDEX_UINT32 12 //!< Index of the builtin uint32_t type
39#define GBL_TYPE_BUILTIN_INDEX_INT64 13 //!< Index of the builtin int64_t type
40#define GBL_TYPE_BUILTIN_INDEX_UINT64 14 //!< Index of the builtin uint64_t type
41#define GBL_TYPE_BUILTIN_INDEX_FLOAT 15 //!< Index of the builtin float type
42#define GBL_TYPE_BUILTIN_INDEX_DOUBLE 16 //!< Index of the builtin double type
43#define GBL_TYPE_BUILTIN_INDEX_STRING 17 //!< Index of the builtin string type
44#define GBL_TYPE_BUILTIN_INDEX_POINTER 18 //!< Index of the builtin pointer type
45//! @}
46
47#define GBL_TYPE_BUILTIN_COUNT 19 //!< Number of builtin types
48
49//! Returns a type from the macro prefix of a builtin type
50#define GBL_BUILTIN_TYPE(prefix)
51 (GblType_fromBuiltinIndex(GBL_TYPE_BUILTIN_INDEX_##prefix))
52
53
54/*! \name Type Flag Tests
55 * \brief Convenience macros for testing individual type flags
56 */
57///@{
58#define GBL_TYPE_DEPENDENT_CHECK(type) (GblType_flags(type) & GBL_TYPE_ROOT_FLAG_DEPENDENT) //!< Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_DEPENDENT flag
59#define GBL_TYPE_CLASSED_CHECK(type) (GblType_flags(type) & GBL_TYPE_ROOT_FLAG_CLASSED) //!< Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_CLASSED flag
60#define GBL_TYPE_INTERFACED_CHECK(type) (GblType_flags(type) & GBL_TYPE_ROOT_FLAG_INTERFACED) //!< Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_INTERFACED flag
61#define GBL_TYPE_INSTANTIABLE_CHECK(type) (GblType_flags(type) & GBL_TYPE_ROOT_FLAG_INSTANTIABLE) //!< Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_INSTANTIABLE flag
62#define GBL_TYPE_DERIVABLE_CHECK(type) (GblType_flags(type) & GBL_TYPE_ROOT_FLAG_DERIVABLE) //!< Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_DERIVABLE flag
63#define GBL_TYPE_DEEP_DERIVABLE_CHECK(type) (GblType_flags(type) & GBL_TYPE_ROOT_FLAG_DEEP_DERIVABLE) //!< Convenience macro checking a GblType's GBL_TYPE_ROOT_FLAG_DEEP_DERIVABLE flag
64#define GBL_TYPE_BUILTIN_CHECK(type) (GblType_flags(type) & GBL_TYPE_FLAG_BUILTIN) //!< Convenience macro checking a GblType's GBL_TYPE_BUILTIN flag
65#define GBL_TYPE_ABSTRACT_CHECK(type) (GblType_flags(type) & GBL_TYPE_FLAG_ABSTRACT) //!< Convenience macro checking a GblType's GBL_TYPE_ABSTRACT flag
66#define GBL_TYPE_FINAL_CHECK(type) (GblType_flags(type) & GBL_TYPE_FLAG_FINAL) //!< Convenience macro checking a GblType's GBL_TYPE_FINAL flag ///< \details Convenience macro for testing whether a given type is fundamental ///< \details Convenience macro for testing whether a given type is valid ///< \details Convenience macro for testing whether a given type can be stored within a GblVariant
67#define GBL_TYPE_ROOT_CHECK(type) (GblType_root(type) == type)
68///@}
69
70//! Flags controlling behavior of root or fundemental GblTypes. These can only be set on root types and are inherited.
71typedef enum GblTypeRootFlags {
72 GBL_TYPE_ROOT_FLAG_DEPENDENT = (1 << 0), //!< Type is dependent upon other types in dependency list
73 GBL_TYPE_ROOT_FLAG_CLASSED = (1 << 1), //!< Type has an associated GblClass
74 GBL_TYPE_ROOT_FLAG_INTERFACED = (1 << 2), //!< Type has an associated GblInterface as its class (cannot be instantiable)
75 GBL_TYPE_ROOT_FLAG_INSTANTIABLE = (1 << 3), //!< Type has an associated GblInstance
76 GBL_TYPE_ROOT_FLAG_DERIVABLE = (1 << 4), //!< Type supports single-level inheritance
77 GBL_TYPE_ROOT_FLAG_DEEP_DERIVABLE = (1 << 5), //!< Type suppports multi-level inheritance
78 GBL_TYPE_ROOT_FLAGS_MASK = GBL_TYPE_ROOT_FLAG_DEPENDENT | //!< Mask of all GblRootTypeFlag values
84} GblTypeRootFlags;
85
86//! Retrieves the GblType UUID associated with the given \p index of a builtin type
88
90
91#endif // GIMBAL_BUILTIN_TYPES_H
GblTypeRootFlags
Flags controlling behavior of root or fundemental GblTypes. These can only be set on root types and a...
@ GBL_TYPE_ROOT_FLAGS_MASK
Mask of all GblRootTypeFlag values.
@ GBL_TYPE_ROOT_FLAG_DEEP_DERIVABLE
Type suppports multi-level inheritance.
@ GBL_TYPE_ROOT_FLAG_INSTANTIABLE
Type has an associated GblInstance.
@ GBL_TYPE_ROOT_FLAG_DERIVABLE
Type supports single-level inheritance.
@ GBL_TYPE_ROOT_FLAG_INTERFACED
Type has an associated GblInterface as its class (cannot be instantiable)
@ GBL_TYPE_ROOT_FLAG_CLASSED
Type has an associated GblClass.
@ GBL_TYPE_ROOT_FLAG_DEPENDENT
Type is dependent upon other types in dependency list.
uintptr_t GblType_fromBuiltinIndex(size_t index)
Retrieves the GblType UUID associated with the given index of a builtin type.
#define GBL_NOEXCEPT
#define GBL_DECLS_BEGIN
#define GBL_EXPORT