PageRenderTime 43ms CodeModel.GetById 34ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/runtime/typeinfo/ti_assocarray.d

http://github.com/wilkie/djehuty
D | 40 lines | 23 code | 10 blank | 7 comment | 2 complexity | b8abe71a6252a80d0fb46e993c5a7a2b MD5 | raw file
 1/*
 2 * ti_associativearray.d
 3 *
 4 * This module implements the TypeInfo for associative arrays.
 5 *
 6 */
 7
 8class TypeInfo_AssociativeArray : TypeInfo {
 9	char[] toString() {
10		return value.toString() ~ "[" ~ key.toString() ~ "]";
11	}
12
13	int opEquals(Object o) {
14		TypeInfo_AssociativeArray c;
15
16		return this is o ||
17				((c = cast(TypeInfo_AssociativeArray)o) !is null &&
18				 this.key == c.key &&
19				 this.value == c.value);
20	}
21
22	// BUG: need to add the rest of the functions
23
24	size_t tsize() {
25		return (char[int]).sizeof;
26	}
27
28	TypeInfo next() {
29		return value;
30	}
31
32	uint flags() {
33		return 1;
34	}
35
36	TypeInfo value;
37	TypeInfo key;
38}
39
40