Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: Stack.hxx
  8. //
  9. // History: 25-Mar-1997 pberkman created
  10. //
  11. //--------------------------------------------------------------------------
  12. #ifndef STACK_HXX
  13. #define STACK_HXX
  14. typedef struct StackStruct_
  15. {
  16. DWORD cbData;
  17. void *pvData;
  18. StackStruct_ *psNext;
  19. } StackStruct_;
  20. #define STACK_SORTTYPE_BINARY 0x01
  21. #define STACK_SORTTYPE_PWSZ 0x02
  22. #define STACK_SORTTYPE_PSZ 0x03
  23. #define STACK_SORTTYPE_PWSZ_I 0x04
  24. #define STACK_SORTTYPE_PSZ_I 0x05
  25. class Stack_
  26. {
  27. public:
  28. Stack_(CRITICAL_SECTION *pCriticalSection);
  29. virtual ~Stack_(void);
  30. BOOL Add(DWORD cbData, void *pvData);
  31. void *Add(DWORD cbData);
  32. // position starts @ zero!
  33. void *Get(DWORD dwPosition, DWORD *cbData = NULL);
  34. // this one assumes this->Sort() has been called!
  35. void *Get(DWORD cbStartIn_pvData, DWORD cbLengthIn_pvData, BYTE fbType, void *pvMemberOf_pvData);
  36. DWORD Count(void) { return(dwStackCount); }
  37. void Sort(DWORD cbStartIn_pvData, DWORD cbLengthIn_pvData, BYTE fbTypeIn);
  38. protected:
  39. StackStruct_ *psBottom; // this will point to ppsSorted[0] if sorted.
  40. StackStruct_ **ppsSorted; // this will be null if no sort
  41. StackStruct_ **ppsGet;
  42. private:
  43. DWORD dwStackCount;
  44. CRITICAL_SECTION *pSortCriticalSection;
  45. BOOL InitGetStackIfNecessary ();
  46. VOID FlushGetStack ();
  47. };
  48. #endif // STACK_HXX