From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/omBrowser/cacheRecord.h | 73 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Src/omBrowser/cacheRecord.h (limited to 'Src/omBrowser/cacheRecord.h') diff --git a/Src/omBrowser/cacheRecord.h b/Src/omBrowser/cacheRecord.h new file mode 100644 index 00000000..764600ee --- /dev/null +++ b/Src/omBrowser/cacheRecord.h @@ -0,0 +1,73 @@ +#ifndef NULLSOFT_WINAMP_CACHE_RECORD_HEADER +#define NULLSOFT_WINAMP_CACHE_RECORD_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include +#include "./ifc_omcacherecord.h" +#include + +class CacheGroup; +class CacheDownloader; + +class CacheRecord : public ifc_omcacherecord +{ +public: + typedef enum + { + flagDownloadFailed = 0x80000000, + } Flags; + + +protected: + CacheRecord(LPCWSTR pszName, LPCWSTR pszAddress, UINT uFlags); + ~CacheRecord(); + +public: + static HRESULT CreateInstance(LPCWSTR pszName, LPCWSTR pszAddress, UINT uFlags, CacheRecord **instance); + static INT Compare(CacheRecord *record1, CacheRecord *record2); + +public: + /* Dispatchable */ + size_t AddRef(); + size_t Release(); + int QueryInterface(GUID interface_guid, void **object); + + HRESULT SetOwner(CacheGroup *group); + HRESULT IsEqual(CacheRecord *record); + HRESULT IsEqualName(LPCWSTR pszName); + INT CompareTo(LPCWSTR pszName); + + HRESULT GetName(LPWSTR pszBuffer, UINT cchBufferMax); + HRESULT GetPath(LPWSTR pszBuffer, UINT cchBufferMax); + HRESULT SetPath(LPCWSTR pszPath); + HRESULT GetFlags(UINT *puFlags); + HRESULT SetFlags(UINT uFlags, UINT uMask); + + HRESULT Download(); + + HRESULT RegisterCallback(ifc_omcachecallback *callback); + HRESULT UnregisterCallback(ifc_omcachecallback *callback); + + HRESULT DownloadCompleted(LPCWSTR pszFile, INT errorCode); + + HRESULT GetBasePath(LPWSTR pszBuffer, UINT cchBufferMax); + +protected: + RECVS_DISPATCH; + typedef std::vector CallbackList; + +protected: + size_t ref; + CacheGroup *owner; + LPWSTR name; + LPWSTR path; + UINT flags; + CacheDownloader *downloader; + CallbackList *callbackList; + CRITICAL_SECTION lock; +}; + +#endif //NULLSOFT_WINAMP_CACHE_RECORD_HEADER \ No newline at end of file -- cgit