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.

66 lines
1.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: imagemap.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __IMAGEMAP_H
  11. #define __IMAGEMAP_H
  12. #include "ndmgr.h"
  13. class CImageIndexMapKey
  14. {
  15. public:
  16. COMPONENTID m_ID;
  17. int m_nIndex;
  18. CImageIndexMapKey()
  19. {
  20. m_ID = NULL;
  21. m_nIndex = 0;
  22. }
  23. CImageIndexMapKey(COMPONENTID ID, int nIndex)
  24. {
  25. m_ID = ID;
  26. m_nIndex = nIndex;
  27. }
  28. };
  29. typedef CImageIndexMapKey * PImageIndexMapKey;
  30. inline UINT HashKey(PImageIndexMapKey keyPtr)
  31. {
  32. return(((static_cast<UINT>(keyPtr->m_ID) << 16) & 0xFFFF0000)|
  33. (static_cast<UINT>(keyPtr->m_nIndex) & 0x0000FFFF));
  34. }
  35. inline void DestructElements(PImageIndexMapKey *keyArray, int nCount)
  36. {
  37. for(int i=0;i<nCount;i++)
  38. delete keyArray[i];
  39. }
  40. inline BOOL CompareElements(PImageIndexMapKey *p1, PImageIndexMapKey *p2)
  41. {
  42. return(((*p1)->m_ID == (*p2)->m_ID)&&((*p1)->m_nIndex == (*p2)->m_nIndex));
  43. }
  44. #define INITIAL_HASHSIZE 223
  45. class CImageIndexMap : public CMap <PImageIndexMapKey, PImageIndexMapKey, int, int &>
  46. {
  47. public:
  48. CImageIndexMap()
  49. {
  50. InitHashTable(INITIAL_HASHSIZE);
  51. }
  52. };
  53. #undef INITIAL_HASHSIZE
  54. #endif // __IMAGEMAP_H