Mercurial > projects > dwt-win
diff dwt/dwthelper/ResourceBundle.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | fef1e3b37378 |
children | 8c656d6b7300 |
line wrap: on
line diff
--- a/dwt/dwthelper/ResourceBundle.d Sat Apr 26 10:01:48 2008 +0200 +++ b/dwt/dwthelper/ResourceBundle.d Mon May 05 00:12:38 2008 +0200 @@ -12,10 +12,10 @@ class ResourceBundle { - char[][ char[] ] map; + String[ String ] map; - public this( char[] data ){ - char[] line; + public this( String data ){ + String line; int dataIndex; //tango.io.Stdout.Stdout.formatln( "properties put ..." ); @@ -31,8 +31,8 @@ //tango.io.Stdout.Stdout.formatln( "properties put {}", __LINE__ ); bool linecontinue = false; bool iskeypart = true; - char[] key; - char[] value; + String key; + String value; nextline: while( dataIndex < data.length ){ //tango.io.Stdout.Stdout.formatln( "properties put {} startline", __LINE__ ); @@ -107,35 +107,35 @@ } } - public bool hasString( char[] key ){ + public bool hasString( String key ){ return ( key in map ) !is null; } - public char[] getString( char[] key ){ + public String getString( String key ){ if( auto v = key in map ){ return (*v).dup; } throw new MissingResourceException( "key not found", this.classinfo.name, key ); } - public char[][] getKeys(){ + public String[] getKeys(){ return map.keys; } public static ResourceBundle getBundle( ImportData data ){ - return new ResourceBundle( cast(char[]) data.data ); + return new ResourceBundle( cast(String) data.data ); } - public static ResourceBundle getBundle( char[] name ){ + public static ResourceBundle getBundle( String name ){ try{ scope f = new File(name); - return new ResourceBundle( cast(char[]) f.read() ); + return new ResourceBundle( cast(String) f.read() ); } catch( IOException e){ e.msg ~= " file:" ~ name; throw e; } } - public static ResourceBundle getBundleFromData( char[] data ){ + public static ResourceBundle getBundleFromData( String data ){ return new ResourceBundle( data ); } }