copied mono-api-diff.cs from mono-2-2 branch so new patch can be applied and history...
[mono.git] / mcs / class / corlib / System.Reflection / TypeDelegator.cs
1 // System.Reflection/TypeDelegator.cs
2 //
3 // Paolo Molaro (lupus@ximian.com)
4 //
5 // (C) 2002 Ximian, Inc.
6
7 //
8 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 // 
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 // 
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //
29
30 using System;
31 using System.Reflection;
32 using System.Globalization;
33 using System.Runtime.InteropServices;
34
35 namespace System.Reflection {
36
37         [ComVisible (true)]
38         [Serializable]
39         public class TypeDelegator : Type {
40                 protected Type typeImpl;
41         
42                 protected TypeDelegator () {
43                 }
44
45                 public TypeDelegator( Type delegatingType)
46                 {
47                         if (delegatingType == null)
48                                 throw new ArgumentNullException ("delegatingType must be non-null");
49                         typeImpl = delegatingType;
50                 }
51
52                 public override Assembly Assembly {
53                         get { return typeImpl.Assembly; }
54                 }
55
56                 public override string AssemblyQualifiedName {
57                         get { return typeImpl.AssemblyQualifiedName; }
58                 }
59
60                 public override Type BaseType {
61                         get { return typeImpl.BaseType; }
62                 }
63
64                 public override string FullName {
65                         get { return typeImpl.FullName; }
66                 }
67
68                 public override Guid GUID {
69                         get { return typeImpl.GUID; }
70                 }
71
72                 public override Module Module {
73                         get { return typeImpl.Module; }
74                 }
75
76                 public override string Name {
77                         get { return typeImpl.Name; }
78                 }
79
80                 public override string Namespace {
81                         get { return typeImpl.Namespace; }
82                 }
83
84                 public override RuntimeTypeHandle TypeHandle {
85                         get { return typeImpl.TypeHandle; }
86                 }
87
88                 public override Type UnderlyingSystemType {
89                         get { return typeImpl.UnderlyingSystemType; }
90                 }
91
92                 protected override TypeAttributes GetAttributeFlagsImpl ()
93                 {
94                         return typeImpl.Attributes;
95                 }
96                 
97                 protected override ConstructorInfo GetConstructorImpl (
98                         BindingFlags bindingAttr, Binder binder, CallingConventions callConvention,
99                         Type[] types, ParameterModifier[] modifiers)
100                 {
101                         return typeImpl.GetConstructor (bindingAttr, binder, callConvention, types, modifiers);
102                 }
103
104                 [ComVisible (true)]
105                 public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr)
106                 {
107                         return typeImpl.GetConstructors (bindingAttr);
108                 }
109
110                 public override object[] GetCustomAttributes (bool inherit)
111                 {
112                         return typeImpl.GetCustomAttributes (inherit);
113                 }
114
115                 public override object[] GetCustomAttributes (Type attributeType, bool inherit)
116                 {
117                         return typeImpl.GetCustomAttributes (attributeType, inherit);
118                 }
119
120                 public override Type GetElementType()
121                 {
122                         return typeImpl.GetElementType ();
123                 }
124
125                 public override EventInfo GetEvent( string name, BindingFlags bindingAttr)
126                 {
127                         return typeImpl.GetEvent (name, bindingAttr);
128                 }
129
130                 public override EventInfo[] GetEvents()
131                 {
132                         return GetEvents (BindingFlags.Public);
133                 }
134
135                 public override EventInfo[] GetEvents (BindingFlags bindingAttr)
136                 {
137                         return typeImpl.GetEvents (bindingAttr);
138                 }
139
140                 public override FieldInfo GetField (string name, BindingFlags bindingAttr)
141                 {
142                         return typeImpl.GetField (name, bindingAttr);
143                 }
144
145                 public override FieldInfo[] GetFields( BindingFlags bindingAttr)
146                 {
147                         return typeImpl.GetFields (bindingAttr);
148                 }
149
150                 public override Type GetInterface( string name, bool ignoreCase)
151                 {
152                         return typeImpl.GetInterface (name, ignoreCase);
153                 }
154
155                 [ComVisible (true)]
156                 public override InterfaceMapping GetInterfaceMap( Type interfaceType)
157                 {
158                         return typeImpl.GetInterfaceMap (interfaceType);
159                 }
160                 
161                 public override Type[] GetInterfaces ()
162                 {
163                         return typeImpl.GetInterfaces ();
164                 }
165
166                 public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr)
167                 {
168                         return typeImpl.GetMember (name, type, bindingAttr);
169                 }
170
171                 public override MemberInfo[] GetMembers( BindingFlags bindingAttr)
172                 {
173                         return typeImpl.GetMembers (bindingAttr);
174                 }
175
176                 protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
177                 {
178                         // Can't call GetMethod since it makes restrictive argument checks
179                         return typeImpl.GetMethodImplInternal (name, bindingAttr, binder, callConvention, types, modifiers);
180                 }
181
182                 public override MethodInfo[] GetMethods( BindingFlags bindingAttr)
183                 {
184                         return typeImpl.GetMethods (bindingAttr);
185                 }
186
187                 public override Type GetNestedType( string name, BindingFlags bindingAttr)
188                 {
189                         return typeImpl.GetNestedType (name, bindingAttr);
190                 }
191
192                 public override Type[] GetNestedTypes( BindingFlags bindingAttr)
193                 {
194                         return typeImpl.GetNestedTypes (bindingAttr);
195                 }
196
197                 public override PropertyInfo[] GetProperties( BindingFlags bindingAttr)
198                 {
199                         return typeImpl.GetProperties (bindingAttr);
200                 }
201
202                 protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
203                 {
204                         // Can't call GetProperty since it makes restrictive argument checks
205                         return typeImpl.GetPropertyImplInternal (name, bindingAttr, binder, returnType, types, modifiers);
206                 }
207
208                 protected override bool HasElementTypeImpl()
209                 {
210                         return typeImpl.HasElementType;
211                 }
212
213                 public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
214                         return typeImpl.InvokeMember (name, invokeAttr, binder, target, args, modifiers, culture, namedParameters);
215                 }
216
217                 protected override bool IsArrayImpl()
218                 {
219                         return typeImpl.IsArray;
220                 }
221
222                 protected override bool IsByRefImpl()
223                 {
224                         return typeImpl.IsByRef;
225                 }
226
227                 protected override bool IsCOMObjectImpl()
228                 {
229                         return typeImpl.IsCOMObject;
230                 }
231
232                 public override bool IsDefined( Type attributeType, bool inherit) {
233                         return typeImpl.IsDefined (attributeType, inherit);
234                 }
235
236                 protected override bool IsPointerImpl()
237                 {
238                         return typeImpl.IsPointer;
239                 }
240
241                 protected override bool IsPrimitiveImpl()
242                 {
243                         return typeImpl.IsPrimitive;
244                 }
245
246                 protected override bool IsValueTypeImpl()
247                 {
248                         return typeImpl.IsValueType;
249                 }
250
251                 public override int MetadataToken {
252                         get {
253                                 return typeImpl.MetadataToken;
254                         }
255                 }
256
257         }
258 }