vbscript: Added IMatch interface to Match2 object.

This commit is contained in:
Piotr Caban 2013-03-25 12:34:49 +01:00 committed by Alexandre Julliard
parent fbf01da470
commit 79632a2212
2 changed files with 91 additions and 0 deletions

View file

@ -875,6 +875,10 @@ static void test_RegExp(void)
ok(hres == S_OK, "QueryInterface(IID_IMatch2) returned %x\n", hres);
IDispatch_Release(disp);
hres = IMatch2_QueryInterface(match, &IID_IMatch, (void**)&unk);
ok(hres == S_OK, "QueryInterface(IID_IMatch) returned %x\n", hres);
IUnknown_Release(unk);
hres = IMatch2_get_Value(match, NULL);
ok(hres == E_POINTER, "get_Value returned %x, expected E_POINTER\n", hres);

View file

@ -91,6 +91,7 @@ struct SubMatches {
typedef struct Match2 {
IMatch2 IMatch2_iface;
IMatch IMatch_iface;
LONG ref;
@ -354,6 +355,9 @@ static HRESULT WINAPI Match2_QueryInterface(
}else if(IsEqualGUID(riid, &IID_IMatch2)) {
TRACE("(%p)->(IID_IMatch2 %p)\n", This, ppv);
*ppv = &This->IMatch2_iface;
}else if(IsEqualGUID(riid, &IID_IMatch)) {
TRACE("(%p)->(IID_IMatch %p)\n", This, ppv);
*ppv = &This->IMatch_iface;
}else if(IsEqualGUID(riid, &IID_IDispatchEx)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = NULL;
@ -510,6 +514,88 @@ static const IMatch2Vtbl Match2Vtbl = {
Match2_get_SubMatches
};
static inline Match2 *impl_from_IMatch(IMatch *iface)
{
return CONTAINING_RECORD(iface, Match2, IMatch_iface);
}
static HRESULT WINAPI Match_QueryInterface(IMatch *iface, REFIID riid, void **ppv)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_QueryInterface(&This->IMatch2_iface, riid, ppv);
}
static ULONG WINAPI Match_AddRef(IMatch *iface)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_AddRef(&This->IMatch2_iface);
}
static ULONG WINAPI Match_Release(IMatch *iface)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_Release(&This->IMatch2_iface);
}
static HRESULT WINAPI Match_GetTypeInfoCount(IMatch *iface, UINT *pctinfo)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_GetTypeInfoCount(&This->IMatch2_iface, pctinfo);
}
static HRESULT WINAPI Match_GetTypeInfo(IMatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_GetTypeInfo(&This->IMatch2_iface, iTInfo, lcid, ppTInfo);
}
static HRESULT WINAPI Match_GetIDsOfNames(IMatch *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_GetIDsOfNames(&This->IMatch2_iface, riid, rgszNames, cNames, lcid, rgDispId);
}
static HRESULT WINAPI Match_Invoke(IMatch *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_Invoke(&This->IMatch2_iface, dispIdMember, riid, lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
}
static HRESULT WINAPI Match_get_Value(IMatch *iface, BSTR *pValue)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_get_Value(&This->IMatch2_iface, pValue);
}
static HRESULT WINAPI Match_get_FirstIndex(IMatch *iface, LONG *pFirstIndex)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_get_FirstIndex(&This->IMatch2_iface, pFirstIndex);
}
static HRESULT WINAPI Match_get_Length(IMatch *iface, LONG *pLength)
{
Match2 *This = impl_from_IMatch(iface);
return IMatch2_get_Length(&This->IMatch2_iface, pLength);
}
static IMatchVtbl MatchVtbl = {
Match_QueryInterface,
Match_AddRef,
Match_Release,
Match_GetTypeInfoCount,
Match_GetTypeInfo,
Match_GetIDsOfNames,
Match_Invoke,
Match_get_Value,
Match_get_FirstIndex,
Match_get_Length
};
static HRESULT create_match2(DWORD pos, match_state_t **result, IMatch2 **match)
{
Match2 *ret;
@ -533,6 +619,7 @@ static HRESULT create_match2(DWORD pos, match_state_t **result, IMatch2 **match)
*result = NULL;
ret->IMatch2_iface.lpVtbl = &Match2Vtbl;
ret->IMatch_iface.lpVtbl = &MatchVtbl;
ret->ref = 1;
*match = &ret->IMatch2_iface;