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

#include <CascMndx.h>

Public Member Functions

 TBitEntryArray ()
 
 ~TBitEntryArray ()
 
DWORD GetBitEntry (DWORD EntryIndex)
 
void ExchangeWith (TBitEntryArray &Target)
 
int LoadFromStream (TByteStream &InStream)
 
int LoadFromStream_Exchange (TByteStream &InStream)
 
- Public Member Functions inherited from TGenericArray
 TGenericArray ()
 
 ~TGenericArray ()
 
int SetArrayValid ()
 
void ExchangeWith (TGenericArray &Target)
 
void CopyFrom (TGenericArray &Source)
 
void SetMaxItems_CHARS (DWORD NewMaxItemCount)
 
void SetMaxItems_PATH_STOP (DWORD NewMaxItemCount)
 
void InsertOneItem_CHAR (char OneChar)
 
void InsertOneItem_PATH_STOP (PATH_STOP &NewItem)
 
void sub_19583A0 (DWORD NewItemCount)
 
int LoadDwordsArray (TByteStream &InStream)
 
int LoadTripletsArray (TByteStream &InStream)
 
int LoadByteArray (TByteStream &InStream)
 
int LoadFragmentInfos (TByteStream &InStream)
 
int LoadStrings (TByteStream &InStream)
 
int LoadDwordsArray_Copy (TByteStream &InStream)
 
int LoadTripletsArray_Copy (TByteStream &InStream)
 
int LoadBytes_Copy (TByteStream &InStream)
 
int LoadFragmentInfos_Copy (TByteStream &InStream)
 
int LoadStringsWithCopy (TByteStream &InStream)
 

Public Attributes

DWORD BitsPerEntry
 
DWORD EntryBitMask
 
DWORD TotalEntries
 
- Public Attributes inherited from TGenericArray
ARRAY_POINTER DataBuffer
 
ARRAY_POINTER FirstValid
 
ARRAY_POINTER ArrayPointer
 
DWORD ItemCount
 
DWORD MaxItemCount
 
bool bIsValidArray
 

Constructor & Destructor Documentation

TBitEntryArray::TBitEntryArray ( )
831 {
832  BitsPerEntry = 0;
833  EntryBitMask = 0;
834  TotalEntries = 0;
835 }
DWORD BitsPerEntry
Definition: CascMndx.h:167
DWORD TotalEntries
Definition: CascMndx.h:169
DWORD EntryBitMask
Definition: CascMndx.h:168
TBitEntryArray::~TBitEntryArray ( )
838 {}

Member Function Documentation

void TBitEntryArray::ExchangeWith ( TBitEntryArray Target)
842 {
843  TBitEntryArray WorkBuff;
844 
845  WorkBuff = *this;
846  *this = Target;
847  Target = WorkBuff;
848 }
Definition: CascMndx.h:134

+ Here is the caller graph for this function:

DWORD TBitEntryArray::GetBitEntry ( DWORD  EntryIndex)
inline
142  {
143  DWORD dwItemIndex = (EntryIndex * BitsPerEntry) >> 0x05;
144  DWORD dwStartBit = (EntryIndex * BitsPerEntry) & 0x1F;
145  DWORD dwEndBit = dwStartBit + BitsPerEntry;
146  DWORD dwResult;
147 
148  // If the end bit index is greater than 32,
149  // we also need to load from the next 32-bit item
150  if(dwEndBit > 0x20)
151  {
152  dwResult = (Uint32Array[dwItemIndex + 1] << (0x20 - dwStartBit)) | (Uint32Array[dwItemIndex] >> dwStartBit);
153  }
154  else
155  {
156  dwResult = Uint32Array[dwItemIndex] >> dwStartBit;
157  }
158 
159  // Now we also need to mask the result by the bit mask
160  return dwResult & EntryBitMask;
161  }
DWORD BitsPerEntry
Definition: CascMndx.h:167
#define Uint32Array
Definition: CascMndx.h:64
unsigned int DWORD
Definition: CascPort.h:139
DWORD EntryBitMask
Definition: CascMndx.h:168

+ Here is the caller graph for this function:

int TBitEntryArray::LoadFromStream ( TByteStream InStream)
852 {
853  ARRAY_POINTER Pointer;
854  ULONGLONG Value = 0;
855  int nError;
856 
857  nError = LoadDwordsArray_Copy(InStream);
858  if(nError != ERROR_SUCCESS)
859  return nError;
860 
861  nError = InStream.GetBytes(sizeof(DWORD), &Pointer);
862  if(nError != ERROR_SUCCESS)
863  return nError;
864 
865  BitsPerEntry = Pointer.Uint32s[0];
866  if(BitsPerEntry > 0x20)
867  return ERROR_BAD_FORMAT;
868 
869  nError = InStream.GetBytes(sizeof(DWORD), &Pointer);
870  if(nError != ERROR_SUCCESS)
871  return nError;
872  EntryBitMask = Pointer.Uint32s[0];
873 
874  nError = InStream.GetBytes(sizeof(ULONGLONG), &Pointer);
875  if(nError == ERROR_SUCCESS)
876  Value = Pointer.Int64Ptr[0];
877  if(Value > 0xFFFFFFFF)
878  return ERROR_BAD_FORMAT;
879  TotalEntries = (DWORD)Value;
880 
881  assert((BitsPerEntry * TotalEntries) / 32 <= ItemCount);
882  return ERROR_SUCCESS;
883 }
Definition: CascMndx.h:49
unsigned long long ULONGLONG
Definition: CascPort.h:144
DWORD BitsPerEntry
Definition: CascMndx.h:167
int LoadDwordsArray_Copy(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:758
DWORD TotalEntries
Definition: CascMndx.h:169
PULONGLONG Int64Ptr
Definition: CascMndx.h:57
PDWORD Uint32s
Definition: CascMndx.h:53
int GetBytes(DWORD cbByteCount, PARRAY_POINTER PtrArray)
Definition: CascRootFile_Mndx.cpp:347
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
#define ERROR_BAD_FORMAT
Definition: CascPort.h:214
DWORD EntryBitMask
Definition: CascMndx.h:168
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TBitEntryArray::LoadFromStream_Exchange ( TByteStream InStream)
887 {
888  TBitEntryArray TempArray;
889  int nError;
890 
891  nError = TempArray.LoadFromStream(InStream);
892  if(nError != ERROR_SUCCESS)
893  return nError;
894 
895  ExchangeWith(TempArray);
896  return ERROR_SUCCESS;
897 }
int LoadFromStream(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:851
Definition: CascMndx.h:134
void ExchangeWith(TBitEntryArray &Target)
Definition: CascRootFile_Mndx.cpp:841
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

DWORD TBitEntryArray::BitsPerEntry
DWORD TBitEntryArray::EntryBitMask
DWORD TBitEntryArray::TotalEntries

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