deviceIconStore.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _NULLSOFT_WINAMP_DEVICES_DEVICE_ICON_STORE_HEADER
  2. #define _NULLSOFT_WINAMP_DEVICES_DEVICE_ICON_STORE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "./ifc_deviceiconstore.h"
  7. #include <vector>
  8. class DeviceIconStore : public ifc_deviceiconstore
  9. {
  10. protected:
  11. DeviceIconStore();
  12. ~DeviceIconStore();
  13. public:
  14. static HRESULT CreateInstance(DeviceIconStore **instance);
  15. public:
  16. /* Dispatchable */
  17. size_t AddRef();
  18. size_t Release();
  19. int QueryInterface(GUID interface_guid, void **object);
  20. /* ifc_deviceiconstore */
  21. HRESULT Add(const wchar_t *path, unsigned int width, unsigned int height, BOOL replaceExisting);
  22. HRESULT Remove(unsigned int width, unsigned int height);
  23. HRESULT RemovePath(const wchar_t *path);
  24. HRESULT RemoveAll();
  25. HRESULT Get(wchar_t *buffer, size_t bufferMax, unsigned int width, unsigned int height);
  26. HRESULT GetExact(wchar_t *buffer, size_t bufferMax, unsigned int width, unsigned int height);
  27. HRESULT SetBasePath(const wchar_t *path);
  28. HRESULT GetBasePath(wchar_t *buffer, size_t bufferMax);
  29. HRESULT Clone(ifc_deviceiconstore **instance);
  30. HRESULT Enumerate(EnumeratorCallback callback, void *user);
  31. public:
  32. void Lock();
  33. void Unlock();
  34. HRESULT GetFullPath(wchar_t *buffer, size_t bufferMax, const wchar_t *path);
  35. protected:
  36. typedef struct Record
  37. {
  38. unsigned int width;
  39. unsigned int height;
  40. wchar_t *path;
  41. } Record;
  42. typedef std::vector<Record> RecordList;
  43. protected:
  44. size_t ref;
  45. wchar_t *base;
  46. RecordList list;
  47. CRITICAL_SECTION lock;
  48. protected:
  49. RECVS_DISPATCH;
  50. };
  51. #endif // _NULLSOFT_WINAMP_DEVICES_DEVICE_ICON_STORE_HEADER