2 Copyright (C) 2008 Jeroen Frijters
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.
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:
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.
25 namespace IKVM.Reflection.Emit
27 public struct EventToken
29 public static readonly EventToken Empty;
30 private readonly int token;
32 internal EventToken(int token)
42 public override bool Equals(object obj)
44 return obj as EventToken? == this;
47 public override int GetHashCode()
52 public bool Equals(EventToken other)
57 public static bool operator ==(EventToken et1, EventToken et2)
59 return et1.token == et2.token;
62 public static bool operator !=(EventToken et1, EventToken et2)
64 return et1.token != et2.token;
68 public struct FieldToken
70 public static readonly FieldToken Empty;
71 private readonly int token;
73 internal FieldToken(int token)
78 internal bool IsPseudoToken
80 get { return token < 0; }
88 public override bool Equals(object obj)
90 return obj as FieldToken? == this;
93 public override int GetHashCode()
98 public bool Equals(FieldToken other)
100 return this == other;
103 public static bool operator ==(FieldToken ft1, FieldToken ft2)
105 return ft1.token == ft2.token;
108 public static bool operator !=(FieldToken ft1, FieldToken ft2)
110 return ft1.token != ft2.token;
114 public struct MethodToken
116 public static readonly MethodToken Empty;
117 private readonly int token;
119 internal MethodToken(int token)
124 internal bool IsPseudoToken
126 get { return token < 0; }
131 get { return token; }
134 public override bool Equals(object obj)
136 return obj as MethodToken? == this;
139 public override int GetHashCode()
144 public bool Equals(MethodToken other)
146 return this == other;
149 public static bool operator ==(MethodToken mt1, MethodToken mt2)
151 return mt1.token == mt2.token;
154 public static bool operator !=(MethodToken mt1, MethodToken mt2)
156 return mt1.token != mt2.token;
160 public struct SignatureToken
162 public static readonly SignatureToken Empty;
163 private readonly int token;
165 internal SignatureToken(int token)
172 get { return token; }
175 public override bool Equals(object obj)
177 return obj as SignatureToken? == this;
180 public override int GetHashCode()
185 public bool Equals(SignatureToken other)
187 return this == other;
190 public static bool operator ==(SignatureToken st1, SignatureToken st2)
192 return st1.token == st2.token;
195 public static bool operator !=(SignatureToken st1, SignatureToken st2)
197 return st1.token != st2.token;
201 public struct StringToken
203 private readonly int token;
205 internal StringToken(int token)
212 get { return token; }
215 public override bool Equals(object obj)
217 return obj as StringToken? == this;
220 public override int GetHashCode()
225 public bool Equals(StringToken other)
227 return this == other;
230 public static bool operator ==(StringToken st1, StringToken st2)
232 return st1.token == st2.token;
235 public static bool operator !=(StringToken st1, StringToken st2)
237 return st1.token != st2.token;
241 public struct TypeToken
243 public static readonly TypeToken Empty;
244 private readonly int token;
246 internal TypeToken(int token)
253 get { return token; }
256 public override bool Equals(object obj)
258 return obj as TypeToken? == this;
261 public override int GetHashCode()
266 public bool Equals(TypeToken other)
268 return this == other;
271 public static bool operator ==(TypeToken tt1, TypeToken tt2)
273 return tt1.token == tt2.token;
276 public static bool operator !=(TypeToken tt1, TypeToken tt2)
278 return tt1.token != tt2.token;