Spicy
Public Member Functions | List of all members
hilti::rt::type_info::Value Class Reference

#include <type-info.h>

Public Member Functions

 Value (const void *ptr, const TypeInfo *ti, const value::Parent &parent)
 
 Value (const void *ptr, const TypeInfo *ti, const Value &parent)
 
 Value ()=default
 
const void * pointer () const
 
const TypeInfotype () const
 
 operator bool () const
 

Detailed Description

Class representing a HILTI value generically through a pair of (1) a raw pointer referring the value's storage, and (2) type information describing how to interpret the raw pointer. An instance may be in an invalid state if there's no underlying value available (e.g., when dereferencing an unset optional).

Value instances are tied to a Parent instance. The value's data will remain accessible only as long as the parent stays around. If that goes away, deferencing will throw an error.

Constructor & Destructor Documentation

◆ Value() [1/3]

hilti::rt::type_info::Value::Value ( const void *  ptr,
const TypeInfo ti,
const value::Parent parent 
)
inline

Constructor

Parameters
ptrraw pointer to storage of the value
titype information describing how to interpret the pointer
parentparent controlling life time of the value

◆ Value() [2/3]

hilti::rt::type_info::Value::Value ( const void *  ptr,
const TypeInfo ti,
const Value parent 
)
inline

Constructor

Parameters
ptrraw pointer to storage of the value
titype information describing how to interpret the pointer
parentparent value controlling life time of this value

◆ Value() [3/3]

hilti::rt::type_info::Value::Value ( )
default

Default constructor creating a value in invalid state.

Member Function Documentation

◆ operator bool()

hilti::rt::type_info::Value::operator bool ( ) const
inline

Returns true if the instance is referring to a valid value.

◆ pointer()

const void* hilti::rt::type_info::Value::pointer ( ) const
inline

Returns a raw pointer to the value's storage.

Exceptions
<tt>InvalidValue</tt>if the instance is not referring to a valid value.

◆ type()

const TypeInfo& hilti::rt::type_info::Value::type ( ) const
inline

Returns the type information associated with the raw pointer.


The documentation for this class was generated from the following file: