Delete FriendAccessAllowedAttribute and associated dead code (#15101)
[platform/upstream/coreclr.git] / src / mscorlib / src / System / Runtime / InteropServices / WindowsRuntime / Attributes.cs
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4
5 //
6
7 using System;
8
9 namespace System.Runtime.InteropServices.WindowsRuntime
10 {
11     // DefaultInterfaceAttribute marks a WinRT class (or interface group) that has its default interface specified.
12     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
13     public sealed class DefaultInterfaceAttribute : Attribute
14     {
15         private Type m_defaultInterface;
16
17         public DefaultInterfaceAttribute(Type defaultInterface)
18         {
19             m_defaultInterface = defaultInterface;
20         }
21
22         public Type DefaultInterface
23         {
24             get { return m_defaultInterface; }
25         }
26     }
27
28     // WindowsRuntimeImport is a pseudo custom attribute which causes us to emit the tdWindowsRuntime bit
29     // onto types which are decorated with the attribute.  This is needed to mark Windows Runtime types
30     // which are redefined in mscorlib.dll and System.Runtime.WindowsRuntime.dll, as the C# compiler does
31     // not have a built in syntax to mark tdWindowsRuntime.   These two assemblies are special as they
32     // implement the CLR's support for WinRT, so this type is internal as marking tdWindowsRuntime should
33     // generally be done via winmdexp for user code.
34     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, Inherited = false)]
35     // [System.Runtime.CompilerServices.FriendAccessAllowed]
36     internal sealed class WindowsRuntimeImportAttribute : Attribute
37     {
38         internal WindowsRuntimeImportAttribute()
39         { }
40     }
41
42     // This attribute is applied to class interfaces in a generated projection assembly.  It is used by Visual Studio
43     // and other tools to find out what version of a component (eg. Windows) a WinRT class began to implement
44     // a particular interfaces.
45     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = true)]
46     public sealed class InterfaceImplementedInVersionAttribute : Attribute
47     {
48         public InterfaceImplementedInVersionAttribute(Type interfaceType, byte majorVersion, byte minorVersion, byte buildVersion, byte revisionVersion)
49         {
50             m_interfaceType = interfaceType;
51             m_majorVersion = majorVersion;
52             m_minorVersion = minorVersion;
53             m_buildVersion = buildVersion;
54             m_revisionVersion = revisionVersion;
55         }
56
57         public Type InterfaceType
58         {
59             get { return m_interfaceType; }
60         }
61
62         public byte MajorVersion
63         {
64             get { return m_majorVersion; }
65         }
66
67         public byte MinorVersion
68         {
69             get { return m_minorVersion; }
70         }
71
72         public byte BuildVersion
73         {
74             get { return m_buildVersion; }
75         }
76
77         public byte RevisionVersion
78         {
79             get { return m_revisionVersion; }
80         }
81
82         private Type m_interfaceType;
83         private byte m_majorVersion;
84         private byte m_minorVersion;
85         private byte m_buildVersion;
86         private byte m_revisionVersion;
87     }
88
89     // Applies to read-only array parameters
90     [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
91     public sealed class ReadOnlyArrayAttribute : Attribute
92     {
93         public ReadOnlyArrayAttribute() { }
94     }
95
96     // Applies to write-only array parameters
97     [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
98     public sealed class WriteOnlyArrayAttribute : Attribute
99     {
100         public WriteOnlyArrayAttribute() { }
101     }
102
103
104
105     // This attribute is applied on the return value to specify the name of the return value. 
106     // In WindowsRuntime all parameters including return value need to have unique names.
107     // 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.
108     [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
109     public sealed class ReturnValueNameAttribute : Attribute
110     {
111         private string m_Name;
112         public ReturnValueNameAttribute(string name)
113         {
114             m_Name = name;
115         }
116
117         public string Name
118         {
119             get { return m_Name; }
120         }
121     }
122 }