comparison 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
comparison
equal deleted inserted replaced
249:b3dbd786541a 250:55591bc3974c
8 8
9 public import tango.core.Exception : IllegalArgumentException, IOException; 9 public import tango.core.Exception : IllegalArgumentException, IOException;
10 10
11 import tango.io.Stdout; 11 import tango.io.Stdout;
12 import tango.io.Print; 12 import tango.io.Print;
13 import tango.stdc.stringz; 13 static import tango.stdc.stringz;
14 static import tango.text.Util; 14 static import tango.text.Util;
15 static import tango.text.Text; 15 static import tango.text.Text;
16 import tango.text.Unicode; 16 import tango.text.Unicode;
17 import tango.text.convert.Utf; 17 import tango.text.convert.Utf;
18 import tango.core.Exception; 18 import tango.core.Exception;
147 return null; 147 return null;
148 } 148 }
149 } 149 }
150 150
151 public static String toHexString( int i ){ 151 public static String toHexString( int i ){
152 version(TANGOSVN) {
152 return tango.text.convert.Integer.toString(i, "x" ); 153 return tango.text.convert.Integer.toString(i, "x" );
154 }
155 else{
156 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex );
157 }
153 } 158 }
154 159
155 public static String toOctalString( int i ){ 160 public static String toOctalString( int i ){
161 version(TANGOSVN) {
156 return tango.text.convert.Integer.toString(i, "o" ); 162 return tango.text.convert.Integer.toString(i, "o" );
163 }
164 else{
165 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal );
166 }
157 } 167 }
158 168
159 public static String toBinaryString( int i ){ 169 public static String toBinaryString( int i ){
170 version(TANGOSVN) {
160 return tango.text.convert.Integer.toString(i, "b" ); 171 return tango.text.convert.Integer.toString(i, "b" );
172 }
173 else{
174 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary );
175 }
161 } 176 }
162 177
163 public static String toString( int i ){ 178 public static String toString( int i ){
164 return tango.text.convert.Integer.toString(i); 179 return tango.text.convert.Integer.toString(i);
165 } 180 }
627 static const String nullPtr = "\0"; 642 static const String nullPtr = "\0";
628 return nullPtr.ptr; 643 return nullPtr.ptr;
629 } 644 }
630 } 645 }
631 646
647 public alias tango.stdc.stringz.toStringz toStringz;
648 public alias tango.stdc.stringz.toString16z toString16z;
649 public alias tango.stdc.stringz.fromStringz fromStringz;
650 public alias tango.stdc.stringz.fromString16z fromString16z;
651
632 static String toHex(uint value, bool prefix = true, int radix = 8){ 652 static String toHex(uint value, bool prefix = true, int radix = 8){
653 version(TANGOSVN) {
633 return tango.text.convert.Integer.toString( 654 return tango.text.convert.Integer.toString(
634 value, 655 value,
635 radix is 10 ? "d" : 656 radix is 10 ? "d" :
636 radix is 8 ? "o" : 657 radix is 8 ? "o" :
637 radix is 16 ? "x" : 658 radix is 16 ? "x" :
638 "d" 659 "d" );
660 }
661 else{
662 return tango.text.convert.Integer.toString(
663 value,
664 radix is 10 ? tango.text.convert.Integer.Style.Signed :
665 radix is 8 ? tango.text.convert.Integer.Style.Octal :
666 radix is 16 ? tango.text.convert.Integer.Style.Hex :
667 tango.text.convert.Integer.Style.Signed,
668 prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None
639 ); 669 );
670 }
640 } 671 }
641 672
642 class RuntimeException : Exception { 673 class RuntimeException : Exception {
643 this( String e = null){ 674 this( String e = null){
644 super(e); 675 super(e);