Made IsFlagsCollection read-write
The decision whether an Enum is a flags collection is now made either by the spec reader or the enum processor (not the Enum class itself.)
This commit is contained in:
parent
2444ccf082
commit
97ca64121c
3 changed files with 13 additions and 8 deletions
|
@ -23,13 +23,7 @@ namespace Bind.Structures
|
|||
// 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
|
||||
|
@ -95,6 +89,11 @@ namespace Bind.Structures
|
|||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public void Add(Constant constant)
|
||||
{
|
||||
ConstantCollection.Add(constant.Name, constant);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -157,9 +157,16 @@ namespace Bind
|
|||
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;
|
||||
|
|
|
@ -50653,7 +50653,6 @@ namespace OpenTK.Graphics.OpenGL
|
|||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum SgisTextureColorMask : int
|
||||
{
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue