diff dwt/dwthelper/ResourceBundle.d @ 197:184ab53b7785

Changes and fixes for jface
author Frank Benoit <benoit@tionex.de>
date Thu, 10 Apr 2008 11:19:49 +0200
parents 1da8c82b1c84
children fef1e3b37378
line wrap: on
line diff
--- a/dwt/dwthelper/ResourceBundle.d	Mon Apr 07 13:08:57 2008 +0200
+++ b/dwt/dwthelper/ResourceBundle.d	Thu Apr 10 11:19:49 2008 +0200
@@ -6,6 +6,8 @@
 import tango.text.Util;
 import tango.io.Stdout;
 
+import dwt.DWT;
+import dwt.dwthelper.utils;
 
 class ResourceBundle {
 
@@ -34,7 +36,7 @@
         while( dataIndex < data.length ){
             //tango.io.Stdout.Stdout.formatln( "properties put {} startline", __LINE__ );
             readLine();
-            line = line.trim();
+            line = dwt.dwthelper.utils.trim(line);
             if( line.length is 0 ){
                 //tango.io.Stdout.Stdout.formatln( "properties put {} was 0 length", __LINE__ );
                 continue;
@@ -61,6 +63,7 @@
                     case 't': c = '\t'; break;
                     case 'n': c = '\n'; break;
                     case '\\': c = '\\'; break;
+                    case '\"': c = '\"'; break;
                     default: break;
                     }
                 }
@@ -89,11 +92,12 @@
                 }
             }
             if( iskeypart ){
-                //tango.io.Stdout.Stdout.formatln( "dwt.dwthelper.ResourceBundle ctor cannot find '='." );
+                // Cannot find '=' in record
+                DWT.error( __FILE__, __LINE__, DWT.ERROR_INVALID_ARGUMENT );
                 continue;
             }
-            key = key.trim();
-            value = value.trim();
+            key = dwt.dwthelper.utils.trim(key);
+            value = dwt.dwthelper.utils.trim(value);
             //tango.io.Stdout.Stdout.formatln( "properties put {}=>{}", key, value );
 
             map[ key.dup ] = value.dup;
@@ -109,7 +113,11 @@
         if( auto v = key in map ){
             return (*v).dup;
         }
-        return key;
+        throw new MissingResourceException( "key not found", this.classinfo.name, key );
+    }
+
+    public char[][] getKeys(){
+        return map.keys;
     }
 
     public static ResourceBundle getBundle( char[] name ){