xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::model::ChildElementAccessor Class Referencefinal

A class that provides access to the child elements of an element. More...

#include <xentara/workbench/model/ChildElementAccessor.hpp>

Classes

class  Iterator
 

Public Types

using value_type = Element
 The element type.
 
using size_type = std::size_t
 The type used for sizes.
 
using difference_type = std::ptrdiff_t
 The type used for distances.
 
using reference = value_type &
 A reference to an element.
 
using const_reference = const value_type &
 A const reference to an element.
 
using pointer = Element *
 A pointer to an element.
 
using const_pointer = const Element *
 A const pointer to an element.
 
using iterator = Iterator
 An iterator.
 
using const_iterator = Iterator
 A const iterator.
 
using reverse_iterator = std::reverse_iterator< iterator >
 An iterator for iterating in reverse order.
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 A const iterator for iterating in reverse order.
 

Public Member Functions

Constructors
 ChildElementAccessor ()=default
 Default constructor.
 
Element Access
auto at (size_type index) const -> const_reference
 Accesses the child element at a certain index.
 
auto operator[] (size_type index) const noexcept -> const_reference
 Subscript operator.
 
auto front () const noexcept -> const_reference
 Returns the first element.
 
auto back () const noexcept -> const_reference
 Returns the last element.
 
Iterators
constexpr auto begin () const noexcept -> const_iterator
 Creates a begin iterator.
 
constexpr auto cbegin () const noexcept -> const_iterator
 Creates a begin iterator.
 
constexpr auto end () const noexcept -> const_iterator
 Creates an end iterator.
 
constexpr auto cend () const noexcept -> const_iterator
 Creates an end iterator.
 
constexpr auto rbegin () const noexcept -> const_reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto crbegin () const noexcept -> const_reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto rend () const noexcept -> const_reverse_iterator
 Creates a reverse end iterator.
 
constexpr auto crend () const noexcept -> const_reverse_iterator
 Creates a reverse end iterator.
 

Capacity

constexpr auto empty () const noexcept -> bool
 Determines whether the data is empty.
 
constexpr auto size () const noexcept -> size_type
 Gets the size of the data.
 

Detailed Description

A class that provides access to the child elements of an element.

This class is a special random access container class that allows you to access the child elements of an element. The accessor is index-based, and allows access to any element in constant time similar to std::accessor and std::array.

This is a lightweight reference object similar to std::span, and does not actually contain the children. Copying the object does not copy the actual child elements.

Member Typedef Documentation

◆ const_iterator

◆ const_pointer

A const pointer to an element.

◆ const_reference

A const reference to an element.

◆ const_reverse_iterator

◆ difference_type

◆ iterator

◆ pointer

◆ reference

◆ reverse_iterator

◆ size_type

◆ value_type

Constructor & Destructor Documentation

◆ ChildElementAccessor()

xentara::workbench::model::ChildElementAccessor::ChildElementAccessor ( )
default

Default constructor.

This constructor construct an accessor for an empty element list.

Member Function Documentation

◆ at()

auto xentara::workbench::model::ChildElementAccessor::at ( size_type  index) const -> const_reference

Accesses the child element at a certain index.

Parameters
indexThe index
Returns
A reference to the child element at the given index
Exceptions
std::out_of_rangeindex is out of range

◆ back()

auto xentara::workbench::model::ChildElementAccessor::back ( ) const -> const_reference
noexcept

Returns the last element.

Note
Must not be called on an empty accessor
Returns
A reference to last element

◆ begin()

constexpr auto xentara::workbench::model::ChildElementAccessor::begin ( ) const -> const_iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first element, or end(), if the data is empty

◆ cbegin()

constexpr auto xentara::workbench::model::ChildElementAccessor::cbegin ( ) const -> const_iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first element, or end(), if the data is empty

◆ cend()

constexpr auto xentara::workbench::model::ChildElementAccessor::cend ( ) const -> const_iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last element

◆ crbegin()

constexpr auto xentara::workbench::model::ChildElementAccessor::crbegin ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last element, or rend(), if the data is empty

◆ crend()

constexpr auto xentara::workbench::model::ChildElementAccessor::crend ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first element

◆ empty()

constexpr auto xentara::workbench::model::ChildElementAccessor::empty ( ) const -> bool
constexprnoexcept

Determines whether the data is empty.

Returns
Whether the data is empty

◆ end()

constexpr auto xentara::workbench::model::ChildElementAccessor::end ( ) const -> const_iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last element

◆ front()

auto xentara::workbench::model::ChildElementAccessor::front ( ) const -> const_reference
noexcept

Returns the first element.

Note
Must not be called on an empty accessor
Returns
A reference to first element

◆ operator[]()

auto xentara::workbench::model::ChildElementAccessor::operator[] ( size_type  index) const -> const_reference
noexcept

Subscript operator.

Returns a reference to the child element at a certain index

Parameters
indexThe index
Returns
A reference to the child element at the given index

◆ rbegin()

constexpr auto xentara::workbench::model::ChildElementAccessor::rbegin ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last element, or rend(), if the data is empty

◆ rend()

constexpr auto xentara::workbench::model::ChildElementAccessor::rend ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first element

◆ size()

constexpr auto xentara::workbench::model::ChildElementAccessor::size ( ) const -> size_type
constexprnoexcept

Gets the size of the data.

Returns
The number of elements contained in the data