TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TByteStream Class Reference

#include <CascMndx.h>

Public Member Functions

 TByteStream ()
 
void ExchangeWith (TByteStream &Target)
 
int GetBytes (DWORD cbByteCount, PARRAY_POINTER PtrArray)
 
int SkipBytes (DWORD cbByteCount)
 
int SetByteBuffer (LPBYTE pbNewMarData, DWORD cbNewMarData)
 
int GetValue_DWORD (DWORD &Value)
 
int GetValue_ItemCount (DWORD &NumberOfBytes, DWORD &ItemCount, DWORD ItemSize)
 
int GetArray_DWORDs (PARRAY_POINTER PtrArray, DWORD ItemCount)
 
int GetArray_Triplets (PARRAY_POINTER PtrArray, DWORD ItemCount)
 
int GetArray_NameTable (PARRAY_POINTER PtrArray, DWORD ItemCount)
 
int GetArray_BYTES (PARRAY_POINTER PtrArray, DWORD ItemCount)
 

Public Attributes

LPBYTE pbByteData
 
void * pvMappedFile
 
DWORD cbByteData
 
DWORD field_C
 
HANDLE hFile
 
HANDLE hMap
 

Constructor & Destructor Documentation

TByteStream::TByteStream ( )
327 {
328  pbByteData = NULL;
329  pvMappedFile = NULL;
330  cbByteData = 0;
331  field_C = 0;
332  hFile = 0;
333  hMap = 0;
334 }
arena_t NULL
Definition: jemalloc_internal.h:624
DWORD field_C
Definition: CascMndx.h:88
void * pvMappedFile
Definition: CascMndx.h:86
HANDLE hMap
Definition: CascMndx.h:90
DWORD cbByteData
Definition: CascMndx.h:87
LPBYTE pbByteData
Definition: CascMndx.h:85
HANDLE hFile
Definition: CascMndx.h:89

Member Function Documentation

void TByteStream::ExchangeWith ( TByteStream Target)
338 {
339  TByteStream WorkBuff;
340 
341  WorkBuff = *this;
342  *this = Target;
343  Target = WorkBuff;
344 }
Definition: CascMndx.h:68

+ Here is the caller graph for this function:

int TByteStream::GetArray_BYTES ( PARRAY_POINTER  PtrArray,
DWORD  ItemCount 
)
385 {
386  if(PtrArray == NULL && ItemCount != 0)
388  if(ItemCount > CASC_MAX_ENTRIES(BYTE))
390 
391  return GetBytes(ItemCount, PtrArray);
392 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_MAX_ENTRIES(type)
Definition: CascMndx.h:19
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
#define ERROR_INVALID_PARAMETER
Definition: CascPort.h:210
unsigned char BYTE
Definition: CascPort.h:136

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TByteStream::GetArray_DWORDs ( PARRAY_POINTER  PtrArray,
DWORD  ItemCount 
)
363 {
364  if(PtrArray == NULL && ItemCount != 0)
366  if(ItemCount > CASC_MAX_ENTRIES(DWORD))
368 
369  return GetBytes(ItemCount * 4, PtrArray);
370 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_MAX_ENTRIES(type)
Definition: CascMndx.h:19
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
unsigned int DWORD
Definition: CascPort.h:139
#define ERROR_INVALID_PARAMETER
Definition: CascPort.h:210

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TByteStream::GetArray_NameTable ( PARRAY_POINTER  PtrArray,
DWORD  ItemCount 
)
396 {
397  if(PtrArray == NULL && ItemCount != 0)
399  if(ItemCount > CASC_MAX_ENTRIES(NAME_FRAG))
401 
402  return GetBytes(ItemCount * sizeof(NAME_FRAG), PtrArray);
403 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_MAX_ENTRIES(type)
Definition: CascMndx.h:19
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
Definition: CascMndx.h:32
#define ERROR_INVALID_PARAMETER
Definition: CascPort.h:210

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TByteStream::GetArray_Triplets ( PARRAY_POINTER  PtrArray,
DWORD  ItemCount 
)
374 {
375  if(PtrArray == NULL && ItemCount != 0)
377  if(ItemCount > CASC_MAX_ENTRIES(TRIPLET))
379 
380  return GetBytes(ItemCount * sizeof(TRIPLET), PtrArray);
381 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_MAX_ENTRIES(type)
Definition: CascMndx.h:19
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
Definition: CascMndx.h:25
#define ERROR_INVALID_PARAMETER
Definition: CascPort.h:210

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TByteStream::GetBytes ( DWORD  cbByteCount,
PARRAY_POINTER  PtrArray 
)
348 {
349  if(cbByteData < cbByteCount)
350  return ERROR_BAD_FORMAT;
351 
352  // Give the buffer to the caller
353  PtrArray->Bytes = pbByteData;
354 
355  // Move pointers
356  pbByteData += cbByteCount;
357  cbByteData -= cbByteCount;
358  return ERROR_SUCCESS;
359 }
LPBYTE Bytes
Definition: CascMndx.h:51
DWORD cbByteData
Definition: CascMndx.h:87
#define ERROR_BAD_FORMAT
Definition: CascPort.h:214
LPBYTE pbByteData
Definition: CascMndx.h:85
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the caller graph for this function:

int TByteStream::GetValue_DWORD ( DWORD Value)
429 {
430  ARRAY_POINTER Pointer;
431  int nError;
432 
433  nError = GetBytes(sizeof(DWORD), &Pointer);
434  if(nError != ERROR_SUCCESS)
435  return nError;
436 
437  Value = Pointer.Uint32s[0];
438  return ERROR_SUCCESS;
439 }
Definition: CascMndx.h:49
PDWORD Uint32s
Definition: CascMndx.h:53
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
unsigned int DWORD
Definition: CascPort.h:139
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TByteStream::GetValue_ItemCount ( DWORD NumberOfBytes,
DWORD ItemCount,
DWORD  ItemSize 
)
442 {
443  ARRAY_POINTER Pointer;
444  ULONGLONG ByteCount;
445  int nError;
446 
447  // Verify if there is at least - 8 bytes
448  nError = GetBytes(sizeof(ULONGLONG), &Pointer);
449  if(nError != ERROR_SUCCESS)
450  return nError;
451 
452  // Extract the number of bytes
453  ByteCount = Pointer.Int64Ptr[0];
454  if(ByteCount > 0xFFFFFFFF || (ByteCount % ItemSize) != 0)
455  return ERROR_BAD_FORMAT;
456 
457  // Give the result to the caller
458  NumberOfBytes = (DWORD)ByteCount;
459  ItemCount = (DWORD)(ByteCount / ItemSize);
460  return ERROR_SUCCESS;
461 }
Definition: CascMndx.h:49
unsigned long long ULONGLONG
Definition: CascPort.h:144
PULONGLONG Int64Ptr
Definition: CascMndx.h:57
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
unsigned int DWORD
Definition: CascPort.h:139
#define ERROR_BAD_FORMAT
Definition: CascPort.h:214
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TByteStream::SetByteBuffer ( LPBYTE  pbNewMarData,
DWORD  cbNewMarData 
)
415 {
416  if(pbNewByteData != NULL || cbNewByteData == 0)
417  {
418  pbByteData = pbNewByteData;
419  cbByteData = cbNewByteData;
420  return ERROR_SUCCESS;
421  }
422 
424 }
arena_t NULL
Definition: jemalloc_internal.h:624
DWORD cbByteData
Definition: CascMndx.h:87
#define ERROR_INVALID_PARAMETER
Definition: CascPort.h:210
LPBYTE pbByteData
Definition: CascMndx.h:85
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the caller graph for this function:

int TByteStream::SkipBytes ( DWORD  cbByteCount)
407 {
408  ARRAY_POINTER Dummy;
409 
410  return GetBytes(cbByteCount, &Dummy);
411 }
Definition: CascMndx.h:49
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

DWORD TByteStream::cbByteData
DWORD TByteStream::field_C
HANDLE TByteStream::hFile
HANDLE TByteStream::hMap
LPBYTE TByteStream::pbByteData
void* TByteStream::pvMappedFile

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