Mercurial > projects > dwt-win
diff dwt/dwthelper/utils.d @ 248:d10ff1f47f84
Add: version TANGOSVN
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jul 2008 16:42:54 +0200 |
parents | ec7da638647f |
children | 55591bc3974c |
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/dwthelper/utils.d Sun Jul 06 16:42:54 2008 +0200 @@ -10,7 +10,7 @@ import tango.io.Stdout; import tango.io.Print; -import tango.stdc.stringz; +static import tango.stdc.stringz; static import tango.text.Util; static import tango.text.Text; import tango.text.Unicode; @@ -149,15 +149,30 @@ } public static String toHexString( int i ){ +version(TANGOSVN) { + return tango.text.convert.Integer.toString(i, "x" ); +} +else{ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); +} } public static String toOctalString( int i ){ +version(TANGOSVN) { + return tango.text.convert.Integer.toString(i, "o" ); +} +else{ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); +} } public static String toBinaryString( int i ){ +version(TANGOSVN) { + return tango.text.convert.Integer.toString(i, "b" ); +} +else{ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); +} } public static String toString( int i ){ @@ -629,7 +644,21 @@ } } +public alias tango.stdc.stringz.toStringz toStringz; +public alias tango.stdc.stringz.toString16z toString16z; +public alias tango.stdc.stringz.fromStringz fromStringz; +public alias tango.stdc.stringz.fromString16z fromString16z; + static String toHex(uint value, bool prefix = true, int radix = 8){ +version(TANGOSVN) { + return tango.text.convert.Integer.toString( + value, + radix is 10 ? "d" : + radix is 8 ? "o" : + radix is 16 ? "x" : + "d" ); +} +else{ return tango.text.convert.Integer.toString( value, radix is 10 ? tango.text.convert.Integer.Style.Signed : @@ -639,6 +668,7 @@ prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None ); } +} class RuntimeException : Exception { this( String e = null){