OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::valtree::compound_attribute Class Reference

Combination of a reference to a tree compound and a single attribute. More...

#include <eagine/value_tree/wrappers.hpp>

Public Member Functions

 compound_attribute () noexcept=default
 Default constructor. Constructs empty attribute refering to nothing.
 
 compound_attribute (compound c, attribute a) noexcept
 Construction from a compound and attribute pair. More...
 
 operator bool () const noexcept
 Indicates if this attribute actually refers to something.
 
auto type_id () const noexcept
 Returns the shared implementation type id of the attribute and compound.
 
auto name () const noexcept -> string_view
 Returns the name of this attribute.
 
auto is_link () const noexcept -> bool
 Indicates if the specified attribute is a reference or link in the tree.
 
auto canonical_type () const -> value_type
 Returns the canonical value type of this attribute.
 
auto nested_count () const -> span_size_t
 Returns the count of nested attributes of an attribute. More...
 
auto has_nested () const -> span_size_t
 Indicates if an attribute has nested attribute accessible by index.
 
auto nested (span_size_t index) const -> compound_attribute
 Returns nested attribute of an attribute at the specified index. More...
 
auto nested (string_view name) const -> compound_attribute
 Returns nested attribute of an attribute with the specified name. More...
 
auto find (const basic_string_path &path) const -> compound_attribute
 Returns nested attribute of an attribute at the specified path. More...
 
auto value_count () const -> span_size_t
 Returns the number of value elements accessible through an attribute.
 
template<typename T >
auto fetch_values (span_size_t offset, span< T > dest) const
 Fetches values from this attribute, starting at offset, into dest.
 
template<typename T >
auto fetch_values (span< T > dest) const
 Fetches values from this attribute, into dest.
 
auto fetch_blob (memory::block dest) const
 Fetches a BLOB from this attribute, into dest.
 
template<typename T , identifier_t V>
auto fetch_value (span_size_t offset, T &dest, selector< V > sel=default_selector) const -> bool
 Fetches a value from this attribute, starting at offset, with selector.
 
template<typename T , identifier_t V>
auto select_value (T &dest, selector< V > sel) const -> bool
 Fetches a value from this attribute, with selector.
 
template<typename T , identifier_t V>
auto select_values (span< T > dest, selector< V > sel) const -> span< T >
 Fetches a value from this attribute, with selector, into dest.
 
template<typename T >
auto fetch_value (T &dest) const -> bool
 Fetches a value from this attribute, into dest.
 
template<typename T >
auto get (span_size_t offset, type_identity< T > tid={}) const
 Returns a value of type T, from this attribute, at offset.
 
template<typename T >
auto get (type_identity< T > tid={}) const
 Returns a value of type T, from this attribute.
 

Detailed Description

Combination of a reference to a tree compound and a single attribute.

This class provides a more convenient value tree access interface, at the cost of storage space.

Constructor & Destructor Documentation

◆ compound_attribute()

eagine::valtree::compound_attribute::compound_attribute ( compound  c,
attribute  a 
)
inlinenoexcept

Construction from a compound and attribute pair.

Precondition
c.type_id() == a.type_id()

Member Function Documentation

◆ find()

auto eagine::valtree::compound_attribute::find ( const basic_string_path path) const -> compound_attribute
inline

Returns nested attribute of an attribute at the specified path.

Returns empty attribute handle if no such nested attribute exists.

◆ nested() [1/2]

auto eagine::valtree::compound_attribute::nested ( span_size_t  index) const -> compound_attribute
inline

Returns nested attribute of an attribute at the specified index.

Returns empty attribute handle if no such nested attribute exists.

◆ nested() [2/2]

auto eagine::valtree::compound_attribute::nested ( string_view  name) const -> compound_attribute
inline

Returns nested attribute of an attribute with the specified name.

Returns empty attribute handle if no such nested attribute exists.

◆ nested_count()

auto eagine::valtree::compound_attribute::nested_count ( ) const -> span_size_t
inline

Returns the count of nested attributes of an attribute.

Note
Some implementations may return zero here even if there are nested attributes. In such implementations the nested nodes can be traversed only by name.

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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).