ifc_omstorage.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef NULLSOFT_WINAMP_OMSTORAGE_INTERFACE_HEADER
  2. #define NULLSOFT_WINAMP_OMSTORAGE_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. // {DEE1FCCD-8FFC-4ed2-8104-323382670BE0}
  7. static const GUID IFC_OmStorage =
  8. { 0xdee1fccd, 0x8ffc, 0x4ed2, { 0x81, 0x4, 0x32, 0x33, 0x82, 0x67, 0xb, 0xe0 } };
  9. #include <ifc_omstorageasync.h>
  10. #include <bfc/dispatch.h>
  11. class ifc_omservice;
  12. class ifc_omservicehost;
  13. class ifc_omserviceenum;
  14. #define OMSTORAGE_E_UNKNOWN_FORMAT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, ERROR_INVALID_DATA)
  15. class __declspec(novtable) ifc_omstorage : public Dispatchable
  16. {
  17. public:
  18. typedef enum
  19. {
  20. capLoad = 0x00000001,
  21. capSave = 0x00000002,
  22. capDelete = 0x00000004,
  23. capReload = 0x00000008,
  24. capPublic = 0x00001000,
  25. } Capabilities;
  26. typedef enum
  27. {
  28. saveModifiedOnly = 0x00000001,
  29. saveClearModified = 0x00000002,
  30. } SaveFlags;
  31. protected:
  32. ifc_omstorage() {}
  33. ~ifc_omstorage() {}
  34. public:
  35. HRESULT GetId(GUID *storageUid);
  36. HRESULT GetType(GUID *storageType);
  37. UINT GetCapabilities();
  38. HRESULT GetDescription(wchar_t *buffer, unsigned int bufferMax);
  39. HRESULT Load(const wchar_t *address, ifc_omservicehost *host, ifc_omserviceenum **ppEnum);
  40. HRESULT Save(ifc_omservice **serviceList, unsigned long listCount, unsigned int saveFlags, unsigned long *savedCount);
  41. HRESULT Delete(ifc_omservice **serviceList, unsigned long listCount, unsigned long *deletedCount);
  42. HRESULT Reload(ifc_omservice **serviceList, unsigned long listCount, unsigned long *reloadedCount);
  43. /* async calls */
  44. HRESULT BeginLoad(const wchar_t *address, ifc_omservicehost *host, ifc_omstorageasync::AsyncCallback callback, void *data, ifc_omstorageasync **async);
  45. HRESULT EndLoad(ifc_omstorageasync *async, ifc_omserviceenum **ppEnum);
  46. HRESULT RequestAbort(ifc_omstorageasync *async, BOOL drop);
  47. public:
  48. DISPATCH_CODES
  49. {
  50. API_GETID = 10,
  51. API_GETTYPE = 20,
  52. API_GETCAPABILITIES = 30,
  53. API_GETDESCRIPTION = 40,
  54. API_LOAD = 60,
  55. API_SAVE = 70,
  56. API_DELETE = 80,
  57. API_RELOAD = 90,
  58. API_BEGINLOAD = 100,
  59. API_ENDLOAD = 110,
  60. API_REQUESTABORT = 120,
  61. };
  62. };
  63. inline HRESULT ifc_omstorage::GetId(GUID *storageUid)
  64. {
  65. return _call(API_GETID, (HRESULT)E_NOTIMPL, storageUid);
  66. }
  67. inline HRESULT ifc_omstorage::GetType(GUID *storageType)
  68. {
  69. return _call(API_GETTYPE, (HRESULT)E_NOTIMPL, storageType);
  70. }
  71. inline UINT ifc_omstorage::GetCapabilities()
  72. {
  73. return (UINT)_call(API_GETCAPABILITIES, (UINT)0);
  74. }
  75. inline HRESULT ifc_omstorage::GetDescription(wchar_t *buffer, unsigned int bufferMax)
  76. {
  77. return _call(API_GETDESCRIPTION, (HRESULT)E_NOTIMPL, buffer, bufferMax);
  78. }
  79. inline HRESULT ifc_omstorage::Load(const wchar_t *address, ifc_omservicehost *host, ifc_omserviceenum **ppEnum)
  80. {
  81. return _call(API_LOAD, (HRESULT)E_NOTIMPL, address, host, ppEnum);
  82. }
  83. inline HRESULT ifc_omstorage::Save(ifc_omservice **serviceList, unsigned long listCount, unsigned int saveFlags, unsigned long *savedCount)
  84. {
  85. return _call(API_SAVE, (HRESULT)E_NOTIMPL, serviceList, listCount, saveFlags, savedCount);
  86. }
  87. inline HRESULT ifc_omstorage::Delete(ifc_omservice **serviceList, unsigned long listCount, unsigned long *deletedCount)
  88. {
  89. return _call(API_DELETE, (HRESULT)E_NOTIMPL, serviceList, listCount, deletedCount);
  90. }
  91. inline HRESULT ifc_omstorage::Reload(ifc_omservice **serviceList, unsigned long listCount, unsigned long *reloadedCount)
  92. {
  93. return _call(API_RELOAD, (HRESULT)E_NOTIMPL, serviceList, listCount, reloadedCount);
  94. }
  95. inline HRESULT ifc_omstorage::BeginLoad(const wchar_t *address, ifc_omservicehost *host, ifc_omstorageasync::AsyncCallback callback, void *data, ifc_omstorageasync **async)
  96. {
  97. return _call(API_BEGINLOAD, (HRESULT)E_NOTIMPL, address, host, callback, data, async);
  98. }
  99. inline HRESULT ifc_omstorage::EndLoad(ifc_omstorageasync *async, ifc_omserviceenum **ppEnum)
  100. {
  101. return _call(API_ENDLOAD, (HRESULT)E_NOTIMPL, async, ppEnum);
  102. }
  103. inline HRESULT ifc_omstorage::RequestAbort(ifc_omstorageasync *async, BOOL drop)
  104. {
  105. return _call(API_REQUESTABORT, (HRESULT)E_NOTIMPL, async, drop);
  106. }
  107. #endif //NULLSOFT_WINAMP_OMSTORAGE_INTERFACE_HEADER