1
0

cacheRecord.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef NULLSOFT_WINAMP_CACHE_RECORD_HEADER
  2. #define NULLSOFT_WINAMP_CACHE_RECORD_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include "./ifc_omcacherecord.h"
  8. #include <vector>
  9. class CacheGroup;
  10. class CacheDownloader;
  11. class CacheRecord : public ifc_omcacherecord
  12. {
  13. public:
  14. typedef enum
  15. {
  16. flagDownloadFailed = 0x80000000,
  17. } Flags;
  18. protected:
  19. CacheRecord(LPCWSTR pszName, LPCWSTR pszAddress, UINT uFlags);
  20. ~CacheRecord();
  21. public:
  22. static HRESULT CreateInstance(LPCWSTR pszName, LPCWSTR pszAddress, UINT uFlags, CacheRecord **instance);
  23. static INT Compare(CacheRecord *record1, CacheRecord *record2);
  24. public:
  25. /* Dispatchable */
  26. size_t AddRef();
  27. size_t Release();
  28. int QueryInterface(GUID interface_guid, void **object);
  29. HRESULT SetOwner(CacheGroup *group);
  30. HRESULT IsEqual(CacheRecord *record);
  31. HRESULT IsEqualName(LPCWSTR pszName);
  32. INT CompareTo(LPCWSTR pszName);
  33. HRESULT GetName(LPWSTR pszBuffer, UINT cchBufferMax);
  34. HRESULT GetPath(LPWSTR pszBuffer, UINT cchBufferMax);
  35. HRESULT SetPath(LPCWSTR pszPath);
  36. HRESULT GetFlags(UINT *puFlags);
  37. HRESULT SetFlags(UINT uFlags, UINT uMask);
  38. HRESULT Download();
  39. HRESULT RegisterCallback(ifc_omcachecallback *callback);
  40. HRESULT UnregisterCallback(ifc_omcachecallback *callback);
  41. HRESULT DownloadCompleted(LPCWSTR pszFile, INT errorCode);
  42. HRESULT GetBasePath(LPWSTR pszBuffer, UINT cchBufferMax);
  43. protected:
  44. RECVS_DISPATCH;
  45. typedef std::vector<ifc_omcachecallback*> CallbackList;
  46. protected:
  47. size_t ref;
  48. CacheGroup *owner;
  49. LPWSTR name;
  50. LPWSTR path;
  51. UINT flags;
  52. CacheDownloader *downloader;
  53. CallbackList *callbackList;
  54. CRITICAL_SECTION lock;
  55. };
  56. #endif //NULLSOFT_WINAMP_CACHE_RECORD_HEADER