comparison mde/lookup/Options.d @ 102:ba035eba07b4

Compilation fixes for windows and unittest code.
author Cyborg16@cyborg64-win.lan
date Sat, 22 Nov 2008 20:59:36 +0000
parents 71f0f1f83620
children 42e241e7be3e
comparison
equal deleted inserted replaced
101:71f0f1f83620 102:ba035eba07b4
249 /** Set option symbol of an Options sub-class to val. 249 /** Set option symbol of an Options sub-class to val.
250 * 250 *
251 * Due to the way options are handled generically, string IDs must be used to access the options 251 * Due to the way options are handled generically, string IDs must be used to access the options
252 * via hash-maps, which is a little slower than direct access but necessary since the option 252 * via hash-maps, which is a little slower than direct access but necessary since the option
253 * must be changed in two separate places. */ 253 * must be changed in two separate places. */
254 void set(T) (char[] symbol, T val) { 254 /+deprecated void set(T) (char[] symbol, T val) {
255 static assert (TIsIn!(T,TYPES) && !TIsIn!(T, CTYPES), "Options.set does not support type "~T.stringof); 255 static assert (TIsIn!(T,TYPES) && !TIsIn!(T, CTYPES), "Options.set does not support type "~T.stringof);
256 256
257 changed = true; // something got set (don't bother checking this isn't what it already was) 257 changed = true; // something got set (don't bother checking this isn't what it already was)
258 258
259 try { 259 try {
261 mixin (`optionChanges.`~TName!(T)~`s[symbol] = val;`); 261 mixin (`optionChanges.`~TName!(T)~`s[symbol] = val;`);
262 } catch (ArrayBoundsException) { 262 } catch (ArrayBoundsException) {
263 // log and ignore: 263 // log and ignore:
264 logger.error ("Options.set: invalid symbol"); 264 logger.error ("Options.set: invalid symbol");
265 } 265 }
266 } 266 }+/
267 /+ 267 /+
268 /** Get option symbol of an Options sub-class. 268 /** Get option symbol of an Options sub-class.
269 * 269 *
270 * Using this method to read an option is not necessary, but allows for generic use. */ 270 * Using this method to read an option is not necessary, but allows for generic use. */
271 T get(T) (char[] symbol) { 271 deprecated T get(T) (char[] symbol) {
272 static assert (TIsIn!(T,TYPES), "Options does not support type "~T.stringof); 272 static assert (TIsIn!(T,TYPES), "Options does not support type "~T.stringof);
273 273
274 mixin (`alias opts`~TName!(T)~` optsVars;`); 274 mixin (`alias opts`~TName!(T)~` optsVars;`);
275 275
276 try { 276 try {
280 logger.error ("Options.get: invalid symbol"); 280 logger.error ("Options.get: invalid symbol");
281 } 281 }
282 }+/ 282 }+/
283 283
284 /** List the names of all options of a specific type. */ 284 /** List the names of all options of a specific type. */
285 char[][] list () { 285 deprecated char[][] list () {
286 char[][] ret; 286 char[][] ret;
287 mixin (listMixin!(TYPES)); 287 mixin (listMixin!(TYPES));
288 return ret; 288 return ret;
289 } 289 }
290 290