TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ByteBuffer.h File Reference
#include "Define.h"
#include "Errors.h"
#include "ByteConverter.h"
#include "Util.h"
#include <exception>
#include <list>
#include <map>
#include <string>
#include <vector>
#include <cstring>
#include <time.h>
#include <cmath>
#include <type_traits>
+ Include dependency graph for ByteBuffer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ByteBufferException
 
class  ByteBufferPositionException
 
class  ByteBufferSourceException
 
class  ByteBuffer
 

Functions

template<typename T >
ByteBufferoperator<< (ByteBuffer &b, std::vector< T > v)
 
template<typename T >
ByteBufferoperator>> (ByteBuffer &b, std::vector< T > &v)
 
template<typename T >
ByteBufferoperator<< (ByteBuffer &b, std::list< T > v)
 
template<typename T >
ByteBufferoperator>> (ByteBuffer &b, std::list< T > &v)
 
template<typename K , typename V >
ByteBufferoperator<< (ByteBuffer &b, std::map< K, V > &m)
 
template<typename K , typename V >
ByteBufferoperator>> (ByteBuffer &b, std::map< K, V > &m)
 
template<>
std::string ByteBuffer::read< std::string > ()
 
template<>
void ByteBuffer::read_skip< std::string > ()
 

Function Documentation

template<>
std::string ByteBuffer::read< std::string > ( )
inline
Todo:
Make a ByteBuffer.cpp and move all this inlining to it.
791 {
792  std::string tmp;
793  *this >> tmp;
794  return tmp;
795 }
template<>
void ByteBuffer::read_skip< std::string > ( )
inline
812 {
813  read_skip<char*>();
814 }
template<typename T >
ByteBuffer& operator<< ( ByteBuffer b,
std::vector< T >  v 
)
inline
712 {
713  b << (uint32)v.size();
714  for (typename std::vector<T>::iterator i = v.begin(); i != v.end(); ++i)
715  {
716  b << *i;
717  }
718  return b;
719 }
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

template<typename T >
ByteBuffer& operator<< ( ByteBuffer b,
std::list< T >  v 
)
inline
738 {
739  b << (uint32)v.size();
740  for (typename std::list<T>::iterator i = v.begin(); i != v.end(); ++i)
741  {
742  b << *i;
743  }
744  return b;
745 }
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

template<typename K , typename V >
ByteBuffer& operator<< ( ByteBuffer b,
std::map< K, V > &  m 
)
inline
764 {
765  b << (uint32)m.size();
766  for (typename std::map<K, V>::iterator i = m.begin(); i != m.end(); ++i)
767  {
768  b << i->first << i->second;
769  }
770  return b;
771 }
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

template<typename T >
ByteBuffer& operator>> ( ByteBuffer b,
std::vector< T > &  v 
)
inline
723 {
724  uint32 vsize;
725  b >> vsize;
726  v.clear();
727  while (vsize--)
728  {
729  T t;
730  b >> t;
731  v.push_back(t);
732  }
733  return b;
734 }
uint32_t uint32
Definition: Define.h:150
template<typename T >
ByteBuffer& operator>> ( ByteBuffer b,
std::list< T > &  v 
)
inline
749 {
750  uint32 vsize;
751  b >> vsize;
752  v.clear();
753  while (vsize--)
754  {
755  T t;
756  b >> t;
757  v.push_back(t);
758  }
759  return b;
760 }
uint32_t uint32
Definition: Define.h:150
template<typename K , typename V >
ByteBuffer& operator>> ( ByteBuffer b,
std::map< K, V > &  m 
)
inline
775 {
776  uint32 msize;
777  b >> msize;
778  m.clear();
779  while (msize--)
780  {
781  K k;
782  V v;
783  b >> k >> v;
784  m.insert(make_pair(k, v));
785  }
786  return b;
787 }
uint32_t uint32
Definition: Define.h:150