opcservices: Implement RelationshipExists().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7e310f87fe
commit
89c2553503
|
@ -580,11 +580,25 @@ static ULONG WINAPI opc_relationship_set_Release(IOpcRelationshipSet *iface)
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct opc_relationship *opc_relationshipset_get_item(struct opc_relationship_set *relationship_set,
|
||||||
|
const WCHAR *id)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < relationship_set->count; i++)
|
||||||
|
{
|
||||||
|
if (!strcmpW(id, relationship_set->relationships[i]->id))
|
||||||
|
return relationship_set->relationships[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI opc_relationship_set_GetRelationship(IOpcRelationshipSet *iface, const WCHAR *id,
|
static HRESULT WINAPI opc_relationship_set_GetRelationship(IOpcRelationshipSet *iface, const WCHAR *id,
|
||||||
IOpcRelationship **relationship)
|
IOpcRelationship **relationship)
|
||||||
{
|
{
|
||||||
struct opc_relationship_set *relationship_set = impl_from_IOpcRelationshipSet(iface);
|
struct opc_relationship_set *relationship_set = impl_from_IOpcRelationshipSet(iface);
|
||||||
size_t i;
|
struct opc_relationship *ret;
|
||||||
|
|
||||||
TRACE("iface %p, id %s, relationship %p.\n", iface, debugstr_w(id), relationship);
|
TRACE("iface %p, id %s, relationship %p.\n", iface, debugstr_w(id), relationship);
|
||||||
|
|
||||||
|
@ -596,14 +610,10 @@ static HRESULT WINAPI opc_relationship_set_GetRelationship(IOpcRelationshipSet *
|
||||||
if (!id)
|
if (!id)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
for (i = 0; i < relationship_set->count; i++)
|
if ((ret = opc_relationshipset_get_item(relationship_set, id)))
|
||||||
{
|
{
|
||||||
if (!strcmpW(id, relationship_set->relationships[i]->id))
|
*relationship = &ret->IOpcRelationship_iface;
|
||||||
{
|
IOpcRelationship_AddRef(*relationship);
|
||||||
*relationship = &relationship_set->relationships[i]->IOpcRelationship_iface;
|
|
||||||
IOpcRelationship_AddRef(*relationship);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *relationship ? S_OK : OPC_E_NO_SUCH_RELATIONSHIP;
|
return *relationship ? S_OK : OPC_E_NO_SUCH_RELATIONSHIP;
|
||||||
|
@ -632,9 +642,16 @@ static HRESULT WINAPI opc_relationship_set_DeleteRelationship(IOpcRelationshipSe
|
||||||
|
|
||||||
static HRESULT WINAPI opc_relationship_set_RelationshipExists(IOpcRelationshipSet *iface, const WCHAR *id, BOOL *exists)
|
static HRESULT WINAPI opc_relationship_set_RelationshipExists(IOpcRelationshipSet *iface, const WCHAR *id, BOOL *exists)
|
||||||
{
|
{
|
||||||
FIXME("iface %p, id %s, exists %p stub!\n", iface, debugstr_w(id), exists);
|
struct opc_relationship_set *relationship_set = impl_from_IOpcRelationshipSet(iface);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
TRACE("iface %p, id %s, exists %p.\n", iface, debugstr_w(id), exists);
|
||||||
|
|
||||||
|
if (!id || !exists)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
*exists = opc_relationshipset_get_item(relationship_set, id) != NULL;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI opc_relationship_set_GetEnumerator(IOpcRelationshipSet *iface,
|
static HRESULT WINAPI opc_relationship_set_GetEnumerator(IOpcRelationshipSet *iface,
|
||||||
|
|
|
@ -241,6 +241,7 @@ static void test_relationship(void)
|
||||||
DWORD mode;
|
DWORD mode;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
WCHAR *id;
|
WCHAR *id;
|
||||||
|
BOOL ret;
|
||||||
BSTR str;
|
BSTR str;
|
||||||
|
|
||||||
factory = create_factory();
|
factory = create_factory();
|
||||||
|
@ -284,6 +285,19 @@ todo_wine
|
||||||
ok(SUCCEEDED(hr), "Failed to get id, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get id, hr %#x.\n", hr);
|
||||||
ok(lstrlenW(id) == 9 && *id == 'R', "Unexpected relationship id %s.\n", wine_dbgstr_w(id));
|
ok(lstrlenW(id) == 9 && *id == 'R', "Unexpected relationship id %s.\n", wine_dbgstr_w(id));
|
||||||
|
|
||||||
|
ret = 123;
|
||||||
|
hr = IOpcRelationshipSet_RelationshipExists(rels, NULL, &ret);
|
||||||
|
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||||
|
ok(ret == 123, "Unexpected result %d.\n", ret);
|
||||||
|
|
||||||
|
hr = IOpcRelationshipSet_RelationshipExists(rels, id, NULL);
|
||||||
|
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
ret = FALSE;
|
||||||
|
hr = IOpcRelationshipSet_RelationshipExists(rels, id, &ret);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to get relationship, hr %#x.\n", hr);
|
||||||
|
ok(ret, "Unexpected result %d.\n", ret);
|
||||||
|
|
||||||
hr = IOpcRelationshipSet_GetRelationship(rels, id, &rel3);
|
hr = IOpcRelationshipSet_GetRelationship(rels, id, &rel3);
|
||||||
ok(SUCCEEDED(hr), "Failed to get relationship, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get relationship, hr %#x.\n", hr);
|
||||||
IOpcRelationship_Release(rel3);
|
IOpcRelationship_Release(rel3);
|
||||||
|
@ -302,6 +316,11 @@ todo_wine
|
||||||
ok(hr == OPC_E_NO_SUCH_RELATIONSHIP, "Unexpected hr %#x.\n", hr);
|
ok(hr == OPC_E_NO_SUCH_RELATIONSHIP, "Unexpected hr %#x.\n", hr);
|
||||||
ok(rel3 == NULL, "Expected null pointer.\n");
|
ok(rel3 == NULL, "Expected null pointer.\n");
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
hr = IOpcRelationshipSet_RelationshipExists(rels, id, &ret);
|
||||||
|
ok(SUCCEEDED(hr), "Unexpected hr %#x.\n", hr);
|
||||||
|
ok(!ret, "Unexpected result %d.\n", ret);
|
||||||
|
|
||||||
CoTaskMemFree(id);
|
CoTaskMemFree(id);
|
||||||
|
|
||||||
hr = IOpcRelationship_GetTargetUri(rel, &uri);
|
hr = IOpcRelationship_GetTargetUri(rel, &uri);
|
||||||
|
|
Loading…
Reference in New Issue