changeset 220:ba054b4a1c55

ImportData for loading compile time images
author Frank Benoit <benoit@tionex.de>
date Wed, 09 Apr 2008 16:46:02 +0200
parents 9b4e6fc63930
children dc5328912f3d
files dwt/dwthelper/utils.d
diffstat 1 files changed, 33 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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