xentara-plugin v2.0.4
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::memory::Array::ObjectHandle< Type > Class Template Reference

A handle to an array element containing an object or an array of objects. More...

#include <xentara/memory/Array.hpp>

Public Types

using TargetObject = memory::Object< Type >
 The object type describing the structure.
 
using Element = typename TargetObject::Element
 The C++ object type.
 

Public Member Functions

constexpr ObjectHandle () noexcept=default
 Default constructor.
 
template<typename Base >
requires std::derived_from<Type, Base>
 operator ObjectHandle< Base > () const
 Gets a handle to an unambiguous base class.
 
auto operator== (const ObjectHandle &) const -> bool=default
 Comparison operator.
 
auto operator<=> (const ObjectHandle &) const -> auto=default
 Comparison operator.
 
constexpr auto rawHandle () const noexcept -> const Handle &
 Gets the raw handle.
 
constexpr auto offset () const noexcept -> std::size_t
 Gets the offset within the array data.
 
template<typename TypeOrBase , typename MemberType >
requires std::derived_from<Type, TypeOrBase>
auto member (MemberType TypeOrBase::*member) const noexcept -> ObjectHandle< MemberType >
 Returns a handle to a member.
 
auto operator++ () noexcept -> ObjectHandle &
 Increments the handle by a one element.
 
auto operator++ (int) noexcept -> ObjectHandle
 Increments the handle by a one element.
 
auto operator-- () noexcept -> ObjectHandle &
 Decrements the handle by a one element.
 
auto operator-- (int) noexcept -> ObjectHandle
 Decrements the handle by a one element.
 
auto operator+= (std::ptrdiff_t count) noexcept -> ObjectHandle &
 Offsets the handle by a specific number of elements.
 
auto operator-= (std::ptrdiff_t count) noexcept -> ObjectHandle &
 Offsets the handle by a specific number of elements.
 

Detailed Description

template<typename Type>
class xentara::memory::Array::ObjectHandle< Type >

A handle to an array element containing an object or an array of objects.

This handle can be used to get the element from a reader or writer

Member Typedef Documentation

◆ Element

template<typename Type >
using xentara::memory::Array::ObjectHandle< Type >::Element = typename TargetObject::Element

The C++ object type.

◆ TargetObject

template<typename Type >
using xentara::memory::Array::ObjectHandle< Type >::TargetObject = memory::Object<Type>

The object type describing the structure.

Constructor & Destructor Documentation

◆ ObjectHandle()

template<typename Type >
constexpr xentara::memory::Array::ObjectHandle< Type >::ObjectHandle ( )
constexprdefaultnoexcept

Default constructor.

This constructor creates an invalid handle. Do not attempt to use this handle, the associated memory may not be valid.

Member Function Documentation

◆ member()

template<typename Type >
template<typename TypeOrBase , typename MemberType >
requires std::derived_from<Type, TypeOrBase>
auto xentara::memory::Array::ObjectHandle< Type >::member ( MemberType TypeOrBase::*  member) const -> ObjectHandle<MemberType>
noexcept

Returns a handle to a member.

Parameters
memberThe member
Returns
A handle to the member at the specified offset

◆ offset()

template<typename Type >
constexpr auto xentara::memory::Array::ObjectHandle< Type >::offset ( ) const -> std::size_t
constexprnoexcept

Gets the offset within the array data.

◆ operator ObjectHandle< Base >()

template<typename Type >
template<typename Base >
requires std::derived_from<Type, Base>
xentara::memory::Array::ObjectHandle< Type >::operator ObjectHandle< Base > ( ) const

Gets a handle to an unambiguous base class.

◆ operator++() [1/2]

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator++ ( ) -> ObjectHandle &
noexcept

Increments the handle by a one element.

Attention
This can make the handle point to invalid data. It is your respoinsibility to ensure that the handle does not end up pointing outside of the array's data.
Returns
Returns a reference to this object

◆ operator++() [2/2]

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator++ ( int  ) -> ObjectHandle
noexcept

Increments the handle by a one element.

Attention
This can make the handle point to invalid data. It is your respoinsibility to ensure that the handle does not end up pointing outside of the array's data.
Returns
The old value of the handle

◆ operator+=()

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator+= ( std::ptrdiff_t  count) -> ObjectHandle &
noexcept

Offsets the handle by a specific number of elements.

Attention
This can make the handle point to invalid data. It is your respoinsibility to ensure that the handle does not end up pointing outside of the array's data.
Parameters
countThe number of elements to move the handle
Returns
Returns a reference to this object

◆ operator--() [1/2]

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator-- ( ) -> ObjectHandle &
noexcept

Decrements the handle by a one element.

Attention
This can make the handle point to invalid data. It is your respoinsibility to ensure that the handle does not end up pointing outside of the array's data.
Returns
Returns a reference to this object

◆ operator--() [2/2]

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator-- ( int  ) -> ObjectHandle
noexcept

Decrements the handle by a one element.

Attention
This can make the handle point to invalid data. It is your respoinsibility to ensure that the handle does not end up pointing outside of the array's data.
Returns
The old value of the handle

◆ operator-=()

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator-= ( std::ptrdiff_t  count) -> ObjectHandle &
noexcept

Offsets the handle by a specific number of elements.

Attention
This can make the handle point to invalid data. It is your respoinsibility to ensure that the handle does not end up pointing outside of the array's data.
Parameters
countThe negative number of elements to move the handle
Returns
Returns a reference to this object

◆ operator<=>()

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator<=> ( const ObjectHandle< Type > &  ) const -> auto=default
default

Comparison operator.

◆ operator==()

template<typename Type >
auto xentara::memory::Array::ObjectHandle< Type >::operator== ( const ObjectHandle< Type > &  ) const -> bool=default
default

Comparison operator.

◆ rawHandle()

template<typename Type >
constexpr auto xentara::memory::Array::ObjectHandle< Type >::rawHandle ( ) const -> const Handle &
constexprnoexcept

Gets the raw handle.