annotate dmd/EnumUtils.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.EnumUtils;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 string BringToCurrentScope(alias enumType)()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 string s = "";
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 foreach (i, e; __traits(allMembers, enumType)) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 s ~= "alias " ~ enumType.stringof ~ "." ~ __traits(allMembers, enumType)[i] ~ " " ~ __traits(allMembers, enumType)[i] ~ ";\n";
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 return s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 }