aboutsummaryrefslogtreecommitdiff
path: root/Src/omBrowser/ifc_omstorage.h
blob: b7917c2c0895779d119e29b693f263cc41b0afae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef NULLSOFT_WINAMP_OMSTORAGE_INTERFACE_HEADER
#define NULLSOFT_WINAMP_OMSTORAGE_INTERFACE_HEADER

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

// {DEE1FCCD-8FFC-4ed2-8104-323382670BE0}
static const GUID IFC_OmStorage = 
{ 0xdee1fccd, 0x8ffc, 0x4ed2, { 0x81, 0x4, 0x32, 0x33, 0x82, 0x67, 0xb, 0xe0 } };

#include <ifc_omstorageasync.h>
#include <bfc/dispatch.h>

class ifc_omservice;
class ifc_omservicehost;
class ifc_omserviceenum;

#define OMSTORAGE_E_UNKNOWN_FORMAT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, ERROR_INVALID_DATA)

class __declspec(novtable) ifc_omstorage : public Dispatchable
{
public:
	typedef enum 
	{
		capLoad			= 0x00000001,
		capSave			= 0x00000002,
		capDelete		= 0x00000004,
		capReload		= 0x00000008,
		capPublic		= 0x00001000,
	} Capabilities;

	typedef enum
	{
		saveModifiedOnly = 0x00000001,
		saveClearModified = 0x00000002,
	} SaveFlags;

protected:
	ifc_omstorage() {}
	~ifc_omstorage() {}

public:
	HRESULT GetId(GUID *storageUid);
	HRESULT GetType(GUID *storageType);
	UINT GetCapabilities();
	HRESULT GetDescription(wchar_t *buffer, unsigned int bufferMax);
	
	HRESULT Load(const wchar_t *address, ifc_omservicehost *host, ifc_omserviceenum **ppEnum);
	HRESULT Save(ifc_omservice **serviceList, unsigned long listCount, unsigned int saveFlags, unsigned long *savedCount);
	HRESULT Delete(ifc_omservice **serviceList, unsigned long listCount, unsigned long *deletedCount);
	HRESULT Reload(ifc_omservice **serviceList, unsigned long listCount, unsigned long *reloadedCount);

	/* async calls */
	HRESULT BeginLoad(const wchar_t *address, ifc_omservicehost *host, ifc_omstorageasync::AsyncCallback callback, void *data, ifc_omstorageasync **async);
	HRESULT EndLoad(ifc_omstorageasync *async, ifc_omserviceenum **ppEnum);
	HRESULT RequestAbort(ifc_omstorageasync *async, BOOL drop);
	
public:
	DISPATCH_CODES
	{
		API_GETID			= 10,
		API_GETTYPE			= 20,
		API_GETCAPABILITIES = 30,
		API_GETDESCRIPTION  = 40,
		API_LOAD			= 60,
		API_SAVE			= 70,
		API_DELETE			= 80,
		API_RELOAD			= 90,
		API_BEGINLOAD		= 100,
		API_ENDLOAD			= 110,
		API_REQUESTABORT	= 120,
	};
};

inline HRESULT ifc_omstorage::GetId(GUID *storageUid)
{
	return _call(API_GETID, (HRESULT)E_NOTIMPL, storageUid);
}

inline HRESULT ifc_omstorage::GetType(GUID *storageType)
{
	return _call(API_GETTYPE, (HRESULT)E_NOTIMPL, storageType);
}

inline UINT ifc_omstorage::GetCapabilities()
{
	return (UINT)_call(API_GETCAPABILITIES, (UINT)0);
}

inline HRESULT ifc_omstorage::GetDescription(wchar_t *buffer, unsigned int bufferMax)
{
	return _call(API_GETDESCRIPTION, (HRESULT)E_NOTIMPL, buffer, bufferMax);
}

inline HRESULT ifc_omstorage::Load(const wchar_t *address, ifc_omservicehost *host, ifc_omserviceenum **ppEnum)
{
	return _call(API_LOAD, (HRESULT)E_NOTIMPL, address, host, ppEnum);
}

inline HRESULT ifc_omstorage::Save(ifc_omservice **serviceList, unsigned long listCount, unsigned int saveFlags, unsigned long *savedCount)
{
	return _call(API_SAVE, (HRESULT)E_NOTIMPL, serviceList, listCount, saveFlags, savedCount);
}

inline HRESULT ifc_omstorage::Delete(ifc_omservice **serviceList, unsigned long listCount, unsigned long *deletedCount)
{
	return _call(API_DELETE, (HRESULT)E_NOTIMPL, serviceList, listCount, deletedCount);
}

inline HRESULT ifc_omstorage::Reload(ifc_omservice **serviceList, unsigned long listCount, unsigned long *reloadedCount)
{
	return _call(API_RELOAD, (HRESULT)E_NOTIMPL, serviceList, listCount, reloadedCount);
}

inline HRESULT ifc_omstorage::BeginLoad(const wchar_t *address, ifc_omservicehost *host, ifc_omstorageasync::AsyncCallback callback, void *data, ifc_omstorageasync **async)
{
	return _call(API_BEGINLOAD, (HRESULT)E_NOTIMPL, address, host, callback, data, async);
}

inline HRESULT ifc_omstorage::EndLoad(ifc_omstorageasync *async, ifc_omserviceenum **ppEnum)
{
	return _call(API_ENDLOAD, (HRESULT)E_NOTIMPL, async, ppEnum);
}

inline HRESULT ifc_omstorage::RequestAbort(ifc_omstorageasync *async, BOOL drop)
{
	return _call(API_REQUESTABORT, (HRESULT)E_NOTIMPL, async, drop);
}

#endif //NULLSOFT_WINAMP_OMSTORAGE_INTERFACE_HEADER