Leaked source code of windows server 2003
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.

117 lines
2.3 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. harray.h
  7. Index mgr for IPSecmon
  8. FILE HISTORY:
  9. Nov 29 1999 Ning Sun Created
  10. */
  11. #ifndef _HARRAY_H__
  12. #define _HARRAY_H__
  13. #include "afxmt.h"
  14. extern const DWORD INDEX_TYPE_DEFAULT;
  15. typedef enum _SORT_OPTIONS
  16. {
  17. SORT_DESCENDING = 0x00,
  18. SORT_ASCENDING = 0x01
  19. } SORT_OPTIONS;
  20. typedef CArray<void *, void *> CIndexArray;
  21. typedef int (__cdecl *PCOMPARE_FUNCTION)(const void *elem1, const void *elem2);
  22. class CColumnIndex : public CIndexArray
  23. {
  24. public:
  25. CColumnIndex(DWORD dwIndexType, PCOMPARE_FUNCTION pfnCompare);
  26. public:
  27. HRESULT Sort();
  28. VOID SetSortOption(DWORD dwSortOption) { m_dwSortOption = dwSortOption; }
  29. DWORD GetSortOption() { return m_dwSortOption; }
  30. DWORD GetType() { return m_dwIndexType; }
  31. void* GetIndexedItem(int nIndex);
  32. protected:
  33. DWORD m_dwIndexType;
  34. DWORD m_dwSortOption;
  35. PCOMPARE_FUNCTION m_pfnCompare;
  36. };
  37. typedef CList<CColumnIndex*, CColumnIndex*> CIndexArrayList;
  38. class CIndexManager
  39. {
  40. public:
  41. CIndexManager();
  42. virtual ~CIndexManager();
  43. protected:
  44. CColumnIndex m_DefaultIndex;
  45. CIndexArrayList m_listIndicies;
  46. POSITION m_posCurrentIndex;
  47. public:
  48. void Reset();
  49. int AddItem(void * pItem);
  50. int GetItemCount() { return (int)m_DefaultIndex.GetSize(); }
  51. void * GetItemData(int nIndex);
  52. virtual HRESULT Sort(
  53. DWORD SortType,
  54. DWORD dwSortOption
  55. ) { return hrOK; }
  56. DWORD GetCurrentIndexType();
  57. DWORD GetCurrentSortOption();
  58. };
  59. class CIndexMgrLogData : public CIndexManager
  60. {
  61. public:
  62. CIndexMgrLogData() : CIndexManager() {}
  63. public:
  64. HRESULT SortLogData(
  65. DWORD SortType,
  66. DWORD dwSortOption
  67. );
  68. HRESULT SortApData(
  69. DWORD SortType,
  70. DWORD dwSortOption
  71. );
  72. };
  73. class CIndexMgrFWFilter : public CIndexManager
  74. {
  75. public:
  76. CIndexMgrFWFilter() : CIndexManager() {}
  77. public:
  78. HRESULT SortFWFilters(
  79. DWORD SortType,
  80. DWORD dwSortOption
  81. );
  82. HRESULT ReverseFWFilters(
  83. );
  84. };
  85. #endif //_HARRAY_H__