Mercurial > projects > dwt-win
view dwt/dwthelper/Integer.d @ 0:5406a8f6526d
Add initial files
author | John Reimer <terminal.node@gmail.com |
---|---|
date | Sun, 20 Jan 2008 21:50:55 -0800 |
parents | |
children | 1bea9f0c6f63 |
line wrap: on
line source
/** * Authors: Frank Benoit <keinfarbton@googlemail.com> */ module dwt.dwthelper.Integer; import dwt.dwthelper.utils; static import tango.text.convert.Integer; public final class Integer { public static int MIN_VALUE = 0x80000000; public static int MAX_VALUE = 0x7fffffff; public static int SIZE = 32; public int value; public this ( int value ){ this.value = value; } public this ( char[] s ){ } public static char[] toString( int i, int radix ){ switch( radix ){ case 2: return toBinaryString(i); case 8: return toOctalString(i); case 10: return toString(i); case 16: return toHexString(i); default: implMissing( __FILE__, __LINE__ ); return null; } } public static char[] toHexString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); } public static char[] toOctalString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); } public static char[] toBinaryString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); } public static char[] toString( int i ){ return tango.text.convert.Integer.toString(i); } public static int parseInt( char[] s, int radix ){ return tango.text.convert.Integer.parse( s, cast(uint)radix ); } public static int parseInt( char[] s ){ return tango.text.convert.Integer.parse( s ); } public static Integer valueOf( char[] s, int radix ){ implMissing( __FILE__, __LINE__ ); return null; } public static Integer valueOf( char[] s ){ implMissing( __FILE__, __LINE__ ); return null; } public static Integer valueOf( int i ){ implMissing( __FILE__, __LINE__ ); return null; } public byte byteValue(){ return cast(byte)value; } public short shortValue(){ return cast(short)value; } public int intValue(){ return value; } public long longValue(){ return cast(long)value; } public float floatValue(){ return cast(float)value; } public double doubleValue(){ return cast(double)value; } public override hash_t toHash(){ return intValue(); } public override int opEquals( Object obj ){ implMissing( __FILE__, __LINE__ ); return false; } public override char[] toString(){ return tango.text.convert.Integer.toString( value ); } }