Made IsFlagsCollection read-write
authorStefanos A. <stapostol@gmail.com>
Sun, 27 Oct 2013 16:35:36 +0000 (17:35 +0100)
committerStefanos A. <stapostol@gmail.com>
Sun, 27 Oct 2013 16:35:36 +0000 (17:35 +0100)
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.)

Source/Bind/Structures/Enum.cs
Source/Bind/XmlSpecReader.cs
Source/OpenTK/Graphics/OpenGL/GLEnums.cs

index 51b1baa67626b71a7eddc02f7b5051c800cbb81a..8e553d2f429090f76998088534b908255e255ea4 100644 (file)
@@ -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
index 97adc7e4094fed1973a72548c101ce0146dd65eb..4e462fd09776cff89128754d1d0d2003353cd971 100644 (file)
@@ -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;
index 3a3607a0eca7c944e713aa857b697c204df280d8..af47df150f393b95af163700b83728109ac8762c 100644 (file)
@@ -50653,7 +50653,6 @@ namespace OpenTK.Graphics.OpenGL
     /// <summary>
     /// Not used directly.
     /// </summary>
-    [Flags]
     public enum SgisTextureColorMask : int
     {
         /// <summary>