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.

157 lines
2.8 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 CIndexMgrFilter : public CIndexManager
  60. {
  61. public:
  62. CIndexMgrFilter() : CIndexManager() {}
  63. public:
  64. HRESULT SortFilters(
  65. DWORD SortType,
  66. DWORD dwSortOption
  67. );
  68. };
  69. class CIndexMgrMmFilter : public CIndexManager
  70. {
  71. public:
  72. CIndexMgrMmFilter() : CIndexManager() {}
  73. public:
  74. HRESULT SortMmFilters(
  75. DWORD SortType,
  76. DWORD dwSortOption
  77. );
  78. };
  79. class CIndexMgrMmPolicy : public CIndexManager
  80. {
  81. public:
  82. CIndexMgrMmPolicy() : CIndexManager() {}
  83. public:
  84. HRESULT Sort(
  85. DWORD dwSortType,
  86. DWORD dwSortOption
  87. );
  88. };
  89. class CIndexMgrQmPolicy : public CIndexManager
  90. {
  91. public:
  92. CIndexMgrQmPolicy() : CIndexManager() {}
  93. public:
  94. HRESULT Sort(
  95. DWORD dwSortType,
  96. DWORD dwSortOption
  97. );
  98. };
  99. class CIndexMgrMmSA : public CIndexManager
  100. {
  101. public:
  102. CIndexMgrMmSA() : CIndexManager() {}
  103. public:
  104. HRESULT Sort(
  105. DWORD dwSortType,
  106. DWORD dwSortOption
  107. );
  108. };
  109. class CIndexMgrQmSA : public CIndexManager
  110. {
  111. public:
  112. CIndexMgrQmSA() : CIndexManager() {}
  113. public:
  114. HRESULT Sort(
  115. DWORD dwSortType,
  116. DWORD dwSortOption
  117. );
  118. };
  119. #endif //_HARRAY_H__