TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WorldPackets::Array< T, N > Class Template Reference

#include <PacketUtilities.h>

Public Member Functions

 Array ()
 
 Array (size_type limit)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
size_type size () const
 
bool empty () const
 
reference operator[] (size_type i)
 
const_reference operator[] (size_type i) const
 
void resize (size_type newSize)
 
void reserve (size_type newSize)
 
void push_back (value_type const &value)
 
void push_back (value_type &&value)
 

Private Types

typedef std::vector< T > storage_type
 
typedef storage_type::value_type value_type
 
typedef storage_type::size_type size_type
 
typedef storage_type::reference reference
 
typedef
storage_type::const_reference 
const_reference
 
typedef storage_type::iterator iterator
 
typedef
storage_type::const_iterator 
const_iterator
 

Private Attributes

storage_type _storage
 
size_type _limit
 

Detailed Description

template<typename T, std::size_t N = 1000>
class WorldPackets::Array< T, N >

Utility class for automated prevention of loop counter spoofing in client packets

Member Typedef Documentation

template<typename T, std::size_t N = 1000>
typedef storage_type::const_iterator WorldPackets::Array< T, N >::const_iterator
private
template<typename T, std::size_t N = 1000>
typedef storage_type::const_reference WorldPackets::Array< T, N >::const_reference
private
template<typename T, std::size_t N = 1000>
typedef storage_type::iterator WorldPackets::Array< T, N >::iterator
private
template<typename T, std::size_t N = 1000>
typedef storage_type::reference WorldPackets::Array< T, N >::reference
private
template<typename T, std::size_t N = 1000>
typedef storage_type::size_type WorldPackets::Array< T, N >::size_type
private
template<typename T, std::size_t N = 1000>
typedef std::vector<T> WorldPackets::Array< T, N >::storage_type
private
template<typename T, std::size_t N = 1000>
typedef storage_type::value_type WorldPackets::Array< T, N >::value_type
private

Constructor & Destructor Documentation

template<typename T, std::size_t N = 1000>
WorldPackets::Array< T, N >::Array ( )
inline
80 : _limit(N) { }
size_type _limit
Definition: PacketUtilities.h:129
template<typename T, std::size_t N = 1000>
WorldPackets::Array< T, N >::Array ( size_type  limit)
inline
81 : _limit(limit) { }
size_type _limit
Definition: PacketUtilities.h:129

Member Function Documentation

template<typename T, std::size_t N = 1000>
iterator WorldPackets::Array< T, N >::begin ( )
inline
83 { return _storage.begin(); }
storage_type _storage
Definition: PacketUtilities.h:128

+ Here is the caller graph for this function:

template<typename T, std::size_t N = 1000>
const_iterator WorldPackets::Array< T, N >::begin ( ) const
inline
84 { return _storage.begin(); }
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
bool WorldPackets::Array< T, N >::empty ( ) const
inline
90 { return _storage.empty(); }
storage_type _storage
Definition: PacketUtilities.h:128

+ Here is the caller graph for this function:

template<typename T, std::size_t N = 1000>
iterator WorldPackets::Array< T, N >::end ( )
inline
86 { return _storage.end(); }
storage_type _storage
Definition: PacketUtilities.h:128

+ Here is the caller graph for this function:

template<typename T, std::size_t N = 1000>
const_iterator WorldPackets::Array< T, N >::end ( ) const
inline
87 { return _storage.end(); }
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
reference WorldPackets::Array< T, N >::operator[] ( size_type  i)
inline
92 { return _storage[i]; }
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
const_reference WorldPackets::Array< T, N >::operator[] ( size_type  i) const
inline
93 { return _storage[i]; }
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
void WorldPackets::Array< T, N >::push_back ( value_type const value)
inline
112  {
113  if (_storage.size() >= _limit)
114  throw PacketArrayMaxCapacityException(_storage.size() + 1, _limit);
115 
116  _storage.push_back(value);
117  }
size_type _limit
Definition: PacketUtilities.h:129
const FieldDescriptor value
Definition: descriptor.h:1522
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
void WorldPackets::Array< T, N >::push_back ( value_type &&  value)
inline
120  {
121  if (_storage.size() >= _limit)
122  throw PacketArrayMaxCapacityException(_storage.size() + 1, _limit);
123 
124  _storage.push_back(std::forward<value_type>(value));
125  }
size_type _limit
Definition: PacketUtilities.h:129
const FieldDescriptor value
Definition: descriptor.h:1522
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
void WorldPackets::Array< T, N >::reserve ( size_type  newSize)
inline
104  {
105  if (newSize > _limit)
106  throw PacketArrayMaxCapacityException(newSize, _limit);
107 
108  _storage.reserve(newSize);
109  }
size_type _limit
Definition: PacketUtilities.h:129
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
void WorldPackets::Array< T, N >::resize ( size_type  newSize)
inline
96  {
97  if (newSize > _limit)
98  throw PacketArrayMaxCapacityException(newSize, _limit);
99 
100  _storage.resize(newSize);
101  }
size_type _limit
Definition: PacketUtilities.h:129
storage_type _storage
Definition: PacketUtilities.h:128
template<typename T, std::size_t N = 1000>
size_type WorldPackets::Array< T, N >::size ( ) const
inline
89 { return _storage.size(); }
storage_type _storage
Definition: PacketUtilities.h:128

+ Here is the caller graph for this function:

Member Data Documentation

template<typename T, std::size_t N = 1000>
size_type WorldPackets::Array< T, N >::_limit
private
template<typename T, std::size_t N = 1000>
storage_type WorldPackets::Array< T, N >::_storage
private

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