# HG changeset patch # User Frank Benoit # Date 1207752362 -7200 # Node ID ba054b4a1c55c3ce4c5eef9412276c588c86c7e8 # Parent 9b4e6fc6393093794cfe2749db0b5d6ba8965f5e ImportData for loading compile time images diff -r 9b4e6fc63930 -r ba054b4a1c55 dwt/dwthelper/utils.d --- a/dwt/dwthelper/utils.d Sun Apr 06 22:26:22 2008 +0200 +++ b/dwt/dwthelper/utils.d Wed Apr 09 16:46:02 2008 +0200 @@ -63,6 +63,12 @@ public int opEquals( T other ){ return value == other; } + public int opEquals( Object other ){ + if( auto o = cast(ValueWrapperT!(T))other ){ + return value == o.value; + } + return false; + } } class Boolean : ValueWrapperT!(bool) { @@ -218,11 +224,6 @@ return intValue(); } - public override int opEquals( Object obj ){ - implMissing( __FILE__, __LINE__ ); - return false; - } - public override char[] toString(){ return tango.text.convert.Integer.toString( value ); } @@ -803,13 +804,14 @@ return null; } } +/+++ import dwt.dwthelper.InputStream; InputStream ClassInfoGetResourceAsStream( ClassInfo ci, char[] aName ){ implMissing( __FILE__, __LINE__ ); return null; } - ++++/ void ExceptionPrintStackTrace( Exception e ){ ExceptionPrintStackTrace( e, Stderr ); } @@ -1142,4 +1144,29 @@ return res; } +void PrintStackTrace(){ + try{ + throw new Exception( null ); + } + catch( Exception e ){ + foreach( msg; e.info ){ + Trace.formatln( "trc: {}", msg ); + } + } +} +struct ImportData{ + void[] data; + char[] name; + + public static ImportData opCall( void[] data, char[] name ){ + ImportData res; + res.data = data; + res.name = name; + return res; + } +} + +template getImportData(char[] name ){ + const ImportData getImportData = ImportData( import(name), name ); +} \ No newline at end of file