fields members name are cached

This commit is contained in:
Basile Burg 2015-02-04 15:32:00 +01:00
parent bb311ce049
commit 945212f4c9
1 changed files with 8 additions and 1 deletions

View File

@ -54,8 +54,15 @@ private struct TodoItem
* Enumerates the possible fields of _a TODO comment_.
* They must match the published member of the widget-side class TTodoItem.
*/
private enum TodoField {filename, line, text, category, assignee, priority, status}
private static enum TodoField {filename, line, text, category, assignee, priority, status}
private static string[TodoField] fFieldNames;
private string[TodoField] fFields;
static this()
{
foreach(member; EnumMembers!TodoField)
fFieldNames[member] = to!string(member);
}
/**
* Constructs a TODO item with its fields.