Mercurial > projects > ddata
comparison ddata.d @ 1:8e817772ed3d
imports specified
author | Saaa |
---|---|
date | Thu, 10 Sep 2009 01:50:06 +0200 |
parents | 277bc71a8eaa |
children | ee1232043257 |
comparison
equal
deleted
inserted
replaced
0:277bc71a8eaa | 1:8e817772ed3d |
---|---|
1 module ddata.ddata; | 1 module ddata.ddata; |
2 | 2 |
3 import std.stdio; | 3 //debug |
4 //import std.stdio; | |
4 import std.string; | 5 import std.string; |
5 | 6 |
6 import std2.conv; | 7 import std2.conv : to; |
8 import std2.traits : isNumeric; | |
7 | 9 |
8 class DDataException : Exception | 10 class DDataException : Exception |
9 { | 11 { |
10 this(char[] msg) | 12 this(char[] msg) |
11 { | 13 { |
171 index[depth] --; | 173 index[depth] --; |
172 static if( is(BaseType!(T) == bool) ) | 174 static if( is(BaseType!(T) == bool) ) |
173 { | 175 { |
174 indexAssign!(T[])( temp, toBool( string[ sLoc1..sLoc2] ), index); | 176 indexAssign!(T[])( temp, toBool( string[ sLoc1..sLoc2] ), index); |
175 } | 177 } |
176 else static if( std2.traits.isNumeric!( BaseType!(T) ) ) | 178 else static if( isNumeric!( BaseType!(T) ) ) |
177 { | 179 { |
178 indexAssign!(T[])( temp, to!( BaseType!(T) )( string[ sLoc1..sLoc2] ), index); | 180 indexAssign!(T[])( temp, to!( BaseType!(T) )( string[ sLoc1..sLoc2] ), index); |
179 } | 181 } |
180 else | 182 else |
181 { | 183 { |
209 { | 211 { |
210 static if( is(BaseType!(T) == bool) ) | 212 static if( is(BaseType!(T) == bool) ) |
211 { | 213 { |
212 indexAssign!(T[])( temp, toBool( string[ sLoc1..sLoc2]), index); | 214 indexAssign!(T[])( temp, toBool( string[ sLoc1..sLoc2]), index); |
213 } | 215 } |
214 else static if( std2.traits.isNumeric!( BaseType!(T) ) ) | 216 else static if( isNumeric!( BaseType!(T) ) ) |
215 { | 217 { |
216 indexAssign!(T[])( temp, to!( BaseType!(T) )(string[ sLoc1..sLoc2]), index); | 218 indexAssign!(T[])( temp, to!( BaseType!(T) )(string[ sLoc1..sLoc2]), index); |
217 } | 219 } |
218 else | 220 else |
219 { | 221 { |
262 break; | 264 break; |
263 } | 265 } |
264 } | 266 } |
265 } | 267 } |
266 | 268 |
267 void unittests() { | 269 unittest |
270 { | |
268 writefln("DData UnitTest..."); | 271 writefln("DData UnitTest..."); |
269 | 272 |
270 int[][][] ia = [ [[1,2],[3,4],[5]] , [[6],[],[7,8,9]] , [[]] ]; | 273 int[][][] ia = [ [[1,2],[3,4],[5]] , [[6],[],[7,8,9]] , [[]] ]; |
271 | 274 |
272 char[] s = to!(char[])(ia); | 275 char[] s = to!(char[])(ia); |