Changeset 212:ab60f3309436 for dwt/dwthelper/ResourceBundle.d
- Timestamp:
- 05/04/08 18:12:38 (8 months ago)
- Files:
-
- dwt/dwthelper/ResourceBundle.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/dwthelper/ResourceBundle.d
r200 r212 13 13 class ResourceBundle { 14 14 15 char[][ char[]] map;15 String[ String ] map; 16 16 17 public this( char[]data ){18 char[]line;17 public this( String data ){ 18 String line; 19 19 int dataIndex; 20 20 … … 32 32 bool linecontinue = false; 33 33 bool iskeypart = true; 34 char[]key;35 char[]value;34 String key; 35 String value; 36 36 nextline: 37 37 while( dataIndex < data.length ){ … … 108 108 } 109 109 110 public bool hasString( char[]key ){110 public bool hasString( String key ){ 111 111 return ( key in map ) !is null; 112 112 } 113 113 114 public char[] getString( char[]key ){114 public String getString( String key ){ 115 115 if( auto v = key in map ){ 116 116 return (*v).dup; … … 119 119 } 120 120 121 public char[][] getKeys(){121 public String[] getKeys(){ 122 122 return map.keys; 123 123 } 124 124 125 125 public static ResourceBundle getBundle( ImportData data ){ 126 return new ResourceBundle( cast( char[]) data.data );126 return new ResourceBundle( cast(String) data.data ); 127 127 } 128 public static ResourceBundle getBundle( char[]name ){128 public static ResourceBundle getBundle( String name ){ 129 129 try{ 130 130 scope f = new File(name); 131 return new ResourceBundle( cast( char[]) f.read() );131 return new ResourceBundle( cast(String) f.read() ); 132 132 } 133 133 catch( IOException e){ … … 136 136 } 137 137 } 138 public static ResourceBundle getBundleFromData( char[]data ){138 public static ResourceBundle getBundleFromData( String data ){ 139 139 return new ResourceBundle( data ); 140 140 }
