libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_variant.h
Go to the documentation of this file.
1/*! \file
2 * \brief GblVariant structure and related functions
3 * \ingroup meta
4 *
5 * This file contains the GblVariant type and its associated API.
6 * GblVariant is the core, fundamental dynamically-typed structure
7 * capable of representing any type that is known to the type system
8 * uniformly.
9 *
10 * The convenience wrappers provide a wide variety of methods around
11 * a set of fundamental, low-level calls, which perform standard
12 * GblVariant lifetime and value management in a type-generic way:
13 *
14 * GblVariant v;
15 *
16 * // Always construct a variant before using it
17 * GblVariant_constructValueCopy(&v GBL_FLOAT_TYPE, -17.0f);
18 *
19 * // You can now fetch its value as a float
20 * float f = 0.0f;
21 * GblVariant_valueCopy(&v, GBL_FLOAT_TYPE, &f); // or GblVariant_float()
22 * GBL_ASSERT(f == -17.0f);
23 *
24 * // You can now freely assign and change its value
25 * // Lets do so by "moving" a reference to a GblObject into it
26 * GblVariant_setValueMove(&v, GBL_OBJECT_TYPE, GBL_NEW(GblObject));
27 *
28 * // ALWAYS call the destructor when it leaves scope to free resources
29 * // this will release the otherwise leaked reference to the new GblObject
30 * GblVariant_destruct(&v);
31 *
32 * \todo
33 * - function call operator()? Or call into a Closure?
34 * - serializing/deserializing
35 * - Ensure unregistering a type also removes its converters
36 * - when you have an instance/box/object type, have to propagate inner type to box's outer type
37 *
38 * \author 2023 Falco Girgis
39 * \copyright MIT License
40 */
41#ifndef GIMBAL_VARIANT_H
42#define GIMBAL_VARIANT_H
43
44#include "../../core/gimbal_typedefs.h"
45#include "../../core/gimbal_ctx.h"
46#include "../../strings/gimbal_string_ref.h"
47#include "gimbal_pointer.h"
48#include "../classes/gimbal_primitives.h"
49#include "../classes/gimbal_enum.h"
50#include "../classes/gimbal_flags.h"
51#include "../classes/gimbal_opaque.h"
52#include "../instances/gimbal_instance.h"
53
54//! Convience macro for GblVariant value initialization
55#define GBL_VARIANT_INIT { .type = GBL_INVALID_TYPE }
56//! Convience macro for declaring and initalizing a GblVariant
57#define GBL_VARIANT(name) GblVariant name = GBL_VARIANT_INIT
58
59//! Convenience macro providing a generically-typed constructor method
60#define GblVariant_construct(/*pVariant,*/ ...) GblVariant_construct_(__VA_ARGS__)
61 //! Convenience macro providing a generically-typed assignment method
62#define GblVariant_set(pVariant, ...) GblVariant_set_(pVariant, __VA_ARGS__)
63
64#define GBL_SELF_TYPE GblVariant
65
67
70
71//! Function signature for a type converter to be used with GblVariant_registerConverter()
72typedef GBL_RESULT (*GblVariantConverterFn)(GBL_CSELF, GblVariant* pOther);
73
74/*! \brief Contains a single generic, dynamically typed value
75 * \ingroup meta
76 *
77 * GblVariant is a type-tagged union capable of representing
78 * any type within the type system which implements the \ref
79 * GblIVariantClass interface.
80 *
81 * For the table-like accessors such as GblVariant_index() and
82 * GblVariant_setIndex(), the type must additionally implement
83 * the \ref GblITableVariantClass interface.
84 *
85 * \warning
86 * All fields within the structure are PRIVATE. You should
87 * ALWAYS use the API, which carefully manages lifetimes,
88 * conversions, validation, range-checking, and more rather
89 * than reaching directly for its members. The exception to
90 * this rule is when writing an actual implementation of
91 * GblIVariantClass for a type.
92 *
93 * \sa GblIVariantClass, GblITableVariantClass
94 */
95typedef struct GblVariant {
96 GblType type; //!< GblType UUID
97 union {
98 char character; //!< char value
99 GblBool boolean; //!< boolean value
100 uint8_t u8; //!< uint8_t value
101 uint16_t u16; //!< uint16_t value
102 int16_t i16; //!< int16_t value
103 uint32_t u32; //!< uint32_t value
104 int32_t i32; //!< int32_t value
105 uint64_t u64; //!< uint64_t value
106 int64_t i64; //!< int64_t value
107 GblEnum enumeration; //!< enum value
108 GblFlags flags; //!< GblFlags value
109 float f32; //!< float avlue
110 double f64; //!< double value
111 void* pVoid; //!< void* value
112 GBL_RESULT result; //!< GBL_RESULT value
113 GblFnPtr pFnPtr; //!< function pointer value
114 GblStringRef* pString; //!< GblStringRef value
115 GblType typeValue; //!< GblType value
116 GblBitmask bitmask; //!< GblBitmask value
117 GblDateTime* pDateTime; //!< GblDateTime value
118 GblInstance* pInstance; //!< GblInstance* value
119 GblBox* pBox; //!< GblBox* value
120 GblObject* pObject; //!< GblObject* value
121 };
122} GblVariant;
123
124//! Checks whether the given value can be represented by a GblVariant (implements GblIVariant)
126
127/*! \name Constructors
128 * \brief Methods for various types of construction
129 * \relatesalso GblVariant
130 * @{
131 */
132//! Invokes the default constructor for the given type
134//! Invokes the copy constructor, constructing then copying the \p pOther variant
136 const GblVariant* pOther) GBL_NOEXCEPT;
137//! Invokes the move constructor, constructing then moving the \p pOther variant
139 GblVariant* pOther) GBL_NOEXCEPT;
140//! Invokes the value copy constructor, constructing then copying the given value
142//! va_list* variation of GblVariant_constructValueCopy()
144 GblType type,
145 va_list* pList) GBL_NOEXCEPT;
146//! Invokes the value move constructor, constructing then moving the given value
148//! va_list* variation of GblVariant_constructValueMove()
150 GblType type,
151 va_list* pList) GBL_NOEXCEPT;
152//! Convenience wrapper for value constructing a variant with a NIL value
154//! Convenience wrapper for value constructing a variant with a bool value
156//! Convenience wrapper for value constructing a variant with a char value
158//! Convenience wrapper for value constructing a variant with a uint8_t value
160//! Convenience wrapper for value constructing a variant with a uint16 value
162//! Convenience wrapper for value constructing a variant with an int16 value
164//! Convenience wrapper for value constructing a variant with a uint32 value
166//! Convenience wrapper for value constructing a variant with an int32 value
168//! Convenience wrapper for value constructing a variant with a uint64 value
170//! Convenience wrapper for value constructing a variant with an int64 value
172//! Convenience wrapper for value constructing a variant with a float value
174//! Convenience wrapper for value constructing a variant with a double value
176//! Convenience wrapper for value copy constructing a variant with a const char*
178//! Convenience wrapper for value move constructing a variant with a GblStringRef (transferring ownership)
180 const GblStringRef* pStrRef) GBL_NOEXCEPT;
181//! Convenience wrapper for value copy constructing a string variant from a string view
183//! Convenience wrapper for value constructing a variant from a GblType
185//! Convenience wrapper for value copy constructing a variant with a size_t
187//! Convenience wrapper for value copy constructing a variant with a GblDateTime
189 const GblDateTime* pDateTime) GBL_NOEXCEPT;
190//! Convenience wrapper for value constructing an enum derived variant with its value
192 GblType type,
193 GblEnum value) GBL_NOEXCEPT;
194//! Convenience wrapper for value constructing a flags-derived variant with its value
196 GblType type,
197 GblFlags value) GBL_NOEXCEPT;
198//! Convenience wrapper for value constructing a pointer-derived variant with its value
200 GblType ptrType,
201 void* pValue) GBL_NOEXCEPT;
202//! Convenience wrapper for value copy constructing a variant from an opaque-derived type pointer
204 GblType opaqueType,
205 void* pValue) GBL_NOEXCEPT;
206//! Convenience wrapper for value move constructing a variant from an opaque-derived type pointer
208 GblType opaqueType,
209 void* pValue) GBL_NOEXCEPT;
210//! Convenience wrapper for value constructing a variant from a GblInstance pointer
212//! Convenience wrapper for value copy constructing a variant from a GblBox, increasing its refCount
214//! Convenience wrapper for value move constructing a variant from a GblBox, taking ownership of the reference
216//! Convenience wrapper for value copy constructing a variant from a GblObject, increasing its refCount
218//! Convenience wrapper for value m ove constructing a variant from a GblObject, taking ownership of the reference
220//! Destroys the given variant, invoking its destructor and resetting its type and value
222//! @}
223
224/*! \name Setters
225 * \brief Methods for modifying the value of a constructed GblVariant
226 * \relatesalso GblVariant
227 * @{
228 */
229//! Performs a copy assignment operation, setting \p pOther to the given variant's value
231 const GblVariant* pOther) GBL_NOEXCEPT;
232//! Performs a move assignment operation, moving the given variant's value into \p pOther
233GBL_EXPORT GBL_RESULT GblVariant_setMove (GBL_SELF, GblVariant* pOther) GBL_NOEXCEPT;
234//! Performs a generic value copy assignment operation, copying the variadic argument into the variant
236//! va_list* variation of GblVariant_setValueCopy(), where the value is sourdced from a va_list*
238 GblType type,
239 va_list* pVarArgs) GBL_NOEXCEPT;
240//! Performs a generic value move assignment operation, moving the variadic argument into the variant
242//! va_list* variation of GblVariant_setValueMove(), where the value is sourced from a va_list*
244 GblType type,
245 va_list* pVarArgs) GBL_NOEXCEPT;
246//! Clears and resets the given variants type and value. ONLY call after being the source of a move operation!
248//! Convenience wrapper assigning the value of a constructed variant to NIL
250//! Convenience wrapper assigning the value of a constructed variant to a boolean
252//! Convenience wrapper assigning the value of a constructed variant to a character
254//! Convenience wrapper assigning the value of a constructed variant to a uint8
256//! Convenience wrapper assigning the value of a constructed variant to a uint16
258//! Convenience wrapper assigning the value of a constructed variant to an int16
260//! Convenience wrapper assigning the value of a constructed variant to a uint32
262//! Convenience wrapper assigning the value of a constructed variant to an int32
264//! Convenience wrapper assigning the value of a constructed variant to a uint64
266//! Convenience wrapper assigning the value of a constructed variant to an int64
268//! Convenience wrapper assigning the value of a constructed variant to a float
270//! Convenience wrapper assigning the value of a constructed variant to a double
272//! Convenience wrapper assigning the value of a constructed variant to a copy of the given string
273GBL_EXPORT GBL_RESULT GblVariant_setString (GBL_SELF, const char* pValue) GBL_NOEXCEPT;
274//! Convenience wrapper assigning the value of a constructed variant to a copy of the given string view
276//! Convenience wrapper move assigning the value of a constructed variant to take the given reference
278//! Convenience wrapper assigning the value of a constructed variant to a GblType
280//! Convenience wrapper assigning the value of a constructed variant to a size_t
282//! Convenience wrapper copy assigning the value of a constructed variant to a GblDateTime*
284 const GblDateTime* pDt) GBL_NOEXCEPT;
285//! Convenience wrapper assigning the value of a constructed variant to that of an enum-derived type
287 GblType enumType,
288 GblEnum value) GBL_NOEXCEPT;
289//! Convenience wrapper assigning the value of a constructed variant to that of a GblFlags-derived type
291 GblType flagsType,
292 GblFlags value) GBL_NOEXCEPT;
293//! Convenience wrapper assigning the value of a constructed variant to that of a pointer-derived type
295 GblType ptrType,
296 void* pValue) GBL_NOEXCEPT;
297//! Convenience wrapper copy assigning the value of a constructed variant to that of an opaque-derived type
299 GblType opaqueType,
300 void* pValue) GBL_NOEXCEPT;
301//! Convenience wrapper move assigning the value of a constructed variant to that of an opaque-derived type
303 GblType opaqueType,
304 void* pValue) GBL_NOEXCEPT;
305//! Convenience wrapper assigning the value of a GblVariant to a GblInstance*
306GBL_EXPORT GBL_RESULT GblVariant_setInstance (GBL_SELF, GblInstance* pValue) GBL_NOEXCEPT;
307//! Convenience wrapper which assigns the value of the given variant to that of a new reference to a GblBox
309//! Convenience wrapper which assigns the value of the given variant to take ownership of a GblBox reference
311//! Convenience wrapper which assigns the value of the given variant to that of a new reference to a GblObject
313//! Convenience wrapper which assings the value of the given variant to take ownership of a GblBox reference
315//! @}
316
317//! Retrieves the name of the type of value contained by the given variant
319//! Retrives the GblType UUID of the value contained by the given variant
321
322/*! \name Getters
323 * \brief Methods for retrieving the value of a constructed GblVariant
324 * \relatesalso GblVariant
325 * @{
326 */
327//! Attempts to retrieve a copy of the variant's value and store it into the provided pointer
329 ...) GBL_NOEXCEPT;
330//! va_list* variant of GblVariant_valueCopy(), where the destination pointer comes from a va_list*
332 va_list* pVa) GBL_NOEXCEPT;
333//! Attempts to retrieve the actual value stored within the variant and store it into the provided pointer (no movement or copying)
335 ...) GBL_NOEXCEPT;
336//! va_list* variant of GblVariant_valuePeek(), where destination pointer comes from a va_list*
338 va_list* pVa) GBL_NOEXCEPT;
339//! Attempts to move the value stored within the variant out of it and into the provided pointer
341 ...) GBL_NOEXCEPT;
342//! va_list* variant of GblVariant_valueMove(), where destination pointer comes from a va_list*
344 va_list* pVa) GBL_NOEXCEPT;
345//! Returns GBL_TRUE if the value held by the given variant is not of GBL_INVALID_TYPE
347//! Returns GBL_TRUE if the value held by the variant is not of type GBL_NIL_TYPE
349//! Attempst to fetch the value of the variant as a bool, raising an error upon type mismatch
351//! Attempst to fetch the value of the variant as a char, raising an error upon type mismatch
353//! Attempst to fetch the value of the variant as a uint8, raising an error upon type mismatch
355//! Attempst to fetch the value of the variant as a uint16, raising an error upon type mismatch
357//! Attempst to fetch the value of the variant as an int16, raising an error upon type mismatch
359//! Attempst to fetch the value of the variant as a uint32, raising an error upon type mismatch
361//! Attempst to fetch the value of the variant as an int32, raising an error upon type mismatch
363//! Attempst to fetch the value of the variant as a uint64, raising an error upon type mismatch
365//! Attempst to fetch the value of the variant as an int64, raising an error upon type mismatch
367//! Attempst to fetch the value of the variant as a generic enum value, raising an error upon type mismatch
369//! Attempst to fetch the value of the variant as a generic GblFlags value, raising an error upon type mismatch
371//! Attempst to fetch the value of the variant as a float, raising an error upon type mismatch
373//! Attempst to fetch the value of the variant as a double, raising an error upon type mismatch
375//! Attempst to fetch the value of the variant as a string, raising an error upon type mismatch
377//! Attempst to fetch the value of the variant as a string, returning it within a view, raising an error upon type mismatch
379//! Attempst to fetch the value of the variant as a GblType, raising an error upon type mismatch
381//! Attempst to fetch the value of the variant as a generic pointer, raising an error upon type mismatch
383//! Attempst to fetch the value of the variant as a size_t, raising an error upon type mismatch
385//! Attempst to fetch the value of the variant as a GblDateTime, raising an error upon type mismatch
387//! Attempst to fetch a copy of the value of the variant as a generic opaque pointer, raising an error upon type mismatch
389//! Attempst to take the value of the variant (claiming ownerships) as a generic opaque pointer, raising an error upon type mismatch
391//! Attempst to fetch the value of the variant as a generic opaque pointer, raising an error upon type mismatch
393//! Attempts to fetch the value of the variant as a GblInstance derived type, returning a pointer to it
395//! Attempts to fetch a copy of the value of the variant by making a new generic GblBox reference, raising an error upon type mismatch
397//! Attempts to take the value stored within the variant as generic GblBox pointer, claiming ownerships of it
399//! Attempts to fetch the value stored within the variant as a pointer to a GblBox derived type
401//! Attempts to fetch a copy of the value of the variant by making a new generic GblObject reference, raising an error upon type mismatch
403//! Attempts to take the value stored within the variant as generic GblObject pointer, claiming ownerships of it
405//! Attempts to fetch the value stored within the variant as a pointer to a GblObject derived type
407//! @}
408//!
409/*! \name Table Accessors
410 * \brief Methods for managing and manipulating variants as tables
411 * \relatesalso GblVariant
412 * @{
413 */
414//! Looks up the table entry with the given \p pKey, storing its value in \p pValue and also returning it
416 const GblVariant* pKey,
417 GblVariant* pValue) GBL_NOEXCEPT;
418//! Looks up the talbe entry with the given string key, storing its value in \p pValue and also returning it
420 const char* pName,
421 GblVariant* pValue) GBL_NOEXCEPT;
422//! Looks up the table entry with the given integral key, storing its value in \p pValue and also returning it
424 size_t index,
425 GblVariant* pValue) GBL_NOEXCEPT;
426//! Sets the value of the table entry with the corresponding GblVariant key to \p pValue, returning a status code
428 const GblVariant* pKey,
429 GblVariant* pValue) GBL_NOEXCEPT;
430//! Sets the value of the table entry with the corresponding string key to \p pValue, returning a status code
432 const char* pName,
433 GblVariant* pValue) GBL_NOEXCEPT;
434//! Sets the value of the table entry with the corresponding integral key to \p pValue, returning a status code
436 size_t index,
437 GblVariant* pValue) GBL_NOEXCEPT;
438//! Given the current entry's key (or NIL for the first iteration), sets the next key as well as its value, returning GBL_FALSE after the final entry
440 GblVariant* pKey,
441 GblVariant* pValue) GBL_NOEXCEPT;
442//! Returns the number of table entries within the given GblVariant
444//! @}
445
446/*! \name Builtin Conversions
447 * \brief Methods for converting between types
448 * \relatesalso GblVariant
449 * @{
450 */
451//! Convenience method that attempts to convert the variant's type to bool and return its value
453//! Convenience method that attempts to convert the variant's type to char and return its value
455//! Convenience method that attempts to convert the variant's type to uint8 and return its value
457//! Convenience method that attempts to convert the variant's type to uint16 and return its value
459//! Convenience method that attempts to convert the variant's type to int16 and return its value
461//! Convenience method that attempts to convert the variant's type to uint32 and return its value
463//! Convenience method that attempts to convert the variant's type to int32 and return its value
465//! Convenience method that attempts to convert the variant's type to uint64 and return its value
467//! Convenience method that attempts to convert the variant's type to int64 and return its value
469//! Convenience method that attempts to convert the variant's type to a generic enum and return its value
471//! Convenience method that attempts to convert the variant's type to a generic GblFlags and return its value
473//! Convenience method that attempts to convert the variant's type to float and return its value
475//! Convenience method that attempts to convert the variant's type to double and return its value
477//! Convenience method that attempts to convert the variant's type to pointer and return its value
479//! Convenience method that attempts to convert the variant's type to string and return its value
481//! Convenience method that attempts to convert the variant's type to string view and return its value
483//! Convenience method that attempts to convert the variant's type to GblType and return its value
485//! Convenience method that attempts to convert the variant's type to size_t and return its value
487//! Convenience method that attempts to convert the variant's type to GblDateTime and return its value
489//! @}
490
491/*! \name Generic Conversions
492 * \brief Generic conversion registration and operations
493 * \relatesalso GblVariant
494 * @{
495 */
496//! Registers a converter with the type system for going from one type of variant to another
498 GblType toType,
499 GblVariantConverterFn pFnConv) GBL_NOEXCEPT;
500//! Unregisters a converter with the type system from going from one type to another type of variant
502 GblType toType) GBL_NOEXCEPT;
503//! Retrieves the current number of type conversion routines held by the type registry
505//! Returns GBL_TRUE if a method can be found to convert from one type to another type of variant
507 GblType toType) GBL_NOEXCEPT;
508//! Fills \p pToVariant with the value of \p pSelf, converted to the type contained by \p pToVariant
510 GblVariant* pToVariant) GBL_NOEXCEPT;
511//! @}
512
513/*! \name Utilities
514 * \brief Methods offering various operators and utility functionality
515 * \relatesalso GblVariant
516 * @{
517 */
518//! Peforms a comparison between the two types of variants, implicitly converting between them if necessary
520 const GblVariant* pOther) GBL_NOEXCEPT;
521//! Returns GBL_TRUE if the result of the comparison between two variants is 0 (meaning both equal)
523 const GblVariant* pOther) GBL_NOEXCEPT;
524//! Attempts to serialize the value stored within the given variant to a GblStringBuffer
526 GblStringBuffer* pString) GBL_NOEXCEPT;
527//! Attempts to deserialize a value within a GblStringBuffer to store within the given variant
529 const GblStringBuffer* pStr) GBL_NOEXCEPT;
530//! Calculates a 32-bit hash value corresponding to the given variant's value
532//! @}
533
535
536#if !defined(GBL_DREAMCAST) && !defined(GBL_PSP)
537# define GBL_VARIANT_CONSTRUCT_GENERIC_PLATFORM_ENTRIES()
538#else
539# define GBL_VARIANT_CONSTRUCT_GENERIC_PLATFORM_ENTRIES()
540 (int, GblVariant_constructInt32),
541#endif
542
543//! \cond
544#define GBL_VARIANT_CONSTRUCT_TABLE (
546 (
547 (char, GblVariant_constructChar),
548 (uint8_t, GblVariant_constructUint8),
549 (uint16_t, GblVariant_constructUint16),
550 (int16_t, GblVariant_constructInt16),
551 (uint32_t, GblVariant_constructUint32),
553 (int32_t, GblVariant_constructInt32),
554 (uint64_t, GblVariant_constructUint64),
555 (int64_t, GblVariant_constructInt64),
556 (float, GblVariant_constructFloat),
557 (double, GblVariant_constructDouble),
558 (const char*, GblVariant_constructString),
559 (char*, GblVariant_constructString),
560 (GblStringView, GblVariant_constructStringView),
561 (void*, GblVariant_constructPointer),
562 (const void*, GblVariant_constructPointer),
563 (const GblVariant*, GblVariant_constructCopy),
564 (GblVariant*, GblVariant_constructCopy)
565 )
566 )
567#define GblVariant_construct_N(pVariant, ...) GBL_META_GENERIC_MACRO_GENERATE(GBL_VARIANT_CONSTRUCT_TABLE, GBL_TUPLE_FIRST (__VA_ARGS__))(pVariant, __VA_ARGS__)
568#define GblVariant_construct_1(pVariant) GblVariant_constructNil(pVariant)
569#define GblVariant_construct_(...) GBL_VA_OVERLOAD_CALL(GblVariant_construct, GBL_VA_OVERLOAD_SUFFIXER_1_N, __VA_ARGS__)
570
571#define GBL_VARIANT_SET_TABLE (
573 (
574 (char, GblVariant_setChar),
575 (uint8_t, GblVariant_setUint8),
576 (uint16_t, GblVariant_setUint16),
577 (int16_t, GblVariant_setInt16),
578 (uint32_t, GblVariant_setUint32),
579 (int32_t, GblVariant_setInt32),
580 (uint64_t, GblVariant_setUint64),
581 (int64_t, GblVariant_setInt64),
582 (float, GblVariant_setFloat),
583 (double, GblVariant_setDouble),
584 (char*, GblVariant_setString),
585 (const char*, GblVariant_setString),
586 (GblStringView, GblVariant_setStringView),
587 (const void*, GblVariant_setPointer),
588 (void*, GblVariant_setPointer),
589 (const GblVariant*, GblVariant_setCopy),
590 (GblVariant*, GblVariant_setCopy)
591 )
592 )
593#define GblVariant_set_(pVariant, ...) GBL_META_GENERIC_MACRO_GENERATE(GBL_VARIANT_SET_TABLE, GBL_TUPLE_FIRST(__VA_ARGS__))(pVariant, __VA_ARGS__)
594//! \endcond
595
596#undef GBL_SELF_TYPE
597
598#endif // GIMBAL_VARIANT_H
#define GBL_NOEXCEPT
#define GBL_DECLS_BEGIN
#define GBL_FORWARD_DECLARE_STRUCT(S)
#define GBL_EXPORT
#define GBL_VA_OVERLOAD_CALL(BASE, SUFFIXER,...)
#define GBL_TUPLE_FIRST(...)
#define GBL_VA_OVERLOAD_SUFFIXER_1_N(...)
#define GBL_META_GENERIC_MACRO_NO_DEFAULT
#define GBL_META_GENERIC_MACRO_GENERATE(traits, X)
#define GBL_INVALID_TYPE
GblType UUID of the invalid type.
Definition gimbal_type.h:31
uint32_t GblHash
Type representing a calculated numeric hash across the codebase.
uint32_t GblEnum
Standard-sized enum type, 32-bits across platforms.
uint32_t GblFlags
Standard-sized flags type, 32-bits across platforms.
void(* GblFnPtr)()
Type used for holding an untyped function pointer.
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
#define GBL_VARIANT_CONSTRUCT_GENERIC_PLATFORM_ENTRIES()
const char * GblVariant_typeName(const GblVariant *pSelf)
Retrives the GblType UUID of the value contained by the given variant.
#define GBL_VARIANT_INIT
Convience macro for GblVariant value initialization.
GblBool GblVariant_checkTypeCompatible(GblType type)
Checks whether the given value can be represented by a GblVariant (implements GblIVariant)
#define GblVariant_construct(...)
Convenience macro providing a generically-typed constructor method.
uintptr_t GblType
Meta Type UUID.
Definition gimbal_type.h:51
const char GblStringRef
Reference-counted, const char*-compatible string type.
Contains a single generic, dynamically typed value.
double GblVariant_toDouble(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to double and return its value.
GBL_RESULT GblVariant_constructObjectCopy(GblVariant *pSelf, GblObject *pObj)
Convenience wrapper for value copy constructing a variant from a GblObject, increasing its refCount.
GBL_RESULT GblVariant_setInstance(GblVariant *pSelf, GblInstance *pValue)
Convenience wrapper assigning the value of a GblVariant to a GblInstance*.
GBL_RESULT GblVariant_setElement(GblVariant *pSelf, size_t index, GblVariant *pValue)
Sets the value of the table entry with the corresponding integral key to pValue, returning a status c...
GBL_RESULT GblVariant_unregisterConverter(GblType fromType, GblType toType)
Unregisters a converter with the type system from going from one type to another type of variant.
GBL_RESULT GblVariant_setObjectMove(GblVariant *pSelf, GblObject *pValue)
Convenience wrapper which assings the value of the given variant to take ownership of a GblBox refere...
GblVariant * GblVariant_index(const GblVariant *pSelf, const GblVariant *pKey, GblVariant *pValue)
Looks up the table entry with the given pKey, storing its value in pValue and also returning it.
GBL_RESULT GblVariant_valueCopy(const GblVariant *pSelf,...)
Attempts to retrieve a copy of the variant's value and store it into the provided pointer.
GBL_RESULT GblVariant_setDouble(GblVariant *pSelf, double value)
Convenience wrapper assigning the value of a constructed variant to a double.
GblBool GblVariant_isNil(const GblVariant *pSelf)
Returns GBL_TRUE if the value held by the variant is not of type GBL_NIL_TYPE.
GBL_RESULT GblVariant_setValueMove(GblVariant *pSelf, GblType type,...)
Performs a generic value move assignment operation, moving the variadic argument into the variant.
GBL_RESULT GblVariant_constructInt32(GblVariant *pSelf, int32_t value)
Convenience wrapper for value constructing a variant with an int32 value.
void * GblVariant_opaquePeek(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a generic opaque pointer, raising an error upon type mi...
double GblVariant_double(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a double, raising an error upon type mismatch.
GBL_RESULT GblVariant_valuePeek(const GblVariant *pSelf,...)
Attempts to retrieve the actual value stored within the variant and store it into the provided pointe...
size_t GblVariant_toSize(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to size_t and return its value.
GBL_RESULT GblVariant_setCopy(GblVariant *pSelf, const GblVariant *pOther)
Performs a copy assignment operation, setting pOther to the given variant's value.
GBL_RESULT GblVariant_setPointer(GblVariant *pSelf, GblType ptrType, void *pValue)
Convenience wrapper assigning the value of a constructed variant to that of a pointer-derived type.
GBL_RESULT GblVariant_setEnum(GblVariant *pSelf, GblType enumType, GblEnum value)
Convenience wrapper assigning the value of a constructed variant to that of an enum-derived type.
GBL_RESULT GblVariant_constructObjectMove(GblVariant *pSelf, GblObject *pObj)
Convenience wrapper for value m ove constructing a variant from a GblObject, taking ownership of the ...
GBL_RESULT GblVariant_convert(const GblVariant *pSelf, GblVariant *pToVariant)
Fills pToVariant with the value of pSelf, converted to the type contained by pToVariant.
GBL_RESULT GblVariant_constructUint16(GblVariant *pSelf, uint16_t value)
Convenience wrapper for value constructing a variant with a uint16 value.
GblStringRef * pString
GblStringRef value.
GBL_RESULT GblVariant_constructDateTime(GblVariant *pSelf, const GblDateTime *pDateTime)
Convenience wrapper for value copy constructing a variant with a GblDateTime.
GblFlags GblVariant_flags(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a generic GblFlags value, raising an error upon type mi...
GBL_RESULT GblVariant_constructEnum(GblVariant *pSelf, GblType type, GblEnum value)
Convenience wrapper for value constructing an enum derived variant with its value.
GBL_RESULT GblVariant_setSize(GblVariant *pSelf, size_t value)
Convenience wrapper assigning the value of a constructed variant to a size_t.
GblBitmask bitmask
GblBitmask value.
GBL_RESULT GblVariant_setDateTime(GblVariant *pSelf, const GblDateTime *pDt)
Convenience wrapper copy assigning the value of a constructed variant to a GblDateTime*.
GBL_RESULT GblVariant_setIndex(GblVariant *pSelf, const GblVariant *pKey, GblVariant *pValue)
Sets the value of the table entry with the corresponding GblVariant key to pValue,...
float f32
float avlue
GBL_RESULT GblVariant_setValueCopy(GblVariant *pSelf, GblType type,...)
Performs a generic value copy assignment operation, copying the variadic argument into the variant.
GBL_RESULT GblVariant_setUint16(GblVariant *pSelf, uint16_t value)
Convenience wrapper assigning the value of a constructed variant to a uint16.
GblDateTime * GblVariant_dateTime(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a GblDateTime, raising an error upon type mismatch.
GblInstance * GblVariant_instance(const GblVariant *pSelf)
Attempts to fetch the value of the variant as a GblInstance derived type, returning a pointer to it.
GBL_RESULT result
GBL_RESULT value.
GBL_RESULT GblVariant_constructFlags(GblVariant *pSelf, GblType type, GblFlags value)
Convenience wrapper for value constructing a flags-derived variant with its value.
GBL_RESULT GblVariant_destruct(GblVariant *pSelf)
Destroys the given variant, invoking its destructor and resetting its type and value.
GblBox * GblVariant_boxPeek(const GblVariant *pSelf)
Attempts to fetch the value stored within the variant as a pointer to a GblBox derived type.
GblBox * pBox
GblBox* value.
GBL_RESULT GblVariant_setUint64(GblVariant *pSelf, uint64_t value)
Convenience wrapper assigning the value of a constructed variant to a uint64.
GBL_RESULT GblVariant_constructCopy(GblVariant *pSelf, const GblVariant *pOther)
Invokes the copy constructor, constructing then copying the pOther variant.
GBL_RESULT GblVariant_constructDouble(GblVariant *pSelf, double value)
Convenience wrapper for value constructing a variant with a double value.
GblBool GblVariant_equals(const GblVariant *pSelf, const GblVariant *pOther)
Returns GBL_TRUE if the result of the comparison between two variants is 0 (meaning both equal)
GBL_RESULT GblVariant_setBoxMove(GblVariant *pSelf, GblBox *pValue)
Convenience wrapper which assigns the value of the given variant to take ownership of a GblBox refere...
GBL_RESULT GblVariant_setTypeValue(GblVariant *pSelf, GblType value)
Convenience wrapper assigning the value of a constructed variant to a GblType.
const GblStringRef * GblVariant_toString(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to string and return its value.
uint32_t GblVariant_toUint32(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to uint32 and return its value.
GblFlags flags
GblFlags value.
GBL_RESULT GblVariant_constructUint32(GblVariant *pSelf, uint32_t value)
Convenience wrapper for value constructing a variant with a uint32 value.
GblEnum GblVariant_enum(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a generic enum value, raising an error upon type mismat...
GblVariant * GblVariant_element(const GblVariant *pSelf, size_t index, GblVariant *pValue)
Looks up the table entry with the given integral key, storing its value in pValue and also returning ...
GBL_RESULT GblVariant_setOpaqueCopy(GblVariant *pSelf, GblType opaqueType, void *pValue)
Convenience wrapper copy assigning the value of a constructed variant to that of an opaque-derived ty...
double f64
double value
GBL_RESULT GblVariant_setUint32(GblVariant *pSelf, uint32_t value)
Convenience wrapper assigning the value of a constructed variant to a uint32.
GblStringView GblVariant_stringView(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a string, returning it within a view,...
GBL_RESULT GblVariant_setInt64(GblVariant *pSelf, int64_t value)
Convenience wrapper assigning the value of a constructed variant to an int64.
GblBool GblVariant_next(const GblVariant *pSelf, GblVariant *pKey, GblVariant *pValue)
Given the current entry's key (or NIL for the first iteration), sets the next key as well as its valu...
GblBool boolean
boolean value
GBL_RESULT GblVariant_constructChar(GblVariant *pSelf, char value)
Convenience wrapper for value constructing a variant with a char value.
GblType typeValue
GblType value.
uint32_t GblVariant_uint32(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a uint32, raising an error upon type mismatch.
int16_t i16
int16_t value
GblObject * pObject
GblObject* value.
GblType GblVariant_typeValue(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a GblType, raising an error upon type mismatch.
int GblVariant_compare(const GblVariant *pSelf, const GblVariant *pOther)
Peforms a comparison between the two types of variants, implicitly converting between them if necessa...
size_t GblVariant_size(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a size_t, raising an error upon type mismatch.
char GblVariant_char(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a char, raising an error upon type mismatch.
GBL_RESULT GblVariant_setFloat(GblVariant *pSelf, float value)
Convenience wrapper assigning the value of a constructed variant to a float.
GBL_RESULT GblVariant_constructUint64(GblVariant *pSelf, uint64_t value)
Convenience wrapper for value constructing a variant with a uint64 value.
GblDateTime * GblVariant_toDateTime(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to GblDateTime and return its value.
GblVariant * GblVariant_field(const GblVariant *pSelf, const char *pName, GblVariant *pValue)
Looks up the talbe entry with the given string key, storing its value in pValue and also returning it...
GblHash GblVariant_hash(const GblVariant *pSelf)
Calculates a 32-bit hash value corresponding to the given variant's value.
GblBool GblVariant_canConvert(GblType fromType, GblType toType)
Returns GBL_TRUE if a method can be found to convert from one type to another type of variant.
GBL_RESULT GblVariant_constructStringRef(GblVariant *pSelf, const GblStringRef *pStrRef)
Convenience wrapper for value move constructing a variant with a GblStringRef (transferring ownership...
GblFlags GblVariant_toFlags(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to a generic GblFlags and return its v...
GBL_RESULT GblVariant_setStringView(GblVariant *pSelf, GblStringView value)
Convenience wrapper assigning the value of a constructed variant to a copy of the given string view.
GblBox * GblVariant_boxCopy(const GblVariant *pSelf)
Attempts to fetch a copy of the value of the variant by making a new generic GblBox reference,...
GblEnum GblVariant_toEnum(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to a generic enum and return its value...
GBL_RESULT GblVariant_setStringRef(GblVariant *pSelf, GblStringRef *pRef)
Convenience wrapper move assigning the value of a constructed variant to take the given reference.
GBL_RESULT GblVariant_constructInt64(GblVariant *pSelf, int64_t value)
Convenience wrapper for value constructing a variant with an int64 value.
GBL_RESULT GblVariant_setFlags(GblVariant *pSelf, GblType flagsType, GblFlags value)
Convenience wrapper assigning the value of a constructed variant to that of a GblFlags-derived type.
GBL_RESULT GblVariant_constructUint8(GblVariant *pSelf, uint8_t value)
Convenience wrapper for value constructing a variant with a uint8_t value.
GBL_RESULT GblVariant_valuePeekVa(GblVariant *pSelf, va_list *pVa)
va_list* variant of GblVariant_valuePeek(), where destination pointer comes from a va_list*
GblBox * GblVariant_boxMove(GblVariant *pSelf)
Attempts to take the value stored within the variant as generic GblBox pointer, claiming ownerships o...
uint8_t GblVariant_toUint8(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to uint8 and return its value.
uint64_t GblVariant_toUint64(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to uint64 and return its value.
GBL_RESULT GblVariant_constructPointer(GblVariant *pSelf, GblType ptrType, void *pValue)
Convenience wrapper for value constructing a pointer-derived variant with its value.
int16_t GblVariant_toInt16(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to int16 and return its value.
GBL_RESULT GblVariant_constructString(GblVariant *pSelf, const char *pValue)
Convenience wrapper for value copy constructing a variant with a const char*.
size_t GblVariant_converterCount(void)
Retrieves the current number of type conversion routines held by the type registry.
int32_t i32
int32_t value
int64_t i64
int64_t value
GblType GblVariant_typeOf(const GblVariant *pSelf)
Retrieves the name of the type of value contained by the given variant.
int64_t GblVariant_toInt64(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to int64 and return its value.
GblType type
GblType UUID.
GBL_RESULT GblVariant_constructMove(GblVariant *pSelf, GblVariant *pOther)
Invokes the move constructor, constructing then moving the pOther variant.
GBL_RESULT GblVariant_valueMove(GblVariant *pSelf,...)
Attempts to move the value stored within the variant out of it and into the provided pointer.
void * GblVariant_opaqueMove(GblVariant *pSelf)
Attempst to take the value of the variant (claiming ownerships) as a generic opaque pointer,...
GBL_RESULT GblVariant_setBool(GblVariant *pSelf, GblBool value)
Convenience wrapper assigning the value of a constructed variant to a boolean.
GBL_RESULT GblVariant_constructNil(GblVariant *pSelf)
Convenience wrapper for value constructing a variant with a NIL value.
GblObject * GblVariant_objectCopy(const GblVariant *pSelf)
Attempts to fetch a copy of the value of the variant by making a new generic GblObject reference,...
GBL_RESULT GblVariant_valueCopyVa(const GblVariant *pSelf, va_list *pVa)
va_list* variant of GblVariant_valueCopy(), where the destination pointer comes from a va_list*
GBL_RESULT GblVariant_constructBool(GblVariant *pSelf, GblBool value)
Convenience wrapper for value constructing a variant with a bool value.
GBL_RESULT GblVariant_constructOpaqueCopy(GblVariant *pSelf, GblType opaqueType, void *pValue)
Convenience wrapper for value copy constructing a variant from an opaque-derived type pointer.
uint64_t GblVariant_uint64(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a uint64, raising an error upon type mismatch.
uint16_t GblVariant_toUint16(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to uint16 and return its value.
uint16_t u16
uint16_t value
const GblStringRef * GblVariant_string(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a string, raising an error upon type mismatch.
GBL_RESULT GblVariant_constructDefault(GblVariant *pSelf, GblType type)
Invokes the default constructor for the given type.
GBL_RESULT GblVariant_setString(GblVariant *pSelf, const char *pValue)
Convenience wrapper assigning the value of a constructed variant to a copy of the given string.
uint32_t u32
uint32_t value
GblType GblVariant_toTypeValue(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to GblType and return its value.
GblEnum enumeration
enum value
GBL_RESULT GblVariant_load(GblVariant *pSelf, const GblStringBuffer *pStr)
Attempts to deserialize a value within a GblStringBuffer to store within the given variant.
GBL_RESULT GblVariant_constructValueCopy(GblVariant *pSelf, GblType type,...)
Invokes the value copy constructor, constructing then copying the given value.
size_t GblVariant_count(const GblVariant *pSelf)
Returns the number of table entries within the given GblVariant.
GBL_RESULT GblVariant_constructFloat(GblVariant *pSelf, float value)
Convenience wrapper for value constructing a variant with a float value.
GBL_RESULT GblVariant_setChar(GblVariant *pSelf, char value)
Convenience wrapper assigning the value of a constructed variant to a character.
GBL_RESULT GblVariant_setBoxCopy(GblVariant *pSelf, GblBox *pValue)
Convenience wrapper which assigns the value of the given variant to that of a new reference to a GblB...
char GblVariant_toChar(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to char and return its value.
void * pVoid
void* value
GBL_RESULT GblVariant_constructSize(GblVariant *pSelf, size_t value)
Convenience wrapper for value copy constructing a variant with a size_t.
GblBool GblVariant_isValid(const GblVariant *pSelf)
Returns GBL_TRUE if the value held by the given variant is not of GBL_INVALID_TYPE.
uint8_t GblVariant_uint8(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a uint8, raising an error upon type mismatch.
int32_t GblVariant_toInt32(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to int32 and return its value.
GBL_RESULT GblVariant_constructBoxMove(GblVariant *pSelf, GblBox *pValue)
Convenience wrapper for value move constructing a variant from a GblBox, taking ownership of the refe...
GBL_RESULT GblVariant_setObjectCopy(GblVariant *pSelf, GblObject *pValue)
Convenience wrapper which assigns the value of the given variant to that of a new reference to a GblO...
void * GblVariant_pointer(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a generic pointer, raising an error upon type mismatch.
GBL_RESULT GblVariant_setInt16(GblVariant *pSelf, int16_t value)
Convenience wrapper assigning the value of a constructed variant to an int16.
GBL_RESULT GblVariant_setMove(GblVariant *pSelf, GblVariant *pOther)
Performs a move assignment operation, moving the given variant's value into pOther.
GBL_RESULT GblVariant_registerConverter(GblType fromType, GblType toType, GblVariantConverterFn pFnConv)
Registers a converter with the type system for going from one type of variant to another.
GblBool GblVariant_toBool(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to bool and return its value.
GBL_RESULT GblVariant_constructOpaqueMove(GblVariant *pSelf, GblType opaqueType, void *pValue)
Convenience wrapper for value move constructing a variant from an opaque-derived type pointer.
GblBool GblVariant_bool(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a bool, raising an error upon type mismatch.
float GblVariant_float(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a float, raising an error upon type mismatch.
GBL_RESULT GblVariant_constructBoxCopy(GblVariant *pSelf, GblBox *pValue)
Convenience wrapper for value copy constructing a variant from a GblBox, increasing its refCount.
GBL_RESULT GblVariant_invalidate(GblVariant *pSelf)
Clears and resets the given variants type and value. ONLY call after being the source of a move opera...
int16_t GblVariant_int16(const GblVariant *pSelf)
Attempst to fetch the value of the variant as an int16, raising an error upon type mismatch.
GBL_RESULT GblVariant_setValueCopyVa(GblVariant *pSelf, GblType type, va_list *pVarArgs)
va_list* variation of GblVariant_setValueCopy(), where the value is sourdced from a va_list*
GBL_RESULT GblVariant_constructStringView(GblVariant *pSelf, GblStringView value)
Convenience wrapper for value copy constructing a string variant from a string view.
char character
char value
GblObject * GblVariant_objectMove(GblVariant *pSelf)
Attempts to take the value stored within the variant as generic GblObject pointer,...
GBL_RESULT GblVariant_setOpaqueMove(GblVariant *pSelf, GblType opaqueType, void *pValue)
Convenience wrapper move assigning the value of a constructed variant to that of an opaque-derived ty...
GblObject * GblVariant_objectPeek(const GblVariant *pSelf)
Attempts to fetch the value stored within the variant as a pointer to a GblObject derived type.
GBL_RESULT GblVariant_constructValueMoveVa(GblVariant *pSelf, GblType type, va_list *pList)
va_list* variation of GblVariant_constructValueMove()
GBL_RESULT GblVariant_constructValueCopyVa(GblVariant *pSelf, GblType type, va_list *pList)
va_list* variation of GblVariant_constructValueCopy()
uint8_t u8
uint8_t value
GblStringView GblVariant_toStringView(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to string view and return its value.
void * GblVariant_opaqueCopy(const GblVariant *pSelf)
Attempst to fetch a copy of the value of the variant as a generic opaque pointer, raising an error up...
GblInstance * pInstance
GblInstance* value.
GblDateTime * pDateTime
GblDateTime value.
GBL_RESULT GblVariant_valueMoveVa(GblVariant *pSelf, va_list *pVa)
va_list* variant of GblVariant_valueMove(), where destination pointer comes from a va_list*
GBL_RESULT GblVariant_constructTypeValue(GblVariant *pSelf, GblType type)
Convenience wrapper for value constructing a variant from a GblType.
uint64_t u64
uint64_t value
GBL_RESULT GblVariant_constructInt16(GblVariant *pSelf, int16_t value)
Convenience wrapper for value constructing a variant with an int16 value.
GblFnPtr pFnPtr
function pointer value
GBL_RESULT GblVariant_setValueMoveVa(GblVariant *pSelf, GblType type, va_list *pVarArgs)
va_list* variation of GblVariant_setValueMove(), where the value is sourced from a va_list*
float GblVariant_toFloat(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to float and return its value.
GBL_RESULT GblVariant_setUint8(GblVariant *pSelf, uint8_t value)
Convenience wrapper assigning the value of a constructed variant to a uint8.
void * GblVariant_toPointer(GblVariant *pSelf)
Convenience method that attempts to convert the variant's type to pointer and return its value.
int64_t GblVariant_int64(const GblVariant *pSelf)
Attempst to fetch the value of the variant as an int64, raising an error upon type mismatch.
uint16_t GblVariant_uint16(const GblVariant *pSelf)
Attempst to fetch the value of the variant as a uint16, raising an error upon type mismatch.
GBL_RESULT GblVariant_setNil(GblVariant *pSelf)
Convenience wrapper assigning the value of a constructed variant to NIL.
GBL_RESULT GblVariant_constructInstance(GblVariant *pSelf, GblInstance *pValue)
Convenience wrapper for value constructing a variant from a GblInstance pointer.
GBL_RESULT GblVariant_setInt32(GblVariant *pSelf, int32_t value)
Convenience wrapper assigning the value of a constructed variant to an int32.
GBL_RESULT GblVariant_setField(GblVariant *pSelf, const char *pName, GblVariant *pValue)
Sets the value of the table entry with the corresponding string key to pValue, returning a status cod...
int32_t GblVariant_int32(const GblVariant *pSelf)
Attempst to fetch the value of the variant as an int32, raising an error upon type mismatch.
GBL_RESULT GblVariant_constructValueMove(GblVariant *pSelf, GblType type,...)
Invokes the value move constructor, constructing then moving the given value.
GBL_RESULT GblVariant_save(const GblVariant *pSelf, GblStringBuffer *pString)
Attempts to serialize the value stored within the given variant to a GblStringBuffer.