blob: de6949dad007139cdc0882251a8485e040a0830e (
plain)
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
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// File: winrtredirector.inl
//
//
//
// ============================================================================
#if !defined(WINRT_DELEGATE_REDIRECTOR_INL) && defined(WINRT_DELEGATE_REDIRECTOR_H)
#define WINRT_DELEGATE_REDIRECTOR_INL
#ifdef FEATURE_COMINTEROP
/*static*/
inline bool WinRTInterfaceRedirector::ResolveRedirectedInterface(MethodTable *pMT, WinMDAdapter::RedirectedTypeIndex * pIndex)
{
LIMITED_METHOD_CONTRACT;
WinMDAdapter::RedirectedTypeIndex index;
WinMDAdapter::WinMDTypeKind kind;
if (WinRTTypeNameConverter::ResolveRedirectedType(pMT, &index, &kind))
{
if ((kind == WinMDAdapter::WinMDTypeKind_Interface || kind == WinMDAdapter::WinMDTypeKind_PInterface) &&
// filter out KeyValuePair and Nullable which are structures projected from WinRT interfaces
index != WinMDAdapter::RedirectedTypeIndex_System_Collections_Generic_KeyValuePair &&
index != WinMDAdapter::RedirectedTypeIndex_System_Nullable)
{
if (pIndex != NULL)
{
*pIndex = index;
}
return true;
}
}
return false;
}
/*static */
inline bool WinRTDelegateRedirector::ResolveRedirectedDelegate(MethodTable *pMT, WinMDAdapter::RedirectedTypeIndex *pIndex)
{
LIMITED_METHOD_CONTRACT;
WinMDAdapter::RedirectedTypeIndex index;
WinMDAdapter::WinMDTypeKind kind;
if (WinRTTypeNameConverter::ResolveRedirectedType(pMT, &index, &kind))
{
if (kind == WinMDAdapter::WinMDTypeKind_Delegate ||
kind == WinMDAdapter::WinMDTypeKind_PDelegate)
{
if (pIndex != NULL)
{
*pIndex = index;
}
return true;
}
}
return false;
}
#endif // FEATURE_COMINTEROP
#endif // WINRT_DELEGATE_REDIRECTOR_INL
|