// (C) Ximian, Inc. http://www.ximian.com
//
+using System.Globalization;
+
namespace System {
-
- public struct UInt64 : ValueType, IComparable, IFormattable {
- public const ulong MinValue = 0;
+
+ [CLSCompliant(false)]
+ public struct UInt64 : IComparable, IFormattable { //, IConvertible {
+ private static Type Type = typeof (ulong);
+
public const ulong MaxValue = 0xffffffffffffffff;
+ public const ulong MinValue = 0;
- ulong value;
+ public ulong value;
public int CompareTo (object v)
{
- if (!(value is System.UInt64))
- throw new ArgumentException ("Value is not a System.UInt64");
+ if (v == null)
+ return 1;
+
+ if (!(v is System.UInt64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.UInt64"));
- return value - (long) v;
+ if (value == (ulong) v)
+ return 0;
+
+ if (value < (ulong) v)
+ return -1;
+
+ return 1;
}
public override bool Equals (object o)
public override int GetHashCode ()
{
- return (value & 0xffffffff) ^ (value >> 32);
- }
-
- public TypeCode GetTypeCode ()
- {
- return TypeCode.UInt64;
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
}
public static ulong Parse (string s)
{
- // TODO: Implement me
- return 0;
+ return Parse (s, NumberStyles.Integer, null);
}
- public static ulong Parse (string s, IFormatProvider)
+ public static ulong Parse (string s, IFormatProvider fp)
{
- // TODO: Implement me
- return 0;
+ return Parse (s, NumberStyles.Integer, fp);
}
- public static ulong Parse (string s, NumberStyles s, fp)
+ public static ulong Parse (string s, NumberStyles style)
{
- // TODO: Implement me
- return 0;
+ return Parse (s, style, null);
}
- public static ulong Parse (string s, NumberStyles s, IFormatProvider fp)
+ public static ulong Parse (string s, NumberStyles style, IFormatProvider fp)
{
// TODO: Implement me
- return 0;
+ throw new NotImplementedException ();
}
public override string ToString ()
{
- // TODO: Implement me
-
- return "";
+ return ToString ("G", null);
}
public string ToString (IFormatProvider fp)
{
- // TODO: Implement me.
- return "";
+ return ToString ("G", fp);
}
public string ToString (string format)
{
- // TODO: Implement me.
- return "";
+ return ToString (format, null);
}
public string ToString (string format, IFormatProvider fp)
{
- // TODO: Implement me.
- return "";
+ string fmt;
+ NumberFormatInfo nfi;
+
+ fmt = (format == null) ? "G" : format;
+
+ if (fp == null)
+ nfi = NumberFormatInfo.CurrentInfo;
+ else {
+ nfi = (NumberFormatInfo) fp.GetFormat (Type);
+
+ if (nfi == null)
+ nfi = NumberFormatInfo.CurrentInfo;
+ }
+
+ return IntegerFormatter.NumberToString (fmt, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.UInt64;
}
}
}