Mercurial > projects > dwt-win
diff dwt/dwthelper/utils.d @ 250:55591bc3974c
merge
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jul 2008 17:26:06 +0200 |
parents | fd9c62a2998e d10ff1f47f84 |
children | a63e2cd5485e |
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d Sun Jul 06 17:23:35 2008 +0200 +++ b/dwt/dwthelper/utils.d Sun Jul 06 17:26:06 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,15 +644,31 @@ } } +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" + 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 : + radix is 8 ? tango.text.convert.Integer.Style.Octal : + radix is 16 ? tango.text.convert.Integer.Style.Hex : + tango.text.convert.Integer.Style.Signed, + prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None ); } +} class RuntimeException : Exception { this( String e = null){