// Returns true if the enum contains a collection of flags, i.e. 1, 2, 4, 8, ...
public bool IsFlagCollection
{
- get
- {
- // It seems that all flag collections contain "Mask" in their names.
- // This looks like a heuristic, but it holds 100% in practice
- // (checked all enums to make sure).
- return Name.Contains("Mask");
- }
+ get; set;
}
public string Name
return sb.ToString();
}
+
+ public void Add(Constant constant)
+ {
+ ConstantCollection.Add(constant.Name, constant);
+ }
}
#endregion
Name = node.GetAttribute("name", String.Empty),
Type = node.GetAttribute("type", String.Empty)
};
+
if (String.IsNullOrEmpty(e.Name))
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
+
+ // It seems that all flag collections contain "Mask" in their names.
+ // This looks like a heuristic, but it holds 100% in practice
+ // (checked all enums to make sure).
+ e.IsFlagCollection = e.Name.ToLower().Contains("mask");
+
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
Constant c = null;