carb::variant::IVariant¶
Defined in carb/variant/IVariant.h
-
struct
carb::variant
::
IVariant
¶ Interface for carb.variant.plugin
Public Functions
-
VariantArrayPtr
createArray
(const Variant *p = nullptr, size_t count = 0)¶ Creates a VariantArray object from the given parameters.
- Parameters
p – The raw array to copy into the new VariantArray; may be
nullptr
to produce an empty array.count – The count of items in
p
.
- Returns
A newly created VariantArray object.
-
VariantMapPtr
createMap
()¶ Creates a VariantMap object.
- Returns
A newly created VariantMap object.
Public Members
-
const VTable *(*
getVTable
)(RString type) noexcept¶ Retrieves a v-table by variant type.
Typically not used; see Translator instead.
- Parameters
type – The type to translate.
- Returns
A v-table for the given type, or
nullptr
in case of an unknown type.
-
bool (*
registerType
)(const VTable *vtable) noexcept¶ Registers a user variant type.
Note
vtable->typeName
must be a unique name within the running process and may not match any of the built-in type names.- Parameters
vtable – Must not be
nullptr
. This pointer is retained by carb.variant.plugin so the caller must guarantee its lifetime until it is unregistered with unregisterType(). A program that still references the v-table in a VariantData (or Variant) after it is unregistered is malformed.- Returns
true
ifvtable->typeName
was available and the type was successfully registered;false
otherwise.
-
bool (*
unregisterType
)(RString type) noexcept¶ Registers a user variant type.
- Parameters
type – The name of the type previously registered with registerType().
- Returns
true
if the type was unregistered;false
otherwise (i.e. the type was not previously registered).
Public Static Functions
-
static inline carb::InterfaceDesc
getInterfaceDesc
()¶ Returns information about this interface. Auto-generated by CARB_PLUGIN_INTERFACE(). *
- Returns
The carb::InterfaceDesc struct with information about this interface.
-
VariantArrayPtr