OpenBarnyard
 
Loading...
Searching...
No Matches
PTRBSections::MemoryStream::Ptr< T > Class Template Reference

#include <PTRB.h>

Public Member Functions

 Ptr ()
 
 Ptr (PTRBSections::MemoryStream *stack, TUINT offset)
 
 Ptr (PTRBSections::MemoryStream *stack, T *ptr)
 
T * get ()
 
const T * get () const
 
PTRBSections::MemoryStreamstack ()
 
TUINT offset () const
 
T & operator* ()
 
T * operator-> ()
 
template<typename N>
Ptr< T > operator+ (const N &a_iValue)
 
template<typename N>
Ptr< T > operator- (const N &a_iValue)
 
 operator TBOOL () const
 

Detailed Description

template<class T>
class PTRBSections::MemoryStream::Ptr< T >

Definition at line 66 of file PTRB.h.

Constructor & Destructor Documentation

◆ Ptr() [1/3]

template<class T>
PTRBSections::MemoryStream::Ptr< T >::Ptr ( )
inline

Definition at line 69 of file PTRB.h.

70 : m_Stack( TNULL ), m_Offset( 0 ) {}

◆ Ptr() [2/3]

template<class T>
PTRBSections::MemoryStream::Ptr< T >::Ptr ( PTRBSections::MemoryStream * stack,
TUINT offset )
inline

Definition at line 71 of file PTRB.h.

72 : m_Stack( stack ), m_Offset( offset ) {}
PTRBSections::MemoryStream * stack()
Definition PTRB.h:88

◆ Ptr() [3/3]

template<class T>
PTRBSections::MemoryStream::Ptr< T >::Ptr ( PTRBSections::MemoryStream * stack,
T * ptr )
inline

Definition at line 73 of file PTRB.h.

74 : m_Stack( stack ), m_Offset( stack->GetOffset( ptr ) ) {}

Member Function Documentation

◆ get() [1/2]

template<class T>
T * PTRBSections::MemoryStream::Ptr< T >::get ( )
inline

Definition at line 76 of file PTRB.h.

77 {
78 TASSERT( this->operator TBOOL() == TTRUE, "Pointer is null" );
79 return TREINTERPRETCAST( T*, m_Stack->GetBuffer() + m_Offset );
80 }
#define TASSERT(X,...)
Definition Defines.h:138
#define TREINTERPRETCAST(TYPE, VALUE)
Definition Defines.h:68
bool TBOOL
Definition Typedefs.h:6

◆ get() [2/2]

template<class T>
const T * PTRBSections::MemoryStream::Ptr< T >::get ( ) const
inline

Definition at line 82 of file PTRB.h.

83 {
84 TASSERT( this->operator TBOOL() == TTRUE, "Pointer is null" );
85 return TREINTERPRETCAST( const T*, m_Stack->GetBuffer() + m_Offset );
86 }

◆ offset()

template<class T>
TUINT PTRBSections::MemoryStream::Ptr< T >::offset ( ) const
inline

Definition at line 93 of file PTRB.h.

94 {
95 return m_Offset;
96 }

◆ operator TBOOL()

template<class T>
PTRBSections::MemoryStream::Ptr< T >::operator TBOOL ( ) const
inline

Definition at line 122 of file PTRB.h.

123 {
124 return m_Stack != TNULL;
125 }

◆ operator*()

template<class T>
T & PTRBSections::MemoryStream::Ptr< T >::operator* ( )
inline

Definition at line 98 of file PTRB.h.

99 {
100 TASSERT( this->operator TBOOL() == TTRUE, "Pointer is null" );
101 return *TREINTERPRETCAST( T*, m_Stack->GetBuffer() + m_Offset );
102 }

◆ operator+()

template<class T>
template<typename N>
Ptr< T > PTRBSections::MemoryStream::Ptr< T >::operator+ ( const N & a_iValue)
inline

Definition at line 111 of file PTRB.h.

112 {
113 return Ptr<T>{ m_Stack, m_Offset + sizeof( T ) * a_iValue };
114 }

◆ operator-()

template<class T>
template<typename N>
Ptr< T > PTRBSections::MemoryStream::Ptr< T >::operator- ( const N & a_iValue)
inline

Definition at line 117 of file PTRB.h.

118 {
119 return Ptr<T>{ m_Stack, m_Offset - sizeof( T ) * a_iValue };
120 }

◆ operator->()

template<class T>
T * PTRBSections::MemoryStream::Ptr< T >::operator-> ( )
inline

Definition at line 104 of file PTRB.h.

105 {
106 TASSERT( this->operator TBOOL() == TTRUE, "Pointer is null" );
107 return TREINTERPRETCAST( T*, m_Stack->GetBuffer() + m_Offset );
108 }

◆ stack()

template<class T>
PTRBSections::MemoryStream * PTRBSections::MemoryStream::Ptr< T >::stack ( )
inline

Definition at line 88 of file PTRB.h.

89 {
90 return m_Stack;
91 }

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