Archicad 28 C++ API
Loading...
Searching...
No Matches
APIVariant< Types > Struct Template Reference

Represents a variant in the API layer. More...

#include <API_ValueWrappers.hpp>

Public Member Functions

template<typename T >
void Put (T p)
 Puts an item to the variant.
 
template<typename T >
Get () const
 Get the item from the variant with the given template type.
 
template<typename T >
bool IsType () const
 Checks if the stored item's type is equivalent with the given template type.
 
template<typename T >
APIVariantoperator= (T p)
 Sets the item to the variant to store.
 

Public Attributes

std::byte buffer [GS::Max(sizeof(Types)...)]
 The buffer for the types.
 
UInt8 typeIndex
 Type index.
 

Static Public Attributes

template<class T >
static constexpr bool Contains = GS::ParameterPack<Types...>::template Contains<T>
 Contains.
 
template<class T >
static constexpr UInt8 TypeToIndex = GS::ParameterPack<Types...>::template FindFirst<T>
 Type to index.
 

Detailed Description

template<typename... Types>
struct APIVariant< Types >

Represents a variant in the API layer.

Since
Archicad 27

Member Function Documentation

◆ Get()

template<typename... Types>
template<typename T >
T APIVariant< Types >::Get ( ) const
inline

Get the item from the variant with the given template type.

Returns
Returns the element of the given template type.

◆ IsType()

template<typename... Types>
template<typename T >
bool APIVariant< Types >::IsType ( ) const
inline

Checks if the stored item's type is equivalent with the given template type.

Returns
Returns true if the stored item in the variant has the given template type.

◆ operator=()

template<typename... Types>
template<typename T >
APIVariant & APIVariant< Types >::operator= ( p)
inline

Sets the item to the variant to store.

Parameters
pItem to set.
Returns
Returns the modified APIVariant.

◆ Put()

template<typename... Types>
template<typename T >
void APIVariant< Types >::Put ( p)
inline

Puts an item to the variant.

Parameters
pItem to put into the variant.