opcservices: Implement IOpcPart::GetRelationshipSet().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-09-04 08:04:56 +03:00 committed by Alexandre Julliard
parent 42792e2fad
commit e062281259
2 changed files with 25 additions and 2 deletions

View File

@ -46,6 +46,7 @@ struct opc_part
IOpcPartUri *name; IOpcPartUri *name;
WCHAR *content_type; WCHAR *content_type;
DWORD compression_options; DWORD compression_options;
IOpcRelationshipSet *relationship_set;
}; };
struct opc_part_set struct opc_part_set
@ -91,6 +92,8 @@ static inline struct opc_relationship *impl_from_IOpcRelationship(IOpcRelationsh
return CONTAINING_RECORD(iface, struct opc_relationship, IOpcRelationship_iface); return CONTAINING_RECORD(iface, struct opc_relationship, IOpcRelationship_iface);
} }
static HRESULT opc_relationship_set_create(IOpcRelationshipSet **relationship_set);
static WCHAR *opc_strdupW(const WCHAR *str) static WCHAR *opc_strdupW(const WCHAR *str)
{ {
WCHAR *ret = NULL; WCHAR *ret = NULL;
@ -143,6 +146,8 @@ static ULONG WINAPI opc_part_Release(IOpcPart *iface)
if (!refcount) if (!refcount)
{ {
if (part->relationship_set)
IOpcRelationshipSet_Release(part->relationship_set);
IOpcPartUri_Release(part->name); IOpcPartUri_Release(part->name);
CoTaskMemFree(part->content_type); CoTaskMemFree(part->content_type);
heap_free(part); heap_free(part);
@ -153,9 +158,18 @@ static ULONG WINAPI opc_part_Release(IOpcPart *iface)
static HRESULT WINAPI opc_part_GetRelationshipSet(IOpcPart *iface, IOpcRelationshipSet **relationship_set) static HRESULT WINAPI opc_part_GetRelationshipSet(IOpcPart *iface, IOpcRelationshipSet **relationship_set)
{ {
FIXME("iface %p, relationship_set %p stub!\n", iface, relationship_set); struct opc_part *part = impl_from_IOpcPart(iface);
HRESULT hr;
return E_NOTIMPL; TRACE("iface %p, relationship_set %p.\n", iface, relationship_set);
if (!part->relationship_set && FAILED(hr = opc_relationship_set_create(&part->relationship_set)))
return hr;
*relationship_set = part->relationship_set;
IOpcRelationshipSet_AddRef(*relationship_set);
return S_OK;
} }
static HRESULT WINAPI opc_part_GetContentStream(IOpcPart *iface, IStream **stream) static HRESULT WINAPI opc_part_GetContentStream(IOpcPart *iface, IStream **stream)

View File

@ -74,6 +74,15 @@ static void test_package(void)
hr = IOpcPartSet_CreatePart(partset, part_uri, typeW, OPC_COMPRESSION_NONE, &part); hr = IOpcPartSet_CreatePart(partset, part_uri, typeW, OPC_COMPRESSION_NONE, &part);
ok(SUCCEEDED(hr), "Failed to create a part, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create a part, hr %#x.\n", hr);
hr = IOpcPart_GetRelationshipSet(part, &relset);
ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#x.\n", hr);
hr = IOpcPart_GetRelationshipSet(part, &relset2);
ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#x.\n", hr);
ok(relset == relset2, "Expected same part set instance.\n");
IOpcRelationshipSet_Release(relset);
IOpcRelationshipSet_Release(relset2);
ret = FALSE; ret = FALSE;
hr = IOpcPartSet_PartExists(partset, part_uri, &ret); hr = IOpcPartSet_PartExists(partset, part_uri, &ret);
todo_wine { todo_wine {