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.

55 lines
1.3 KiB

  1. //
  2. // MODULE: RecentUse.h
  3. //
  4. // PURPOSE: To maintain a "session" this can track whether a give value (either
  5. // a cookie value or an IP address) has been "recently" used
  6. //
  7. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  8. //
  9. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  10. //
  11. // AUTHOR: Joe Mabel
  12. //
  13. // ORIGINAL DATE: 11-4-98
  14. //
  15. // NOTES:
  16. //
  17. // Version Date By Comments
  18. //--------------------------------------------------------------------
  19. // V3.0 11/4/98 JM original
  20. //
  21. #if !defined(AFX_RECENTUSE_H__293EE757_7405_11D2_961D_00C04FC22ADD__INCLUDED_)
  22. #define AFX_RECENTUSE_H__293EE757_7405_11D2_961D_00C04FC22ADD__INCLUDED_
  23. #if _MSC_VER >= 1000
  24. #pragma once
  25. #endif // _MSC_VER >= 1000
  26. #pragma warning(disable:4786)
  27. #include <windows.h>
  28. #include <time.h>
  29. #include <map>
  30. using namespace std;
  31. #include "apgtsstr.h"
  32. class CRecentUse
  33. {
  34. private:
  35. typedef map<CString, time_t> TimeMap;
  36. DWORD m_minExpire; // how long a value remains "recent" (in minutes)
  37. TimeMap m_Recent; // for each CString we are tracking, the time
  38. // last used
  39. public:
  40. CRecentUse(DWORD minExpire = 15);
  41. ~CRecentUse();
  42. void Add(CString str);
  43. bool Validate(CString str);
  44. private:
  45. bool Validate(TimeMap::iterator it);
  46. void Flush();
  47. };
  48. #endif // !defined(AFX_RECENTUSE_H__293EE757_7405_11D2_961D_00C04FC22ADD__INCLUDED_)