[threadpool] Added dynamic concurrent queue implementation
[mono.git] / mcs / class / IKVM.Reflection / FieldInfo.cs
1 /*
2   Copyright (C) 2009 Jeroen Frijters
3
4   This software is provided 'as-is', without any express or implied
5   warranty.  In no event will the authors be held liable for any damages
6   arising from the use of this software.
7
8   Permission is granted to anyone to use this software for any purpose,
9   including commercial applications, and to alter it and redistribute it
10   freely, subject to the following restrictions:
11
12   1. The origin of this software must not be misrepresented; you must not
13      claim that you wrote the original software. If you use this software
14      in a product, an acknowledgment in the product documentation would be
15      appreciated but is not required.
16   2. Altered source versions must be plainly marked as such, and must not be
17      misrepresented as being the original software.
18   3. This notice may not be removed or altered from any source distribution.
19
20   Jeroen Frijters
21   jeroen@frijters.net
22   
23 */
24 using System;
25
26 namespace IKVM.Reflection
27 {
28         public abstract class FieldInfo : MemberInfo
29         {
30                 // prevent external subclasses
31                 internal FieldInfo()
32                 {
33                 }
34
35                 public sealed override MemberTypes MemberType
36                 {
37                         get { return MemberTypes.Field; }
38                 }
39
40                 public abstract FieldAttributes Attributes { get; }
41                 public abstract void __GetDataFromRVA(byte[] data, int offset, int length);
42                 public abstract Object GetRawConstantValue();
43                 internal abstract FieldSignature FieldSignature { get; }
44
45                 public Type FieldType
46                 {
47                         get { return this.FieldSignature.FieldType; }
48                 }
49
50                 public Type[] GetOptionalCustomModifiers()
51                 {
52                         return this.FieldSignature.GetOptionalCustomModifiers();
53                 }
54
55                 public Type[] GetRequiredCustomModifiers()
56                 {
57                         return this.FieldSignature.GetRequiredCustomModifiers();
58                 }
59
60                 public bool IsStatic
61                 {
62                         get { return (Attributes & FieldAttributes.Static) != 0; }
63                 }
64
65                 public bool IsLiteral
66                 {
67                         get { return (Attributes & FieldAttributes.Literal) != 0; }
68                 }
69
70                 public bool IsInitOnly
71                 {
72                         get { return (Attributes & FieldAttributes.InitOnly) != 0; }
73                 }
74
75                 public bool IsNotSerialized
76                 {
77                         get { return (Attributes & FieldAttributes.NotSerialized) != 0; }
78                 }
79
80                 public bool IsSpecialName
81                 {
82                         get { return (Attributes & FieldAttributes.SpecialName) != 0; }
83                 }
84
85                 public bool IsPublic
86                 {
87                         get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public; }
88                 }
89
90                 public bool IsPrivate
91                 {
92                         get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private; }
93                 }
94
95                 public bool IsFamily
96                 {
97                         get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; }
98                 }
99
100                 public bool IsFamilyOrAssembly
101                 {
102                         get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem; }
103                 }
104
105                 public bool IsAssembly
106                 {
107                         get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; }
108                 }
109
110                 public bool IsFamilyAndAssembly
111                 {
112                         get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem; }
113                 }
114
115                 public bool IsPinvokeImpl
116                 {
117                         get { return (Attributes & FieldAttributes.PinvokeImpl) != 0; }
118                 }
119
120                 internal abstract int ImportTo(Emit.ModuleBuilder module);
121
122                 internal virtual FieldInfo BindTypeParameters(Type type)
123                 {
124                         return new GenericFieldInstance(this.DeclaringType.BindTypeParameters(type), this);
125                 }
126         }
127 }