2001-08-01 Dietmar Maurer <dietmar@ximian.com>
[mono.git] / mcs / class / corlib / System / Int32.cs
1 //
2 // System.Int32.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 Int32 : IComparable, IFormattable { //, IConvertible {
15                 public const int MaxValue = 0x7fffffff;
16                 public const int MinValue = -2147483648;
17                 
18                 public int value;
19
20                 public int CompareTo (object v)
21                 {
22                         if (!(v is System.Int32))
23                                 throw new ArgumentException ("Value is not a System.Int32");
24
25                         return value - (int) v;
26                 }
27
28                 public override bool Equals (object o)
29                 {
30                         if (!(o is System.Int32))
31                                 return false;
32
33                         return ((int) o) == value;
34                 }
35
36                 public override int GetHashCode ()
37                 {
38                         return value;
39                 }
40
41                 public static int Parse (string s)
42                 {
43                         return Parse (s, NumberStyles.Integer, null);
44                 }
45
46                 public static int Parse (string s, IFormatProvider fp)
47                 {
48                         return Parse (s, NumberStyles.Integer, fp);
49                 }
50
51                 public static int Parse (string s, NumberStyles style)
52                 {
53                         return Parse (s, style, null);
54                 }
55                 
56                 public static int Parse (string s, NumberStyles style, IFormatProvider fp)
57                 {
58                         // TODO: Implement me
59                         return 0;
60                 }
61
62                 public override string ToString ()
63                 {
64                         return ToString ("G", null);
65                 }
66
67                 public string ToString (IFormatProvider fp)
68                 {
69                         return ToString ("G", fp);
70                 }
71
72                 public string ToString (string format)
73                 {
74                         return ToString (format, null);
75                 }
76
77                 public string ToString (string format, IFormatProvider fp)
78                 {
79                         // TODO: Implement me.
80                         return "";
81                 }
82
83                 // =========== IConvertible Methods =========== //
84
85                 public TypeCode GetTypeCode ()
86                 {
87                         return TypeCode.Int32;
88                 }
89         }
90 }