comparison dwt/dwthelper/utils.d @ 37:642f460a0908

Fixed a lot of compile errors, a "hello world" app compiles now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 10 Oct 2008 12:29:48 +0200
parents db5a898b2119
children 198549365851
comparison
equal deleted inserted replaced
36:db5a898b2119 37:642f460a0908
153 return null; 153 return null;
154 } 154 }
155 } 155 }
156 156
157 public static String toHexString( int i ){ 157 public static String toHexString( int i ){
158 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); 158 return tango.text.convert.Integer.toString(i, "x" );
159 } 159 }
160 160
161 public static String toOctalString( int i ){ 161 public static String toOctalString( int i ){
162 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); 162 return tango.text.convert.Integer.toString(i, "o" );
163 } 163 }
164 164
165 public static String toBinaryString( int i ){ 165 public static String toBinaryString( int i ){
166 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); 166 return tango.text.convert.Integer.toString(i, "b" );
167 } 167 }
168 168
169 public static String toString( int i ){ 169 public static String toString( int i ){
170 return tango.text.convert.Integer.toString(i); 170 return tango.text.convert.Integer.toString(i);
171 } 171 }
662 static const String nullPtr = "\0"; 662 static const String nullPtr = "\0";
663 return nullPtr.ptr; 663 return nullPtr.ptr;
664 } 664 }
665 } 665 }
666 666
667 public String fromStringz (char* str)
668 {
669 return tango.stdc.stringz.fromStringz(str);
670 }
671
667 static String toHex(uint value, bool prefix = true, int radix = 8){ 672 static String toHex(uint value, bool prefix = true, int radix = 8){
668 return tango.text.convert.Integer.toString( 673 return tango.text.convert.Integer.toString(
669 value, 674 value,
670 radix is 10 ? tango.text.convert.Integer.Style.Signed : 675 radix is 10 ? "d" :
671 radix is 8 ? tango.text.convert.Integer.Style.Octal : 676 radix is 8 ? "o" :
672 radix is 16 ? tango.text.convert.Integer.Style.Hex : 677 radix is 16 ? "x" :
673 tango.text.convert.Integer.Style.Signed, 678 "d" );
674 prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None
675 );
676 } 679 }
677 680
678 class RuntimeException : Exception { 681 class RuntimeException : Exception {
679 this( String e = null){ 682 this( String e = null){
680 super(e); 683 super(e);