AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WorldPackets Namespace Reference

Namespaces

namespace  Bank
 
namespace  Character
 
namespace  Chat
 
namespace  Combat
 
namespace  CombatLog
 
namespace  Guild
 
namespace  LFG
 
namespace  Misc
 
namespace  Pet
 
namespace  Strings
 
namespace  Totem
 
namespace  WorldState
 

Classes

class  Array
 
class  ClientPacket
 
class  CompactArray
 
class  IllegalHyperlinkException
 
class  InvalidHyperlinkException
 
class  InvalidStringValueException
 
class  InvalidUtf8ValueException
 
class  Packet
 
class  PacketArrayMaxCapacityException
 
class  ServerPacket
 
class  String
 

Functions

void CheckCompactArrayMaskOverflow (std::size_t index, std::size_t limit)
 
template<typename T >
ByteBufferoperator<< (ByteBuffer &data, CompactArray< T > const &v)
 
template<typename T >
ByteBufferoperator>> (ByteBuffer &data, CompactArray< T > &v)
 

Function Documentation

◆ CheckCompactArrayMaskOverflow()

void WorldPackets::CheckCompactArrayMaskOverflow ( std::size_t  index,
std::size_t  limit 
)
68{
69 ASSERT(index < limit, "Attempted to insert {} values into CompactArray but it can only hold {}", index, limit);
70}
#define ASSERT
Definition: Errors.h:68

References ASSERT.

Referenced by WorldPackets::CompactArray< T >::Insert().

◆ operator<<()

template<typename T >
ByteBuffer & WorldPackets::operator<< ( ByteBuffer data,
CompactArray< T > const &  v 
)
266 {
267 uint32 mask = v.GetMask();
268 data << uint32(mask);
269
270 for (std::size_t i = 0; i < v.GetSize(); ++i)
271 {
272 if (mask & (1 << i))
273 {
274 data << v[i];
275 }
276 }
277
278 return data;
279 }
std::uint32_t uint32
Definition: Define.h:108
uint32 GetMask() const
Definition: PacketUtilities.h:223
std::size_t GetSize() const
Definition: PacketUtilities.h:225

References WorldPackets::CompactArray< T >::GetMask(), and WorldPackets::CompactArray< T >::GetSize().

◆ operator>>()

template<typename T >
ByteBuffer & WorldPackets::operator>> ( ByteBuffer data,
CompactArray< T > &  v 
)
283 {
284 uint32 mask;
285 data >> mask;
286
287 for (std::size_t index = 0; mask != 0; mask >>= 1, ++index)
288 {
289 if ((mask & 1) != 0)
290 {
291 v.Insert(index, data.read<T>());
292 }
293 }
294
295 return data;
296 }
void Insert(std::size_t index, T const &value)
Definition: PacketUtilities.h:227
T read()
Definition: ByteBuffer.h:351

References WorldPackets::CompactArray< T >::Insert(), and ByteBuffer::read().