System.Drawing: added email to icon and test file headers
[mono.git] / mcs / class / Mono.CodeContracts / Mono.CodeContracts.Static.Providers / IMetaDataProvider.cs
1 // 
2 // IMetaDataProvider.cs
3 // 
4 // Authors:
5 //      Alexander Chebaturkin (chebaturkin@gmail.com)
6 // 
7 // Copyright (C) 2011 Alexander Chebaturkin
8 // 
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //  
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 // 
28
29 using System.Collections.Generic;
30 using Mono.CodeContracts.Static.AST;
31 using Mono.CodeContracts.Static.AST.Visitors;
32 using Mono.CodeContracts.Static.DataStructures;
33
34 namespace Mono.CodeContracts.Static.Providers {
35         interface IMetaDataProvider {
36                 TypeNode System_Int32 { get; }
37                 TypeNode System_String { get; }
38                 TypeNode System_Boolean { get; }
39                 TypeNode System_IntPtr { get; }
40                 TypeNode System_UIntPtr { get; }
41                 TypeNode System_Void { get; }
42                 TypeNode System_Array { get; }
43                 TypeNode System_Object { get; }
44                 TypeNode System_Int8 { get; }
45                 TypeNode System_Int64 { get; }
46                 TypeNode System_Int16 { get; }
47                 TypeNode System_UInt8 { get; }
48                 TypeNode System_UInt64 { get; }
49                 TypeNode System_UInt32 { get; }
50                 TypeNode System_UInt16 { get; }
51
52                 Result AccessMethodBody<Data, Result> (Method method, IMethodCodeConsumer<Data, Result> consumer, Data data);
53
54                 IEnumerable<Method> Methods (AssemblyNode assembly);
55                 IEnumerable<Property> Properties (TypeNode type);
56                 IEnumerable<Field> Fields (TypeNode type);
57                 IEnumerable<TypeNode> Interfaces (TypeNode type);
58                 IIndexable<Local> Locals (Method method);
59                 IIndexable<Parameter> Parameters (Method method);
60
61                 IEnumerable<Method> ImplementedMethods (Method method);
62                 IEnumerable<Method> OverridenAndImplementedMethods (Method method);
63
64                 Parameter This (Method method);
65
66                 string Name (Local local);
67                 string Name (Method method);
68                 string Name (Field field);
69                 string Name (TypeNode type);
70
71                 string FullName (Method method);
72                 string FullName (TypeNode type);
73
74                 TypeNode FieldType (Field field);
75                 TypeNode ParameterType (Parameter parameter);
76                 TypeNode LocalType (Local local);
77                 TypeNode ReturnType (Method method);
78                 TypeNode ManagedPointer (TypeNode type);
79                 TypeNode ElementType (TypeNode type);
80                 TypeNode ArrayType (TypeNode type, int rank);
81
82
83                 TypeNode DeclaringType (Method method);
84                 TypeNode DeclaringType (Field field);
85
86                 bool Equal (Method thisMethod, Method thatMethod);
87
88                 bool IsMain (Method method);
89
90                 bool IsStatic (Method method);
91                 bool IsStatic (Field field);
92                 bool IsStatic (Property property);
93
94                 bool IsPrivate (Method method);
95
96                 bool IsProtected (Method method);
97                 bool IsProtected (Field field);
98
99                 bool IsPublic (Method method);
100                 bool IsPublic (Field field);
101
102                 bool IsVirtual (Method method);
103                 bool IsNewSlot (Method method);
104                 bool IsOverride (Method method);
105                 bool IsFinal (Method method);
106                 bool IsConstructor (Method method);
107                 bool IsAbstract (Method method);
108                 bool IsCompilerGenerated (Field field);
109                 bool IsCompilerGenerated (Method method);
110
111                 bool IsAutoPropertyMember (Method method);
112                 bool IsPropertySetter (Method method, out Property property);
113                 bool IsPropertyGetter (Method method, out Property property);
114                 bool HasSetter (Property property, out Method method);
115                 bool HasGetter (Property property, out Method method);
116
117                 bool HasBody (Method method);
118                 bool DerivesFrom (TypeNode sub, TypeNode type);
119                 bool Equal (TypeNode type, TypeNode otherType);
120
121                 bool TryGetImplementingMethod (TypeNode type, Method calledMethod, out Method implementingMethod);
122                 bool TryGetRootMethod (Method method, out Method rootMethod);
123
124                 Field Unspecialized (Field field);
125                 Method Unspecialized (Method method);
126                 TypeNode Unspecialized (TypeNode type);
127
128                 Method DeclaringMethod (Parameter parameter);
129
130                 int ParameterIndex (Parameter parameter);
131                 int ParameterStackIndex (Parameter parameter);
132
133                 bool TryLoadAssembly (string filename, out AssemblyNode assembly, out string reasonOnFailure);
134
135                 string Name (Parameter parameter);
136
137                 bool IsReferenceType (TypeNode type);
138                 bool IsManagedPointer (TypeNode value);
139                 bool IsStruct (TypeNode type);
140                 bool IsInterface (TypeNode type);
141                 bool IsArray (TypeNode type);
142                 bool IsVoid (TypeNode type);
143                 bool IsReadonly (Field value);
144                 bool IsFinalizer (Method method);
145                 bool IsDispose (Method method);
146                 bool IsVoidMethod (Method method);
147                 bool IsOut (Parameter p);
148                 bool IsPrimitive (TypeNode type);
149                 bool IsClass (TypeNode type);
150
151                 bool IsAsVisibleAs (Field value, Method method);
152                 bool IsAsVisibleAs (Method value, Method method);
153                 bool IsVisibleFrom (Field field, TypeNode declaringType);
154                 bool IsVisibleFrom (Method value, TypeNode declaringType);
155                 bool IsVisibleFrom (TypeNode type, TypeNode fromType);
156
157                 bool TryGetSystemType (string fullName, out TypeNode type);
158
159                 bool HasValueRepresentation (TypeNode type);
160
161                 void IsSpecialized (Method calledMethod, ref IImmutableMap<TypeNode, TypeNode> specialization);
162                 bool IsSpecialized (Method method);
163
164                 bool IsFormalTypeParameter (TypeNode type);
165                 bool IsMethodFormalTypeParameter (TypeNode type);
166
167                 int TypeSize (TypeNode type);
168         }
169 }