2001-07-24 Derek Holden <dholden@draper.com>
[mono.git] / mcs / class / corlib / System / UInt64.cs
1 //
2 // System.UInt64.cs
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //
7 // (C) Ximian, Inc.  http://www.ximian.com
8 //
9
10 using System.Globalization;
11
12 namespace System {
13         
14         public struct UInt64 : IComparable, IFormattable { //, IConvertible {
15                 public const ulong MaxValue = 0xffffffffffffffff;
16                 public const ulong MinValue = 0;
17                 
18                 public ulong value;
19
20                 public int CompareTo (object v)
21                 {
22                         if (!(v is System.UInt64))
23                                 throw new ArgumentException ("Value is not a System.UInt64");
24
25                         if (value == (ulong) v)
26                                 return 0;
27
28                         if (value < (ulong) v)
29                                 return -1;
30
31                         return 1;
32                 }
33
34                 public override bool Equals (object o)
35                 {
36                         if (!(o is System.UInt64))
37                                 return false;
38
39                         return ((ulong) o) == value;
40                 }
41
42                 public override int GetHashCode ()
43                 {
44                         return (int)(value & 0xffffffff) ^ (int)(value >> 32);
45                 }
46
47                 public static ulong Parse (string s)
48                 {
49                         return Parse (s, NumberStyles.Integer, null);
50                 }
51
52                 public static ulong Parse (string s, IFormatProvider fp)
53                 {
54                         return Parse (s, NumberStyles.Integer, fp);
55                 }
56
57                 public static ulong Parse (string s, NumberStyles style)
58                 {
59                         return Parse (s, style, null);
60                 }
61
62                 public static ulong Parse (string s, NumberStyles style, IFormatProvider fp)
63                 {
64                         // TODO: Implement me
65                         return 0;
66                 }
67
68                 public override string ToString ()
69                 {
70                         return ToString ("G", null);
71                 }
72
73                 public string ToString (IFormatProvider fp)
74                 {
75                         return ToString ("G", fp);
76                 }
77
78                 public string ToString (string format)
79                 {
80                         return ToString (format, null);
81                 }
82
83                 public string ToString (string format, IFormatProvider fp)
84                 {
85                         // TODO: Implement me.
86                         return "";
87                 }
88
89                 // =========== IConvertible Methods =========== //
90
91                 public TypeCode GetTypeCode ()
92                 {
93                         return TypeCode.UInt64;
94                 }
95         }
96 }