NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
nnl::Writer::Offset< T > Class Template Reference

Pointer-like object for storing stream positions. More...

#include <io.hpp>

Public Member Functions

auto operator* () const
 Gets a reference to T.
template<typename M, typename A = T, std::enable_if_t< std::is_class_v< A >, int > = 0>
auto operator->* (M A::*member) const
 Gets a reference to a member of T (->)
auto operator[] (std::size_t index) const
 Gets a reference to the element at the index relative to the current offset.
template<typename Int>
 operator Int () const noexcept
 Conversion to integer (returns the offset_ value)

Detailed Description

template<typename T>
class nnl::Writer::Offset< T >

Pointer-like object for storing stream positions.

This object stores specific offsets from the main stream position to provide easier access to the referenced objects.

std::size_t struct_offset = 0; // Not yet known
auto off = f.Write(struct_offset);
// ...
*off = f.Tell(); // Change the value
Template Parameters
TType being referenced by the offset
See also
nnl::Writer::Ref

Member Function Documentation

◆ operator Int()

template<typename T>
template<typename Int>
nnl::Writer::Offset< T >::operator Int ( ) const
inlineexplicitnoexcept

Conversion to integer (returns the offset_ value)

Template Parameters
IntInteger type
Returns
The offset_ value as integer

◆ operator*()

template<typename T>
auto nnl::Writer::Offset< T >::operator* ( ) const
inline

Gets a reference to T.

Returns
Ref pointing to the member
See also
nnl::Writer::Ref

◆ operator->*()

template<typename T>
template<typename M, typename A = T, std::enable_if_t< std::is_class_v< A >, int > = 0>
auto nnl::Writer::Offset< T >::operator->* ( M A::* member) const
inline

Gets a reference to a member of T (->)

Template Parameters
MMember type (deduced)
Parameters
memberPointer to member
Returns
Ref pointing to the member
See also
nnl::Writer::Ref

◆ operator[]()

template<typename T>
auto nnl::Writer::Offset< T >::operator[] ( std::size_t index) const
inline

Gets a reference to the element at the index relative to the current offset.

Enables array-like access.

Parameters
indexindex of the element.
Returns
Ref to the value at offset.
See also
nnl::Writer::Ref

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