TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ObjectGuid.cpp File Reference
#include "ObjectGuid.h"
#include "World.h"
#include <sstream>
#include <iomanip>
+ Include dependency graph for ObjectGuid.cpp:

Macros

#define SET_GUID_NAME(type)   Values[uint32(HighGuid::type)] = #type;
 
#define GUID_TRAIT_INSTANTIATE_GUID(HIGH_GUID)   template class TC_GAME_API ObjectGuidGenerator< HIGH_GUID >;
 

Functions

ByteBufferoperator<< (ByteBuffer &buf, ObjectGuid const &guid)
 
ByteBufferoperator>> (ByteBuffer &buf, ObjectGuid &guid)
 
ByteBufferoperator<< (ByteBuffer &buf, PackedGuid const &guid)
 
std::ostream & operator<< (std::ostream &stream, ObjectGuid const &guid)
 

Macro Definition Documentation

#define GUID_TRAIT_INSTANTIATE_GUID (   HIGH_GUID)    template class TC_GAME_API ObjectGuidGenerator< HIGH_GUID >;
#define SET_GUID_NAME (   type)    Values[uint32(HighGuid::type)] = #type;

Function Documentation

ByteBuffer& operator<< ( ByteBuffer buf,
ObjectGuid const guid 
)
147 {
148  uint8 lowMask = 0;
149  uint8 highMask = 0;
150  buf.FlushBits(); // flush any unwritten bits to make wpos return a meaningful value
151  std::size_t pos = buf.wpos();
152  buf << uint8(lowMask);
153  buf << uint8(highMask);
154 
155  uint8 packed[8];
156  if (size_t packedSize = ByteBuffer::PackUInt64(guid._low, &lowMask, packed))
157  buf.append(packed, packedSize);
158  if (size_t packedSize = ByteBuffer::PackUInt64(guid._high, &highMask, packed))
159  buf.append(packed, packedSize);
160 
161  buf.put(pos, lowMask);
162  buf.put(pos + 1, highMask);
163 
164  return buf;
165 }
void FlushBits()
Definition: ByteBuffer.h:150
size_t wpos() const
Definition: ByteBuffer.h:454
static size_t PackUInt64(uint64 value, uint8 *mask, uint8 *result)
Definition: ByteBuffer.h:660
void put(size_t pos, T value)
Definition: ByteBuffer.h:227
void append(T value)
Definition: ByteBuffer.h:143
uint8_t uint8
Definition: g3dmath.h:164
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

ByteBuffer& operator<< ( ByteBuffer buf,
PackedGuid const guid 
)
177 {
178  buf.append(guid._packedGuid);
179  return buf;
180 }
void append(T value)
Definition: ByteBuffer.h:143

+ Here is the call graph for this function:

std::ostream& operator<< ( std::ostream &  stream,
ObjectGuid const guid 
)
183 {
184  std::ostringstream tmp;
185  tmp << std::hex << std::setw(16) << std::setfill('0') << guid._high << std::setw(16) << std::setfill('0') << guid._low;
186  stream << tmp.str();
187  return stream;
188 }
IntFormatSpec< int, TypeSpec<'x'> > hex(int value)

+ Here is the call graph for this function:

ByteBuffer& operator>> ( ByteBuffer buf,
ObjectGuid guid 
)
168 {
169  uint8 lowMask, highMask;
170  buf >> lowMask >> highMask;
171  buf.ReadPackedUInt64(lowMask, guid._low);
172  buf.ReadPackedUInt64(highMask, guid._high);
173  return buf;
174 }
void ReadPackedUInt64(uint64 &guid)
Definition: ByteBuffer.h:511
uint64 _low
Definition: ObjectGuid.h:325
uint8_t uint8
Definition: Define.h:152
uint64 _high
Definition: ObjectGuid.h:326

+ Here is the call graph for this function: