Mercurial > projects > dwt-win
comparison 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 |
comparison
equal
deleted
inserted
replaced
242:32a6819fef61 | 248:d10ff1f47f84 |
---|---|
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) { | |
153 return tango.text.convert.Integer.toString(i, "x" ); | |
154 } | |
155 else{ | |
152 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); | 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) { | |
162 return tango.text.convert.Integer.toString(i, "o" ); | |
163 } | |
164 else{ | |
156 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); | 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) { | |
171 return tango.text.convert.Integer.toString(i, "b" ); | |
172 } | |
173 else{ | |
160 return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); | 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) { | |
654 return tango.text.convert.Integer.toString( | |
655 value, | |
656 radix is 10 ? "d" : | |
657 radix is 8 ? "o" : | |
658 radix is 16 ? "x" : | |
659 "d" ); | |
660 } | |
661 else{ | |
633 return tango.text.convert.Integer.toString( | 662 return tango.text.convert.Integer.toString( |
634 value, | 663 value, |
635 radix is 10 ? tango.text.convert.Integer.Style.Signed : | 664 radix is 10 ? tango.text.convert.Integer.Style.Signed : |
636 radix is 8 ? tango.text.convert.Integer.Style.Octal : | 665 radix is 8 ? tango.text.convert.Integer.Style.Octal : |
637 radix is 16 ? tango.text.convert.Integer.Style.Hex : | 666 radix is 16 ? tango.text.convert.Integer.Style.Hex : |
638 tango.text.convert.Integer.Style.Signed, | 667 tango.text.convert.Integer.Style.Signed, |
639 prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None | 668 prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None |
640 ); | 669 ); |
641 } | 670 } |
671 } | |
642 | 672 |
643 class RuntimeException : Exception { | 673 class RuntimeException : Exception { |
644 this( String e = null){ | 674 this( String e = null){ |
645 super(e); | 675 super(e); |
646 } | 676 } |