comparison dwt/dwthelper/System.d @ 128:07399639c0c8

Added DWT extension to dwt.widgets.MessageBox
author Jacob Carlborg <doob@me.com>
date Sat, 17 Jan 2009 16:26:49 +0100
parents 38807a925e24
children 623ff6db5f1d
comparison
equal deleted inserted replaced
127:8086e7b181a3 128:07399639c0c8
18 18
19 import tango.stdc.locale; 19 import tango.stdc.locale;
20 import tango.stdc.stdlib : exit; 20 import tango.stdc.stdlib : exit;
21 import tango.sys.Environment; 21 import tango.sys.Environment;
22 import tango.time.Clock; 22 import tango.time.Clock;
23
24 import dwt.dwthelper.utils;
25 23
26 template SimpleType(T) { 24 template SimpleType(T) {
27 debug{ 25 debug{
28 static void validCheck(uint SrcLen, uint DestLen, uint copyLen){ 26 static void validCheck(uint SrcLen, uint DestLen, uint copyLen){
29 if(SrcLen < copyLen || DestLen < copyLen|| SrcLen < 0 || DestLen < 0){ 27 if(SrcLen < copyLen || DestLen < copyLen|| SrcLen < 0 || DestLen < 0){
173 return 0; 171 return 0;
174 } 172 }
175 return (*cast(Object *)&x).toHash(); 173 return (*cast(Object *)&x).toHash();
176 } 174 }
177 175
178 public static String getProperty( String key, String defval ){ 176 public static char[] getProperty( char[] key, char[] defval ){
179 String res = getProperty(key); 177 char[] res = getProperty(key);
180 if( res ){ 178 if( res ){
181 return res; 179 return res;
182 } 180 }
183 return defval; 181 return defval;
184 } 182 }
185 183
186 public static String getProperty( String key ){ 184 public static char[] getProperty( char[] key ){
187 /* get values for global system keys (environment) */ 185 /* get values for global system keys (environment) */
188 switch( key ) { 186 switch( key ) {
189 // Ubuntu Gutsy:Environment.get for OSTYPE is not working 187 // Ubuntu Gutsy:Environment.get for OSTYPE is not working
190 // Force default to "linux" for now -JJR 188 // Force default to "linux" for now -JJR
191 case "os.name": 189 case "os.name":
206 return encoding[0..strlen(encoding)].dup; 204 return encoding[0..strlen(encoding)].dup;
207 default: return null; 205 default: return null;
208 } 206 }
209 207
210 /* Get values for local dwt specific keys */ 208 /* Get values for local dwt specific keys */
211 String* p; 209 char[]* p;
212 return ((p = key in localProperties) != null) ? *p : null; 210 return ((p = key in localProperties) != null) ? *p : null;
213 } 211 }
214 212
215 public static void setProperty ( String key, String value ) { 213 public static void setProperty ( char[] key, char[] value ) {
216 /* set property for LOCAL dwt keys */ 214 /* set property for LOCAL dwt keys */
217 if (key !is null && value !is null) 215 if (key !is null && value !is null)
218 localProperties[ key ] = value; 216 localProperties[ key ] = value;
219 } 217 }
220 218
221 static Out out_; 219 static Out out_;
222 static Err err; 220 static Err err;
223 221
224 private static String[String] localProperties; 222 private static char[][char[]] localProperties;
225 } 223 }