Update list to compile with mcs
[mono.git] / mcs / class / System.Data / System.Data.SqlTypes / SqlInt64.cs
1 //
2 // System.Data.SqlTypes.SqlInt64
3 //
4 // Author:
5 //   Tim Coleman <tim@timcoleman.com>
6 //
7 // (C) Copyright 2002 Tim Coleman
8 //
9
10 using System;
11
12 namespace System.Data.SqlTypes
13 {
14         public struct SqlInt64 : INullable, IComparable
15         {
16                 #region Fields
17                 private long value;
18                 
19                 [MonoTODO]
20                 public static readonly SqlInt64 MaxValue; // 2^63 - 1
21
22                 [MonoTODO]
23                 public static readonly SqlInt64 MinValue; // -2^63
24
25                 [MonoTODO]
26                 public static readonly SqlInt64 Null;
27                 public static readonly SqlInt64 Zero = new SqlInt64 (0);
28
29                 #endregion
30
31                 #region Constructors
32
33                 public SqlInt64 (long value) 
34                 {
35                         this.value = value;
36                 }
37
38                 #endregion
39
40                 #region Properties
41
42                 [MonoTODO]
43                 public bool IsNull { 
44                         get { return (bool) (this == SqlInt64.Null); }
45                 }
46
47                 public long Value { 
48                         get { 
49                                 if (this.IsNull) 
50                                         throw new SqlNullValueException ("The property contains Null.");
51                                 else 
52                                         return value; 
53                         }
54                 }
55
56                 #endregion
57
58                 #region Methods
59
60                 public static SqlInt64 Add (SqlInt64 x, SqlInt64 y)
61                 {
62                         return (x + y);
63                 }
64
65                 public static SqlInt64 BitwiseAnd (SqlInt64 x, SqlInt64 y)
66                 {
67                         return (x & y);
68                 }
69
70                 public static SqlInt64 BitwiseOr (SqlInt64 x, SqlInt64 y)
71                 {
72                         return (x | y);
73                 }
74
75                 [MonoTODO]
76                 public int CompareTo (object value)
77                 {
78                         throw new NotImplementedException ();
79                 }
80
81                 public static SqlInt64 Divide (SqlInt64 x, SqlInt64 y)
82                 {
83                         return (x / y);
84                 }
85
86                 [MonoTODO]
87                 public override bool Equals (object value)
88                 {
89                         throw new NotImplementedException ();
90                 }
91
92                 public static SqlBoolean Equals (SqlInt64 x, SqlInt64 y)
93                 {
94                         return (x == y);
95                 }
96
97                 [MonoTODO]
98                 public override int GetHashCode ()
99                 {
100                         return (int)value;
101                 }
102
103                 public static SqlBoolean GreaterThan (SqlInt64 x, SqlInt64 y)
104                 {
105                         return (x > y);
106                 }
107
108                 public static SqlBoolean GreaterThanOrEqual (SqlInt64 x, SqlInt64 y)
109                 {
110                         return (x >= y);
111                 }
112
113                 public static SqlBoolean LessThan (SqlInt64 x, SqlInt64 y)
114                 {
115                         return (x < y);
116                 }
117
118                 public static SqlBoolean LessThanOrEqual (SqlInt64 x, SqlInt64 y)
119                 {
120                         return (x <= y);
121                 }
122
123                 public static SqlInt64 Multiply (SqlInt64 x, SqlInt64 y)
124                 {
125                         return (x * y);
126                 }
127
128                 public static SqlBoolean NotEquals (SqlInt64 x, SqlInt64 y)
129                 {
130                         return (x != y);
131                 }
132
133                 public static SqlInt64 OnesComplement (SqlInt64 x)
134                 {
135                         return ~x;
136                 }
137
138                 [MonoTODO]
139                 public static SqlInt64 Parse (string s)
140                 {
141                         throw new NotImplementedException ();
142                 }
143
144                 public static SqlInt64 Subtract (SqlInt64 x, SqlInt64 y)
145                 {
146                         return (x - y);
147                 }
148
149                 public SqlBoolean ToSqlBoolean ()
150                 {
151                         return ((SqlBoolean)this);
152                 }
153                 
154                 public SqlByte ToSqlByte ()
155                 {
156                         return ((SqlByte)this);
157                 }
158
159                 public SqlDecimal ToSqlDecimal ()
160                 {
161                         return ((SqlDecimal)this);
162                 }
163
164                 public SqlDouble ToSqlDouble ()
165                 {
166                         return ((SqlDouble)this);
167                 }
168
169                 public SqlInt16 ToSqlInt16 ()
170                 {
171                         return ((SqlInt16)this);
172                 }
173
174                 public SqlInt32 ToSqlInt32 ()
175                 {
176                         return ((SqlInt32)this);
177                 }
178
179                 public SqlMoney ToSqlMoney ()
180                 {
181                         return ((SqlMoney)this);
182                 }
183
184                 public SqlSingle ToSqlSingle ()
185                 {
186                         return ((SqlSingle)this);
187                 }
188
189                 [MonoTODO]
190                 public SqlString ToSqlString ()
191                 {
192                         throw new NotImplementedException ();
193                 }
194
195                 [MonoTODO]
196                 public override string ToString ()
197                 {
198                         throw new NotImplementedException ();
199                 }
200
201                 public static SqlInt64 Xor (SqlInt64 x, SqlInt64 y)
202                 {
203                         return (x ^ y);
204                 }
205
206                 public static SqlInt64 operator + (SqlInt64 x, SqlInt64 y)
207                 {
208                         return new SqlInt64 (x.Value + y.Value);
209                 }
210
211                 public static SqlInt64 operator & (SqlInt64 x, SqlInt64 y)
212                 {
213                         return new SqlInt64 (x.value & y.Value);
214                 }
215
216                 public static SqlInt64 operator | (SqlInt64 x, SqlInt64 y)
217                 {
218                         return new SqlInt64 (x.value | y.Value);
219                 }
220
221                 public static SqlInt64 operator / (SqlInt64 x, SqlInt64 y)
222                 {
223                         return new SqlInt64 (x.Value / y.Value);
224                 }
225
226                 public static SqlBoolean operator == (SqlInt64 x, SqlInt64 y)
227                 {
228                         if (x.IsNull || y.IsNull) return SqlBoolean.Null;
229                         return new SqlBoolean (x.Value == y.Value);
230                 }
231
232                 public static SqlInt64 operator ^ (SqlInt64 x, SqlInt64 y)
233                 {
234                         return new SqlInt64 (x.Value ^ y.Value);
235                 }
236
237                 public static SqlBoolean operator > (SqlInt64 x, SqlInt64 y)
238                 {
239                         if (x.IsNull || y.IsNull) return SqlBoolean.Null;
240                         return new SqlBoolean (x.Value > y.Value);
241                 }
242
243                 public static SqlBoolean operator >= (SqlInt64 x, SqlInt64 y)
244                 {
245                         if (x.IsNull || y.IsNull) return SqlBoolean.Null;
246                         return new SqlBoolean (x.Value >= y.Value);
247                 }
248
249                 public static SqlBoolean operator != (SqlInt64 x, SqlInt64 y)
250                 {
251                         if (x.IsNull || y.IsNull) return SqlBoolean.Null;
252                         return new SqlBoolean (!(x.Value == y.Value));
253                 }
254
255                 public static SqlBoolean operator < (SqlInt64 x, SqlInt64 y)
256                 {
257                         if (x.IsNull || y.IsNull) return SqlBoolean.Null;
258                         return new SqlBoolean (x.Value < y.Value);
259                 }
260
261                 public static SqlBoolean operator <= (SqlInt64 x, SqlInt64 y)
262                 {
263                         if (x.IsNull || y.IsNull) return SqlBoolean.Null;
264                         return new SqlBoolean (x.Value <= y.Value);
265                 }
266
267                 public static SqlInt64 operator % (SqlInt64 x, SqlInt64 y)
268                 {
269                         return new SqlInt64(x.Value % y.Value);
270                 }
271
272                 public static SqlInt64 operator * (SqlInt64 x, SqlInt64 y)
273                 {
274                         return new SqlInt64 (x.Value * y.Value);
275                 }
276
277                 public static SqlInt64 operator ~ (SqlInt64 x)
278                 {
279                         return new SqlInt64 (~(x.Value));
280                 }
281
282                 public static SqlInt64 operator - (SqlInt64 x, SqlInt64 y)
283                 {
284                         return new SqlInt64 (x.Value - y.Value);
285                 }
286
287                 public static SqlInt64 operator - (SqlInt64 n)
288                 {
289                         return new SqlInt64 (-(n.Value));
290                 }
291
292                 public static explicit operator SqlInt64 (SqlBoolean x)
293                 {
294                         if (x.IsNull) 
295                                 return SqlInt64.Null;
296                         else
297                                 return new SqlInt64 ((long)x.ByteValue);
298                 }
299
300                 public static explicit operator SqlInt64 (SqlDecimal x)
301                 {
302                         if (x.IsNull) 
303                                 return SqlInt64.Null;
304                         else
305                                 return new SqlInt64 ((long)x.Value);
306                 }
307
308                 public static explicit operator SqlInt64 (SqlDouble x)
309                 {
310                         if (x.IsNull) 
311                                 return SqlInt64.Null;
312                         else
313                                 return new SqlInt64 ((long)x.Value);
314                 }
315
316                 public static explicit operator long (SqlInt64 x)
317                 {
318                         return x.Value;
319                 }
320
321                 public static explicit operator SqlInt64 (SqlMoney x)
322                 {
323                         if (x.IsNull) 
324                                 return SqlInt64.Null;
325                         else
326                                 return new SqlInt64 ((long)x.Value);
327                 }
328
329                 public static explicit operator SqlInt64 (SqlSingle x)
330                 {
331                         if (x.IsNull) 
332                                 return SqlInt64.Null;
333                         else
334                                 return new SqlInt64 ((long)x.Value);
335                 }
336
337                 [MonoTODO]
338                 public static explicit operator SqlInt64 (SqlString x)
339                 {
340                         throw new NotImplementedException ();
341                 }
342
343                 public static explicit operator SqlInt64 (long x)
344                 {
345                         return new SqlInt64 (x);
346                 }
347
348                 public static explicit operator SqlInt64 (SqlByte x)
349                 {
350                         if (x.IsNull) 
351                                 return SqlInt64.Null;
352                         else
353                                 return new SqlInt64 ((long)x.Value);
354                 }
355
356                 public static explicit operator SqlInt64 (SqlInt16 x)
357                 {
358                         if (x.IsNull) 
359                                 return SqlInt64.Null;
360                         else
361                                 return new SqlInt64 ((long)x.Value);
362                 }
363
364                 public static explicit operator SqlInt64 (SqlInt32 x)
365                 {
366                         if (x.IsNull) 
367                                 return SqlInt64.Null;
368                         else
369                                 return new SqlInt64 ((long)x.Value);
370                 }
371
372                 #endregion
373         }
374 }
375