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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
// 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.
//
using System;
namespace System.Runtime.InteropServices.WindowsRuntime
{
// DefaultInterfaceAttribute marks a WinRT class (or interface group) that has its default interface specified.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class DefaultInterfaceAttribute : Attribute
{
private Type m_defaultInterface;
public DefaultInterfaceAttribute(Type defaultInterface)
{
m_defaultInterface = defaultInterface;
}
public Type DefaultInterface
{
get { return m_defaultInterface; }
}
}
// WindowsRuntimeImport is a pseudo custom attribute which causes us to emit the tdWindowsRuntime bit
// onto types which are decorated with the attribute. This is needed to mark Windows Runtime types
// which are redefined in mscorlib.dll and System.Runtime.WindowsRuntime.dll, as the C# compiler does
// not have a built in syntax to mark tdWindowsRuntime. These two assemblies are special as they
// implement the CLR's support for WinRT, so this type is internal as marking tdWindowsRuntime should
// generally be done via winmdexp for user code.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, Inherited = false)]
[System.Runtime.CompilerServices.FriendAccessAllowed]
internal sealed class WindowsRuntimeImportAttribute : Attribute
{
public WindowsRuntimeImportAttribute()
{ }
}
// This attribute is applied to class interfaces in a generated projection assembly. It is used by Visual Studio
// and other tools to find out what version of a component (eg. Windows) a WinRT class began to implement
// a particular interfaces.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = true)]
public sealed class InterfaceImplementedInVersionAttribute : Attribute
{
public InterfaceImplementedInVersionAttribute(Type interfaceType, byte majorVersion, byte minorVersion, byte buildVersion, byte revisionVersion)
{
m_interfaceType = interfaceType;
m_majorVersion = majorVersion;
m_minorVersion = minorVersion;
m_buildVersion = buildVersion;
m_revisionVersion = revisionVersion;
}
public Type InterfaceType
{
get { return m_interfaceType; }
}
public byte MajorVersion
{
get { return m_majorVersion; }
}
public byte MinorVersion
{
get { return m_minorVersion; }
}
public byte BuildVersion
{
get { return m_buildVersion; }
}
public byte RevisionVersion
{
get { return m_revisionVersion; }
}
private Type m_interfaceType;
private byte m_majorVersion;
private byte m_minorVersion;
private byte m_buildVersion;
private byte m_revisionVersion;
}
// Applies to read-only array parameters
[AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
public sealed class ReadOnlyArrayAttribute : Attribute
{
public ReadOnlyArrayAttribute() {}
}
// Applies to write-only array parameters
[AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
public sealed class WriteOnlyArrayAttribute : Attribute
{
public WriteOnlyArrayAttribute() {}
}
// This attribute is applied on the return value to specify the name of the return value.
// In WindowsRuntime all parameters including return value need to have unique names.
// This is essential in JS as one of the ways to get at the results of a method in JavaScript is via a Dictionary object keyed by parameter name.
[AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
public sealed class ReturnValueNameAttribute : Attribute
{
private string m_Name;
public ReturnValueNameAttribute(string name)
{
m_Name = name;
}
public string Name
{
get { return m_Name; }
}
}
}
|