Skip to content

iris::Field< V, D, P > Class Template Reference

Doxygen 1.15.0 generates this reference during each site build from the public headers. The C++ guide shows the API in use.

A typed handle to an entry: its name, the type of its leaves, its number of array levels, and whether it may be undefined. More...

#include <iris/handle.hpp>

Public Types

using Value = V
 The value type.

Public Member Functions

constexpr Field (std::string_view name)
 A handle to the entry called name, which must outlive the handle.
constexpr std::string_view name () const
 Return the name of the entry.
View< V, D, P > view (const Data &data) const
 Return the entry of data through this handle.
template<class I, class B = build::Indexing>
auto operator[] (I &&index) const
 In a builder expression, element index of this entry (<iris/build.hpp>).
template<class B = build::Indexing>
auto dynamic () const
 In a builder expression, this entry with its type and depth forgotten (<iris/build.hpp>).

Static Public Attributes

static constexpr std::size_t depth = D
 The number of array levels, or dynamic_depth.
static constexpr Presence presence = P
 Whether the entry may be undefined.

Detailed Description

template<class V, std::size_t D = 0, Presence P = Presence::Required>
class iris::Field< V, D, P >

A typed handle to an entry: its name, the type of its leaves, its number of array levels, and whether it may be undefined.

Data::get returns the entry through the handle as the View for V, D and P: an integer, a span of integers, an Array of depth 2, and so on, wrapped in std::optional when P is Presence::Maybe. A handle is a literal type, so it can be declared constexpr for an entry that a spec is known to define. The builder in <iris/build.hpp> returns handles from its statements and takes them in expressions.

Template Parameters
Vthe value type (see HandleValue)
Dthe number of array levels, or dynamic_depth
Pwhether the entry may be undefined

Member Typedef Documentation

Value

template<class V, std::size_t D = 0, Presence P = Presence::Required>
using iris::Field< V, D, P >::Value = V

The value type.

Constructor & Destructor Documentation

Field()

template<class V, std::size_t D = 0, Presence P = Presence::Required>
iris::Field< V, D, P >::Field ( std::string_view name)
inlineexplicitconstexpr

A handle to the entry called name, which must outlive the handle.

Member Function Documentation

dynamic()

template<class V, std::size_t D = 0, Presence P = Presence::Required>
template<class B = build::Indexing>
auto iris::Field< V, D, P >::dynamic ( ) const
inlinenodiscard

In a builder expression, this entry with its type and depth forgotten (<iris/build.hpp>).

name()

template<class V, std::size_t D = 0, Presence P = Presence::Required>
std::string_view iris::Field< V, D, P >::name ( ) const
inlinenodiscardconstexpr

Return the name of the entry.

operator[]()

template<class V, std::size_t D = 0, Presence P = Presence::Required>
template<class I, class B = build::Indexing>
auto iris::Field< V, D, P >::operator[] ( I && index) const
inlinenodiscard

In a builder expression, element index of this entry (<iris/build.hpp>).

view()

template<class V, std::size_t D = 0, Presence P = Presence::Required>
View< V, D, P > iris::Field< V, D, P >::view ( const Data & data) const
inlinenodiscard

Return the entry of data through this handle.

Throws AccessError if a required entry is missing, or if the entry has another type or depth. Data::get calls it.

Member Data Documentation

depth

template<class V, std::size_t D = 0, Presence P = Presence::Required>
std::size_t iris::Field< V, D, P >::depth = D
staticconstexpr

The number of array levels, or dynamic_depth.

presence

template<class V, std::size_t D = 0, Presence P = Presence::Required>
Presence iris::Field< V, D, P >::presence = P
staticconstexpr

Whether the entry may be undefined.