Can hold any supported value type. Wraps std::variant to allow recursion and implements some helpers.
More...
#include <var.h>
|
| using | ValueType |
| | The std::variant that we wrap.
|
|
| | Var ()=default |
| | ~Var ()=default |
| template<typename T> |
| constexpr | Var (T t) |
| | Construction from a value (explicit).
|
| constexpr | operator ValueType & () noexcept |
| | Conversion into the wrapped std::variant for interoperability.
|
| constexpr | operator const ValueType & () const noexcept |
| | Conversion into the wrapped std::variant for interoperability.
|
| template<typename T> |
| constexpr bool | holds () const noexcept |
| | True if the Var holds a value of T.
|
| template<typename... Ts> |
| constexpr bool | holdsAnyOff () const noexcept |
| | True if the Var holds a value of type T, where T is in Ts .
|
| constexpr bool | holdsIntegralValue () const noexcept |
| | Checks whether the contained value is a integral type.
|
| constexpr bool | holdsFloatingPointValue () const noexcept |
| | Checks whether the contained value is a floating point type.
|
| constexpr bool | isEmpty () const noexcept |
| | True if the Var holds a value of std::monostate.
|
| template<typename T, bool checkedConversion = false> |
| T | getCopyAs () const |
| | See sen::getCopyAs().
|
| template<typename T> |
| constexpr T & | get () |
| | Same as std::get<T>(this->value);.
|
| template<typename T> |
| constexpr const T & | get () const |
| | Same as std::get<T>(this->value);.
|
| template<typename T> |
| const T * | getIf () const noexcept |
| | Same as std::get_if<T>(&(this->value)).
|
| template<typename T> |
| T * | getIf () noexcept |
| | Same as std::get_if<T>(&(this->value)).
|
| void | swap (Var &rhs) noexcept |
| | Swaps contents with another Var.
|
Can hold any supported value type. Wraps std::variant to allow recursion and implements some helpers.
◆ ValueType
Initial value:std::variant<std::monostate,
int32_t,
uint32_t,
int64_t,
uint64_t,
uint8_t,
int16_t,
uint16_t,
bool,
std::string,
A time duration.
Definition duration.h:25
A point in time.
Definition timestamp.h:26
std::tuple< uint32_t, std::shared_ptr< Var > > KeyedVar
A key-var tuple, to represent variants.
Definition var.h:110
std::map< std::string, Var, std::less<> > VarMap
A map of vars to represent structures.
Definition var.h:107
std::vector< Var > VarList
A list of vars to represent sequences.
Definition var.h:104
float float32_t
Definition numbers.h:16
double float64_t
Definition numbers.h:17
The std::variant that we wrap.
◆ Var() [1/2]
◆ ~Var()
◆ Var() [2/2]
Construction from a value (explicit).
◆ operator ValueType &()
Conversion into the wrapped std::variant for interoperability.
◆ operator const ValueType &()
| sen::Var::operator const ValueType & |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Conversion into the wrapped std::variant for interoperability.
◆ holds()
template<typename T>
| bool sen::Var::holds |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
True if the Var holds a value of T.
◆ holdsAnyOff()
template<typename... Ts>
| bool sen::Var::holdsAnyOff |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
True if the Var holds a value of type T, where T is in Ts .
◆ holdsIntegralValue()
| bool sen::Var::holdsIntegralValue |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
Checks whether the contained value is a integral type.
◆ holdsFloatingPointValue()
| bool sen::Var::holdsFloatingPointValue |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
Checks whether the contained value is a floating point type.
◆ isEmpty()
| bool sen::Var::isEmpty |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
True if the Var holds a value of std::monostate.
◆ getCopyAs()
template<typename T, bool checkedConversion = false>
| T sen::Var::getCopyAs |
( |
| ) |
const |
|
inlinenodiscard |
◆ get() [1/2]
Same as std::get<T>(this->value);.
◆ get() [2/2]
template<typename T>
| const T & sen::Var::get |
( |
| ) |
const |
|
inlinenodiscardconstexpr |
Same as std::get<T>(this->value);.
◆ getIf() [1/2]
template<typename T>
| const T * sen::Var::getIf |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Same as std::get_if<T>(&(this->value)).
◆ getIf() [2/2]
Same as std::get_if<T>(&(this->value)).
◆ swap()
| void sen::Var::swap |
( |
Var & | rhs | ) |
|
|
noexcept |
Swaps contents with another Var.
◆ operator==
| bool operator== |
( |
const Var & | lhs, |
|
|
const Var & | rhs ) |
|
friend |
◆ operator!=
| bool operator!= |
( |
const Var & | lhs, |
|
|
const Var & | rhs ) |
|
friend |
The documentation for this struct was generated from the following file: