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.

66 lines
2.2 KiB

  1. ////////////////////////////////////////////////////////////////////////////
  2. class FAR CMapDwordPtr
  3. {
  4. public:
  5. // Construction
  6. CMapDwordPtr(UINT nBlockSize=10)
  7. : m_mkv(sizeof(void FAR*), sizeof(DWORD), nBlockSize) { }
  8. // Attributes
  9. // number of elements
  10. int GetCount() const
  11. { return m_mkv.GetCount(); }
  12. BOOL IsEmpty() const
  13. { return GetCount() == 0; }
  14. // Lookup
  15. BOOL Lookup(DWORD key, void FAR* FAR& value) const
  16. { return m_mkv.Lookup((LPVOID) &key, sizeof(DWORD), (LPVOID)&value); }
  17. BOOL LookupHKey(HMAPKEY hKey, void FAR* FAR& value) const
  18. { return m_mkv.LookupHKey(hKey, (LPVOID)&value); }
  19. BOOL LookupAdd(DWORD key, void FAR* FAR& value) const
  20. { return m_mkv.LookupAdd((LPVOID)&key, sizeof(DWORD), (LPVOID)&value); }
  21. // Add/Delete
  22. // add a new (key, value) pair
  23. BOOL SetAt(DWORD key, void FAR* value)
  24. { return m_mkv.SetAt((LPVOID) &key, sizeof(DWORD), (LPVOID)&value); }
  25. BOOL SetAtHKey(HMAPKEY hKey, void FAR* value)
  26. { return m_mkv.SetAtHKey(hKey, (LPVOID)&value); }
  27. // removing existing (key, ?) pair
  28. BOOL RemoveKey(DWORD key)
  29. { return m_mkv.RemoveKey((LPVOID) &key, sizeof(DWORD)); }
  30. BOOL RemoveHKey(HMAPKEY hKey)
  31. { return m_mkv.RemoveHKey(hKey); }
  32. void RemoveAll()
  33. { m_mkv.RemoveAll(); }
  34. // iterating all (key, value) pairs
  35. POSITION GetStartPosition() const
  36. { return m_mkv.GetStartPosition(); }
  37. void GetNextAssoc(POSITION FAR& rNextPosition, DWORD FAR& rKey, void FAR* FAR& rValue) const
  38. { m_mkv.GetNextAssoc(&rNextPosition, (LPVOID)&rKey, NULL, (LPVOID)&rValue); }
  39. HMAPKEY GetHKey(DWORD key) const
  40. { return m_mkv.GetHKey((LPVOID)&key, sizeof(DWORD)); }
  41. #ifdef _DEBUG
  42. void AssertValid() const
  43. { m_mkv.AssertValid(); }
  44. #endif
  45. private:
  46. CMapKeyToValue m_mkv;
  47. };