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
34: _index(nullptr) { }
T ** _index
Definition: DBCStorageIterator.h:70

◆ DBCStorageIterator() [2/2]

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

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
48{ return !(*this == right); }

◆ operator*()

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

◆ operator++() [1/2]

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

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

◆ operator++() [2/2]

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

◆ operator->()

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

◆ operator==()

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

References DBCStorageIterator< T >::_pos.

Member Data Documentation

◆ _end

◆ _index

◆ _pos