1
0

flagTracker.h 719 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef NULLSOFT_WINAMP_FLAG_TRACKER_HEADER
  2. #define NULLSOFT_WINAMP_FLAG_TRACKER_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. class FlagTracker
  8. {
  9. public:
  10. typedef void (CALLBACK *EventHandler)(UINT /*nMarked*/, FlagTracker* /*instance*/, ULONG_PTR /*user*/);
  11. public:
  12. FlagTracker();
  13. ~FlagTracker();
  14. public:
  15. void Set(UINT nFlags, UINT nMask);
  16. UINT Get();
  17. void Mark(UINT nFlags);
  18. ULONG BeginUpdate();
  19. ULONG EndUpdate();
  20. void SetEventHandler(EventHandler handler, ULONG_PTR user);
  21. protected:
  22. UINT flags;
  23. UINT cache;
  24. ULONG updateRef;
  25. CRITICAL_SECTION lock;
  26. EventHandler eventHandler;
  27. ULONG_PTR eventParam;
  28. };
  29. #endif //NULLSOFT_WINAMP_MODIFY_TRACKER_HEADER