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

#include <CascMndx.h>

Public Member Functions

 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

ARRAY_POINTER DataBuffer
 
ARRAY_POINTER FirstValid
 
ARRAY_POINTER ArrayPointer
 
DWORD ItemCount
 
DWORD MaxItemCount
 
bool bIsValidArray
 

Constructor & Destructor Documentation

TGenericArray::TGenericArray ( )
467 {
471  ItemCount = 0;
472  MaxItemCount = 0;
473  bIsValidArray = false;
474 }
ARRAY_POINTER FirstValid
Definition: CascMndx.h:126
ARRAY_POINTER DataBuffer
Definition: CascMndx.h:125
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
arena_t NULL
Definition: jemalloc_internal.h:624
bool bIsValidArray
Definition: CascMndx.h:131
DWORD ItemCount
Definition: CascMndx.h:129
LPBYTE Bytes
Definition: CascMndx.h:51
DWORD MaxItemCount
Definition: CascMndx.h:130
TGenericArray::~TGenericArray ( )
477 {
478  if(DataBuffer.Bytes != NULL)
480 }
ARRAY_POINTER DataBuffer
Definition: CascMndx.h:125
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_FREE(ptr)
Definition: CascCommon.h:303
LPBYTE Bytes
Definition: CascMndx.h:51

Member Function Documentation

void TGenericArray::CopyFrom ( TGenericArray Source)
494 {
495  if(DataBuffer.Bytes != NULL)
497  *this = Source;
498 }
ARRAY_POINTER DataBuffer
Definition: CascMndx.h:125
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_FREE(ptr)
Definition: CascCommon.h:303
LPBYTE Bytes
Definition: CascMndx.h:51

+ Here is the caller graph for this function:

void TGenericArray::ExchangeWith ( TGenericArray Target)
484 {
485  TGenericArray WorkBuff;
486 
487  WorkBuff = *this;
488  *this = Target;
489  Target = WorkBuff;
490 }
Definition: CascMndx.h:93

+ Here is the caller graph for this function:

void TGenericArray::InsertOneItem_CHAR ( char  OneChar)
564 {
565  DWORD NewMaxItemCount;
566  DWORD NewItemCount;
567 
568  NewItemCount = ItemCount + 1;
569  if(NewItemCount > MaxItemCount)
570  {
571  NewMaxItemCount = NewItemCount;
572 
573  if(MaxItemCount > (NewItemCount / 2))
574  {
575  if(MaxItemCount <= (CASC_MAX_ENTRIES(BYTE) / 2))
576  NewMaxItemCount = MaxItemCount + MaxItemCount;
577  else
578  NewMaxItemCount = CASC_MAX_ENTRIES(BYTE);
579  }
580 
581  SetMaxItems_CHARS(NewMaxItemCount);
582  }
583 
584  // Put the character to the slot that has been reserved
585  FirstValid.Chars[ItemCount++] = NewItem;
586 }
ARRAY_POINTER FirstValid
Definition: CascMndx.h:126
#define CASC_MAX_ENTRIES(type)
Definition: CascMndx.h:19
void SetMaxItems_CHARS(DWORD NewMaxItemCount)
Definition: CascRootFile_Mndx.cpp:515
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
unsigned char BYTE
Definition: CascPort.h:136
char * Chars
Definition: CascMndx.h:52
DWORD MaxItemCount
Definition: CascMndx.h:130

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TGenericArray::InsertOneItem_PATH_STOP ( PATH_STOP NewItem)
590 {
591  DWORD NewMaxItemCount;
592  DWORD NewItemCount;
593 
594  NewItemCount = ItemCount + 1;
595  if(NewItemCount > MaxItemCount)
596  {
597  NewMaxItemCount = NewItemCount;
598 
599  if(MaxItemCount > (NewItemCount / 2))
600  {
602  NewMaxItemCount = MaxItemCount + MaxItemCount;
603  else
604  NewMaxItemCount = CASC_MAX_ENTRIES(PATH_STOP);
605  }
606 
607  SetMaxItems_PATH_STOP(NewMaxItemCount);
608  }
609 
610  // Put the structure to the slot that has been reserved
611  FirstValid.PathStopPtr[ItemCount++] = NewItem;
612 }
ARRAY_POINTER FirstValid
Definition: CascMndx.h:126
#define CASC_MAX_ENTRIES(type)
Definition: CascMndx.h:19
void SetMaxItems_PATH_STOP(DWORD NewMaxItemCount)
Definition: CascRootFile_Mndx.cpp:539
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
PPATH_STOP PathStopPtr
Definition: CascMndx.h:56
Definition: CascMndx.h:40
DWORD MaxItemCount
Definition: CascMndx.h:130

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadByteArray ( TByteStream InStream)
693 {
694  DWORD NumberOfBytes;
695  int nError;
696 
697  // Get and verify the number of items
698  nError = InStream.GetValue_ItemCount(NumberOfBytes, ItemCount, sizeof(BYTE));
699  if(nError != ERROR_SUCCESS)
700  return nError;
701 
702  nError = InStream.GetArray_BYTES(&ArrayPointer, ItemCount);
703  if(nError != ERROR_SUCCESS)
704  return nError;
705 
706  nError = InStream.SkipBytes((0 - (DWORD)NumberOfBytes) & 0x07);
707  if(nError != ERROR_SUCCESS)
708  return nError;
709 
710  return SetArrayValid();
711 }
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
int GetArray_BYTES(PARRAY_POINTER PtrArray, DWORD ItemCount)
Definition: CascRootFile_Mndx.cpp:384
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
int GetValue_ItemCount(DWORD &NumberOfBytes, DWORD &ItemCount, DWORD ItemSize)
Definition: CascRootFile_Mndx.cpp:441
unsigned char BYTE
Definition: CascPort.h:136
int SkipBytes(DWORD cbByteCount)
Definition: CascRootFile_Mndx.cpp:406
int SetArrayValid()
Definition: CascRootFile_Mndx.cpp:504
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadBytes_Copy ( TByteStream InStream)
787 {
788  TGenericArray TempArray;
789  int nError;
790 
791  nError = TempArray.LoadByteArray(InStream);
792  if(nError != ERROR_SUCCESS)
793  return nError;
794 
795  CopyFrom(TempArray);
796  return 0;
797 }
int LoadByteArray(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:692
Definition: CascMndx.h:93
void CopyFrom(TGenericArray &Source)
Definition: CascRootFile_Mndx.cpp:493
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadDwordsArray ( TByteStream InStream)
649 {
650  DWORD NumberOfBytes;
651  int nError;
652 
653  // Get and verify the number of items
654  nError = InStream.GetValue_ItemCount(NumberOfBytes, ItemCount, sizeof(DWORD));
655  if(nError != ERROR_SUCCESS)
656  return nError;
657 
658  nError = InStream.GetArray_DWORDs(&ArrayPointer, ItemCount);
659  if(nError != ERROR_SUCCESS)
660  return nError;
661 
662  nError = InStream.SkipBytes((0 - (DWORD)NumberOfBytes) & 0x07);
663  if(nError != ERROR_SUCCESS)
664  return nError;
665 
666  return SetArrayValid();
667 }
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
int GetArray_DWORDs(PARRAY_POINTER PtrArray, DWORD ItemCount)
Definition: CascRootFile_Mndx.cpp:362
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
int GetValue_ItemCount(DWORD &NumberOfBytes, DWORD &ItemCount, DWORD ItemSize)
Definition: CascRootFile_Mndx.cpp:441
int SkipBytes(DWORD cbByteCount)
Definition: CascRootFile_Mndx.cpp:406
int SetArrayValid()
Definition: CascRootFile_Mndx.cpp:504
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadDwordsArray_Copy ( TByteStream InStream)
759 {
760  TGenericArray TempArray;
761  int nError;
762 
763  nError = TempArray.LoadDwordsArray(InStream);
764  if(nError != ERROR_SUCCESS)
765  return nError;
766 
767  CopyFrom(TempArray);
768  return ERROR_SUCCESS;
769 }
Definition: CascMndx.h:93
void CopyFrom(TGenericArray &Source)
Definition: CascRootFile_Mndx.cpp:493
int LoadDwordsArray(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:648
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadFragmentInfos ( TByteStream InStream)
715 {
716  DWORD NumberOfBytes;
717  int nError;
718 
719  // Get and verify the number of items
720  nError = InStream.GetValue_ItemCount(NumberOfBytes, ItemCount, sizeof(NAME_FRAG));
721  if(nError != ERROR_SUCCESS)
722  return nError;
723 
724  nError = InStream.GetArray_NameTable(&ArrayPointer, ItemCount);
725  if(nError != ERROR_SUCCESS)
726  return nError;
727 
728  nError = InStream.SkipBytes((0 - (DWORD)NumberOfBytes) & 0x07);
729  if(nError != ERROR_SUCCESS)
730  return nError;
731 
732  return SetArrayValid();
733 }
int GetArray_NameTable(PARRAY_POINTER PtrArray, DWORD ItemCount)
Definition: CascRootFile_Mndx.cpp:395
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
Definition: CascMndx.h:32
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
int GetValue_ItemCount(DWORD &NumberOfBytes, DWORD &ItemCount, DWORD ItemSize)
Definition: CascRootFile_Mndx.cpp:441
int SkipBytes(DWORD cbByteCount)
Definition: CascRootFile_Mndx.cpp:406
int SetArrayValid()
Definition: CascRootFile_Mndx.cpp:504
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadFragmentInfos_Copy ( TByteStream InStream)
801 {
802  TGenericArray TempArray;
803  int nError;
804 
805  nError = TempArray.LoadFragmentInfos(InStream);
806  if(nError != ERROR_SUCCESS)
807  return nError;
808 
809  CopyFrom(TempArray);
810  return ERROR_SUCCESS;
811 }
int LoadFragmentInfos(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:714
Definition: CascMndx.h:93
void CopyFrom(TGenericArray &Source)
Definition: CascRootFile_Mndx.cpp:493
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadStrings ( TByteStream InStream)
737 {
738  DWORD NumberOfBytes;
739  int nError;
740 
741  // Get and verify the number of items
742  nError = InStream.GetValue_ItemCount(NumberOfBytes, ItemCount, sizeof(char));
743  if(nError != ERROR_SUCCESS)
744  return nError;
745 
746  nError = InStream.GetArray_BYTES(&ArrayPointer, ItemCount);
747  if(nError != ERROR_SUCCESS)
748  return nError;
749 
750  nError = InStream.SkipBytes((0 - (DWORD)NumberOfBytes) & 0x07);
751  if(nError != ERROR_SUCCESS)
752  return nError;
753 
754  return SetArrayValid();
755 }
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
int GetArray_BYTES(PARRAY_POINTER PtrArray, DWORD ItemCount)
Definition: CascRootFile_Mndx.cpp:384
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
int GetValue_ItemCount(DWORD &NumberOfBytes, DWORD &ItemCount, DWORD ItemSize)
Definition: CascRootFile_Mndx.cpp:441
int SkipBytes(DWORD cbByteCount)
Definition: CascRootFile_Mndx.cpp:406
int SetArrayValid()
Definition: CascRootFile_Mndx.cpp:504
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadStringsWithCopy ( TByteStream InStream)
815 {
816  TGenericArray TempArray;
817  int nError;
818 
819  nError = TempArray.LoadStrings(InStream);
820  if(nError != ERROR_SUCCESS)
821  return nError;
822 
823  CopyFrom(TempArray);
824  return ERROR_SUCCESS;
825 }
Definition: CascMndx.h:93
void CopyFrom(TGenericArray &Source)
Definition: CascRootFile_Mndx.cpp:493
int LoadStrings(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:736
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadTripletsArray ( TByteStream InStream)
671 {
672  DWORD NumberOfBytes;
673  int nError;
674 
675  // Get and verify the number of items
676  nError = InStream.GetValue_ItemCount(NumberOfBytes, ItemCount, sizeof(TRIPLET));
677  if(nError != ERROR_SUCCESS)
678  return nError;
679 
680  nError = InStream.GetArray_Triplets(&ArrayPointer, ItemCount);
681  if(nError != ERROR_SUCCESS)
682  return nError;
683 
684  nError = InStream.SkipBytes((0 - (DWORD)NumberOfBytes) & 0x07);
685  if(nError != ERROR_SUCCESS)
686  return nError;
687 
688  return SetArrayValid();
689 }
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
Definition: CascMndx.h:25
int GetValue_ItemCount(DWORD &NumberOfBytes, DWORD &ItemCount, DWORD ItemSize)
Definition: CascRootFile_Mndx.cpp:441
int SkipBytes(DWORD cbByteCount)
Definition: CascRootFile_Mndx.cpp:406
int GetArray_Triplets(PARRAY_POINTER PtrArray, DWORD ItemCount)
Definition: CascRootFile_Mndx.cpp:373
int SetArrayValid()
Definition: CascRootFile_Mndx.cpp:504
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::LoadTripletsArray_Copy ( TByteStream InStream)
773 {
774  TGenericArray TempArray;
775  int nError;
776 
777  nError = TempArray.LoadTripletsArray(InStream);
778  if(nError != ERROR_SUCCESS)
779  return nError;
780 
781  CopyFrom(TempArray);
782  return ERROR_SUCCESS;
783 }
Definition: CascMndx.h:93
int LoadTripletsArray(TByteStream &InStream)
Definition: CascRootFile_Mndx.cpp:670
void CopyFrom(TGenericArray &Source)
Definition: CascRootFile_Mndx.cpp:493
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int TGenericArray::SetArrayValid ( )
505 {
506  if(bIsValidArray != 0)
507  return 1;
508 
509  bIsValidArray = true;
510  return ERROR_SUCCESS;
511 }
bool bIsValidArray
Definition: CascMndx.h:131
#define ERROR_SUCCESS
Definition: CascPort.h:204

+ Here is the caller graph for this function:

void TGenericArray::SetMaxItems_CHARS ( DWORD  NewMaxItemCount)
516 {
517  ARRAY_POINTER OldDataBuffer = DataBuffer;
518  ARRAY_POINTER NewDataBuffer;
519 
520  // Allocate new data buffer
521  NewDataBuffer.Chars = CASC_ALLOC(char, NewMaxItemCount);
522  if(NewDataBuffer.Chars != NULL)
523  {
524  // Copy the old items to the buffer
525  for(DWORD i = 0; i < ItemCount; i++)
526  {
527  NewDataBuffer.Chars[i] = FirstValid.Chars[i];
528  }
529  }
530 
531  DataBuffer = NewDataBuffer;
532  FirstValid = NewDataBuffer;
533  ArrayPointer = NewDataBuffer;
534  MaxItemCount = NewMaxItemCount;
535  CASC_FREE(OldDataBuffer.Chars);
536 }
Definition: CascMndx.h:49
#define CASC_ALLOC(type, count)
Definition: CascCommon.h:302
ARRAY_POINTER FirstValid
Definition: CascMndx.h:126
ARRAY_POINTER DataBuffer
Definition: CascMndx.h:125
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_FREE(ptr)
Definition: CascCommon.h:303
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
char * Chars
Definition: CascMndx.h:52
DWORD MaxItemCount
Definition: CascMndx.h:130

+ Here is the caller graph for this function:

void TGenericArray::SetMaxItems_PATH_STOP ( DWORD  NewMaxItemCount)
540 {
541  ARRAY_POINTER OldDataBuffer = DataBuffer;
542  ARRAY_POINTER NewDataBuffer;
543 
544  // Allocate new data buffer
545  NewDataBuffer.PathStopPtr = CASC_ALLOC(PATH_STOP, NewMaxItemCount);
546  if(NewDataBuffer.PathStopPtr != NULL)
547  {
548  // Copy the old items to the buffer
549  for(DWORD i = 0; i < ItemCount; i++)
550  {
551  NewDataBuffer.PathStopPtr[i] = FirstValid.PathStopPtr[i];
552  }
553  }
554 
555  DataBuffer = NewDataBuffer;
556  FirstValid = NewDataBuffer;
557  ArrayPointer = NewDataBuffer;
558  MaxItemCount = NewMaxItemCount;
559  CASC_FREE(OldDataBuffer.PathStopPtr);
560 }
Definition: CascMndx.h:49
#define CASC_ALLOC(type, count)
Definition: CascCommon.h:302
ARRAY_POINTER FirstValid
Definition: CascMndx.h:126
ARRAY_POINTER DataBuffer
Definition: CascMndx.h:125
ARRAY_POINTER ArrayPointer
Definition: CascMndx.h:128
arena_t NULL
Definition: jemalloc_internal.h:624
#define CASC_FREE(ptr)
Definition: CascCommon.h:303
DWORD ItemCount
Definition: CascMndx.h:129
unsigned int DWORD
Definition: CascPort.h:139
PPATH_STOP PathStopPtr
Definition: CascMndx.h:56
Definition: CascMndx.h:40
DWORD MaxItemCount
Definition: CascMndx.h:130

+ Here is the caller graph for this function:

void TGenericArray::sub_19583A0 ( DWORD  NewItemCount)
616 {
617  DWORD OldMaxItemCount = MaxItemCount;
618 
619  if(NewItemCount > MaxItemCount)
620  {
621  DWORD NewMaxItemCount = NewItemCount;
622 
623  if(MaxItemCount > (NewItemCount / 2))
624  {
626  NewMaxItemCount = MaxItemCount + MaxItemCount;
627  else
628  NewMaxItemCount = CASC_MAX_ENTRIES(PATH_STOP);
629  }
630 
631  SetMaxItems_PATH_STOP(NewMaxItemCount);
632  }
633 
634  // Initialize the newly inserted items
635  for(DWORD i = OldMaxItemCount; i < NewItemCount; i++)
636  {
640  FirstValid.PathStopPtr[i].field_C = 0xFFFFFFFF;
641  FirstValid.PathStopPtr[i].field_10 = 0xFFFFFFFF;
642  }
643 
644  ItemCount = NewItemCount;
645 }
DWORD field_8
Definition: CascMndx.h:44
ARRAY_POINTER FirstValid
Definition: CascMndx.h:126
DWORD field_C
Definition: CascMndx.h:45
#define CASC_MAX_ENTRIES(type)
Definition: CascMndx.h:19
DWORD field_10
Definition: CascMndx.h:46
void SetMaxItems_PATH_STOP(DWORD NewMaxItemCount)
Definition: CascRootFile_Mndx.cpp:539
DWORD ItemCount
Definition: CascMndx.h:129
DWORD field_4
Definition: CascMndx.h:43
unsigned int DWORD
Definition: CascPort.h:139
PPATH_STOP PathStopPtr
Definition: CascMndx.h:56
Definition: CascMndx.h:40
DWORD ItemIndex
Definition: CascMndx.h:42
DWORD MaxItemCount
Definition: CascMndx.h:130

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

ARRAY_POINTER TGenericArray::ArrayPointer
bool TGenericArray::bIsValidArray
ARRAY_POINTER TGenericArray::DataBuffer
ARRAY_POINTER TGenericArray::FirstValid
DWORD TGenericArray::ItemCount
DWORD TGenericArray::MaxItemCount

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