== Auszug aus Mafi (m...@example.org)'s Artikel
Am 07.07.2011 23:23, schrieb nrgyzer:
Hi guys,
I'm trying to read a string from a text file which contains a
value of an enumeration like:
enum MyEnum : string {
Entry_1 = abc,
Entry_2 = def,
Entry_3 = ghi,
}
Stream
Am 07.07.2011 23:23, schrieb nrgyzer:
Hi guys,
I'm trying to read a string from a text file which contains a value of an
enumeration like:
enum MyEnum : string {
Entry_1 = abc,
Entry_2 = def,
Entry_3 = ghi,
}
Stream s = new File(myFile.ext, FileMode.In);
uint len;
s.read(len);
Hi guys,
I'm trying to read a string from a text file which contains a value of an
enumeration like:
enum MyEnum : string {
Entry_1 = abc,
Entry_2 = def,
Entry_3 = ghi,
}
Stream s = new File(myFile.ext, FileMode.In);
uint len;
s.read(len);
string entry = cast(string)
You could generate the if/else-chain, lookup table, etc. via
metaprogramming to save you the typing and code duplication (probably a
foreach over std.traits.EnumMembers will be involved).
David
On 7/7/11 11:23 PM, nrgyzer wrote:
Hi guys,
I'm trying to read a string from a text file which