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.

78 lines
1.8 KiB

  1. #include "shellprv.h"
  2. #pragma hdrstop
  3. #define EXPIRATION_NEVER 0xFFFFFFFF
  4. class CSubDataProvider;
  5. typedef BOOL (CSubDataProvider::*SUBDATACB)(PVOID pvData);
  6. typedef BOOL (*STATICSUBDATACB)(PVOID pvData);
  7. class CSubData
  8. {
  9. ///////////////////////////////////////////////////////////////////////////////
  10. // Public methods
  11. ///////////////////////////////////////////////////////////////////////////////
  12. public:
  13. // Only one of the following two fcts should be called
  14. BOOL Init(CSubDataProvider* pSDProv, SUBDATACB fctCB, PVOID pvData);
  15. BOOL InitStatic(STATICSUBDATACB fctStaticCB, PVOID pvData);
  16. BOOL InitExpiration(DWORD cTick);
  17. virtual BOOL Update();
  18. virtual void Invalidate();
  19. void HoldUpdates();
  20. void ResumeUpdates();
  21. CSubData();
  22. ///////////////////////////////////////////////////////////////////////////////
  23. // Miscellaneous helpers
  24. ///////////////////////////////////////////////////////////////////////////////
  25. private:
  26. BOOL _Call();
  27. protected:
  28. void _SetTickLastUpdate(DWORD dwTick);
  29. DWORD _GetTickLastUpdate();
  30. DWORD* _GetTickLastUpdatePtr();
  31. PVOID _GetDataPtr();
  32. void _SetDataPtr(PVOID pvData);
  33. BOOL _IsExpired();
  34. BOOL _IsValid();
  35. ///////////////////////////////////////////////////////////////////////////////
  36. // Data
  37. ///////////////////////////////////////////////////////////////////////////////
  38. protected:
  39. CSubDataProvider* _pSDProv;
  40. union
  41. {
  42. SUBDATACB _fctCB;
  43. STATICSUBDATACB _fctStaticCB;
  44. };
  45. DWORD _dwTickLast;
  46. PVOID _pvData;
  47. DWORD _cTickExpiration;
  48. BOOL _fHoldUpdate;
  49. BOOL _fStatic;
  50. BOOL _fInvalid;
  51. private:
  52. #ifdef DEBUG
  53. BOOL _fInited;
  54. #endif
  55. };
  56. class CSubDataProvider
  57. {
  58. };