~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ikvm/reflect/Emit/Tokens.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2008 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
 
 
25
namespace IKVM.Reflection.Emit
 
26
{
 
27
        public struct EventToken
 
28
        {
 
29
                public static readonly EventToken Empty;
 
30
                private readonly int token;
 
31
 
 
32
                internal EventToken(int token)
 
33
                {
 
34
                        this.token = token;
 
35
                }
 
36
 
 
37
                public int Token
 
38
                {
 
39
                        get { return token; }
 
40
                }
 
41
 
 
42
                public override bool Equals(object obj)
 
43
                {
 
44
                        return obj as EventToken? == this;
 
45
                }
 
46
 
 
47
                public override int GetHashCode()
 
48
                {
 
49
                        return token;
 
50
                }
 
51
 
 
52
                public bool Equals(EventToken other)
 
53
                {
 
54
                        return this == other;
 
55
                }
 
56
 
 
57
                public static bool operator ==(EventToken et1, EventToken et2)
 
58
                {
 
59
                        return et1.token == et2.token;
 
60
                }
 
61
 
 
62
                public static bool operator !=(EventToken et1, EventToken et2)
 
63
                {
 
64
                        return et1.token != et2.token;
 
65
                }
 
66
        }
 
67
 
 
68
        public struct FieldToken
 
69
        {
 
70
                public static readonly FieldToken Empty;
 
71
                private readonly int token;
 
72
 
 
73
                internal FieldToken(int token)
 
74
                {
 
75
                        this.token = token;
 
76
                }
 
77
 
 
78
                public int Token
 
79
                {
 
80
                        get { return token; }
 
81
                }
 
82
 
 
83
                public override bool Equals(object obj)
 
84
                {
 
85
                        return obj as FieldToken? == this;
 
86
                }
 
87
 
 
88
                public override int GetHashCode()
 
89
                {
 
90
                        return token;
 
91
                }
 
92
 
 
93
                public bool Equals(FieldToken other)
 
94
                {
 
95
                        return this == other;
 
96
                }
 
97
 
 
98
                public static bool operator ==(FieldToken ft1, FieldToken ft2)
 
99
                {
 
100
                        return ft1.token == ft2.token;
 
101
                }
 
102
 
 
103
                public static bool operator !=(FieldToken ft1, FieldToken ft2)
 
104
                {
 
105
                        return ft1.token != ft2.token;
 
106
                }
 
107
        }
 
108
 
 
109
        public struct MethodToken
 
110
        {
 
111
                public static readonly MethodToken Empty;
 
112
                private readonly int token;
 
113
 
 
114
                internal MethodToken(int token)
 
115
                {
 
116
                        this.token = token;
 
117
                }
 
118
 
 
119
                public int Token
 
120
                {
 
121
                        get { return token; }
 
122
                }
 
123
 
 
124
                public override bool Equals(object obj)
 
125
                {
 
126
                        return obj as MethodToken? == this;
 
127
                }
 
128
 
 
129
                public override int GetHashCode()
 
130
                {
 
131
                        return token;
 
132
                }
 
133
 
 
134
                public bool Equals(MethodToken other)
 
135
                {
 
136
                        return this == other;
 
137
                }
 
138
 
 
139
                public static bool operator ==(MethodToken mt1, MethodToken mt2)
 
140
                {
 
141
                        return mt1.token == mt2.token;
 
142
                }
 
143
 
 
144
                public static bool operator !=(MethodToken mt1, MethodToken mt2)
 
145
                {
 
146
                        return mt1.token != mt2.token;
 
147
                }
 
148
        }
 
149
 
 
150
        public struct SignatureToken
 
151
        {
 
152
                public static readonly SignatureToken Empty;
 
153
                private readonly int token;
 
154
 
 
155
                internal SignatureToken(int token)
 
156
                {
 
157
                        this.token = token;
 
158
                }
 
159
 
 
160
                public int Token
 
161
                {
 
162
                        get { return token; }
 
163
                }
 
164
 
 
165
                public override bool Equals(object obj)
 
166
                {
 
167
                        return obj as SignatureToken? == this;
 
168
                }
 
169
 
 
170
                public override int GetHashCode()
 
171
                {
 
172
                        return token;
 
173
                }
 
174
 
 
175
                public bool Equals(SignatureToken other)
 
176
                {
 
177
                        return this == other;
 
178
                }
 
179
 
 
180
                public static bool operator ==(SignatureToken st1, SignatureToken st2)
 
181
                {
 
182
                        return st1.token == st2.token;
 
183
                }
 
184
 
 
185
                public static bool operator !=(SignatureToken st1, SignatureToken st2)
 
186
                {
 
187
                        return st1.token != st2.token;
 
188
                }
 
189
        }
 
190
 
 
191
        public struct StringToken
 
192
        {
 
193
                private readonly int token;
 
194
 
 
195
                internal StringToken(int token)
 
196
                {
 
197
                        this.token = token;
 
198
                }
 
199
 
 
200
                public int Token
 
201
                {
 
202
                        get { return token; }
 
203
                }
 
204
 
 
205
                public override bool Equals(object obj)
 
206
                {
 
207
                        return obj as StringToken? == this;
 
208
                }
 
209
 
 
210
                public override int GetHashCode()
 
211
                {
 
212
                        return token;
 
213
                }
 
214
 
 
215
                public bool Equals(StringToken other)
 
216
                {
 
217
                        return this == other;
 
218
                }
 
219
 
 
220
                public static bool operator ==(StringToken st1, StringToken st2)
 
221
                {
 
222
                        return st1.token == st2.token;
 
223
                }
 
224
 
 
225
                public static bool operator !=(StringToken st1, StringToken st2)
 
226
                {
 
227
                        return st1.token != st2.token;
 
228
                }
 
229
        }
 
230
 
 
231
        public struct TypeToken
 
232
        {
 
233
                public static readonly TypeToken Empty;
 
234
                private readonly int token;
 
235
 
 
236
                internal TypeToken(int token)
 
237
                {
 
238
                        this.token = token;
 
239
                }
 
240
 
 
241
                public int Token
 
242
                {
 
243
                        get { return token; }
 
244
                }
 
245
 
 
246
                public override bool Equals(object obj)
 
247
                {
 
248
                        return obj as TypeToken? == this;
 
249
                }
 
250
 
 
251
                public override int GetHashCode()
 
252
                {
 
253
                        return token;
 
254
                }
 
255
 
 
256
                public bool Equals(TypeToken other)
 
257
                {
 
258
                        return this == other;
 
259
                }
 
260
 
 
261
                public static bool operator ==(TypeToken tt1, TypeToken tt2)
 
262
                {
 
263
                        return tt1.token == tt2.token;
 
264
                }
 
265
 
 
266
                public static bool operator !=(TypeToken tt1, TypeToken tt2)
 
267
                {
 
268
                        return tt1.token != tt2.token;
 
269
                }
 
270
        }
 
271
}