carb::variant::Registrar
Defined in carb/variant/VariantUtils.h
-
class Registrar
Lifetime management wrapper for IVariant::registerType().
Public Functions
-
constexpr Registrar() noexcept
Default constructor.
Constructs an empty registrar.
-
Registrar(const VTable *vtable) noexcept
Constructor.
Registers the type.
See also
IVariant::registerType()
Note
If registration fails, isEmpty() will return
true
.- Parameters
vtable – The v-table pointer to register.
-
~Registrar() noexcept
Destructor.
Unregisters the type. No-op if isEmpty() returns
true
.
-
Registrar(Registrar &&other) noexcept
Move-construct.
Moves the registered type to
*this
and leavesother
empty.- Parameters
other – The other Registrar to move from.
-
Registrar &operator=(Registrar &&other) noexcept
Move-assign.
Swaps state with
other
.- Parameters
other – The other Registrar to swap state with.
- Returns
*this
-
bool isEmpty() const noexcept
Checks whether
*this
is empty.- Returns
true
if*this
does not contain a valid type;false
otherwise.
-
RString getType() const noexcept
Retrieves the registered type.
- Returns
The managed type, or an empty
RString
if*this
is empty and no type is managed.
-
void reset() noexcept
Resets
*this
to an empty state, unregistering any registered type.
-
constexpr Registrar() noexcept