summaryrefslogtreecommitdiff
path: root/src/vm/clrprivtypecachewinrt.h
blob: 8199773df97bdbf7bb63511deb47c8c6aee01a81 (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.
// 

// 
// Contains VM implementation of WinRT type cache for code:CLRPrivBinderWinRT binder.
// 
//=====================================================================================================================

#pragma once

#include "internalunknownimpl.h"
#include "clrprivbinding.h"

//=====================================================================================================================
class CLRPrivTypeCacheWinRT : 
    public IUnknownCommon<IUnknown>
{
public:
    //=============================================================================================
    // Class methods
    
    // S_OK - pAssembly contains type wszTypeName
    // S_FALSE - pAssembly does not contain type wszTypeName
    HRESULT ContainsType(
        ICLRPrivAssembly * pAssembly, 
        LPCWSTR            wszTypeName);
    
    // S_OK - pAssembly contains type wszTypeName
    // S_FALSE - pAssembly does not contain type wszTypeName
    // E_FAIL - assembly is not loaded
    HRESULT ContainsTypeIfLoaded(
        PTR_AppDomain        pAppDomain, 
        PTR_ICLRPrivAssembly pPrivAssembly, 
        LPCUTF8              szNamespace, 
        LPCUTF8              szClassName, 
        PTR_Assembly *       ppAssembly);
    
    static CLRPrivTypeCacheWinRT * GetOrCreateTypeCache();
    
#ifndef DACCESS_COMPILE
    
#ifndef CROSSGEN_COMPILE
    // Raises user event DesignerNamespaceResolveEvent to get a list of files for this namespace.
    void RaiseDesignerNamespaceResolveEvent(
        LPCWSTR                                wszNamespace, 
        CLRPrivBinderUtil::WStringListHolder * pFileNameList);
#endif // CROSSGEN_COMPILE
    
#endif //!DACCESS_COMPILE
    
private:
    //=============================================================================================
    // Private methods
    
    // Checks if the type (szNamespace/szClassName) is present in the assembly pAssembly.
    HRESULT ContainsTypeHelper(
        PTR_Assembly pAssembly, 
        LPCUTF8      szNamespace, 
        LPCUTF8      szClassName);
    
    //=============================================================================================
    // Class fields
    
    static CLRPrivTypeCacheWinRT * s_pSingleton;
    
};  // class CLRPrivTypeCaheWinRT

typedef DPTR(CLRPrivTypeCacheWinRT) PTR_CLRPrivTypeCacheWinRT;