AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DBCStorageIterator< T > Class Template Reference

#include "DBCStorageIterator.h"

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = T
 
using difference_type = std::ptrdiff_t
 
using pointer = T *
 
using reference = T &
 

Public Member Functions

 DBCStorageIterator ()
 
 DBCStorageIterator (T **index, uint32 size, uint32 pos=0)
 
T const * operator-> ()
 
T const * operator* ()
 
bool operator== (DBCStorageIterator const &right) const
 
bool operator!= (DBCStorageIterator const &right) const
 
DBCStorageIteratoroperator++ ()
 
DBCStorageIterator operator++ (int)
 

Private Attributes

T ** _index
 
uint32 _pos {0}
 
uint32 _end {0}
 

Detailed Description

template<class T>
class DBCStorageIterator< T >

Member Typedef Documentation

◆ difference_type

template<class T >
using DBCStorageIterator< T >::difference_type = std::ptrdiff_t

◆ iterator_category

template<class T >
using DBCStorageIterator< T >::iterator_category = std::forward_iterator_tag

◆ pointer

template<class T >
using DBCStorageIterator< T >::pointer = T*

◆ reference

template<class T >
using DBCStorageIterator< T >::reference = T&

◆ value_type

template<class T >
using DBCStorageIterator< T >::value_type = T

Constructor & Destructor Documentation

◆ DBCStorageIterator() [1/2]

template<class T >
DBCStorageIterator< T >::DBCStorageIterator ( )
inline
33: _index(nullptr) { }
T ** _index
Definition: DBCStorageIterator.h:69

◆ DBCStorageIterator() [2/2]

template<class T >
DBCStorageIterator< T >::DBCStorageIterator ( T **  index,
uint32  size,
uint32  pos = 0 
)
inline
34 : _index(index), _pos(pos), _end(size)
35 {
36 if (_pos < _end)
37 {
38 while (_pos < _end && !_index[_pos])
39 ++_pos;
40 }
41 }
uint32 _pos
Definition: DBCStorageIterator.h:70
uint32 _end
Definition: DBCStorageIterator.h:71

References DBCStorageIterator< T >::_end, DBCStorageIterator< T >::_index, and DBCStorageIterator< T >::_pos.

Member Function Documentation

◆ operator!=()

template<class T >
bool DBCStorageIterator< T >::operator!= ( DBCStorageIterator< T > const &  right) const
inline
47{ return !(*this == right); }

◆ operator*()

template<class T >
T const * DBCStorageIterator< T >::operator* ( )
inline

◆ operator++() [1/2]

template<class T >
DBCStorageIterator & DBCStorageIterator< T >::operator++ ( )
inline
50 {
51 if (_pos < _end)
52 {
53 do
54 ++_pos;
55 while (_pos < _end && !_index[_pos]);
56 }
57
58 return *this;
59 }

References DBCStorageIterator< T >::_end, DBCStorageIterator< T >::_index, and DBCStorageIterator< T >::_pos.

◆ operator++() [2/2]

template<class T >
DBCStorageIterator DBCStorageIterator< T >::operator++ ( int  )
inline
62 {
63 DBCStorageIterator tmp = *this;
64 ++*this;
65 return tmp;
66 }
Definition: DBCStorageIterator.h:25

◆ operator->()

template<class T >
T const * DBCStorageIterator< T >::operator-> ( )
inline

◆ operator==()

template<class T >
bool DBCStorageIterator< T >::operator== ( DBCStorageIterator< T > const &  right) const
inline
46{ /*ASSERT(_index == right._index, "Iterator belongs to a different container")*/ return _pos == right._pos; }

References DBCStorageIterator< T >::_pos.

Member Data Documentation

◆ _end

◆ _index

◆ _pos