Added support for obsolete attribute

Functions marked with the obsolete attribute will now add [Obsolete] to
the generated output.
This commit is contained in:
Stefanos A 2013-11-14 13:46:42 +01:00
parent b975eccd45
commit 11070bb52a
4 changed files with 14 additions and 1 deletions

View file

@ -341,7 +341,11 @@ namespace Bind
{ {
CreateBody(f, enums); CreateBody(f, enums);
if (f.Deprecated && Settings.IsEnabled(Settings.Legacy.AddDeprecationWarnings)) if (!String.IsNullOrEmpty(f.Obsolete))
{
sw.WriteLine("[Obsolete(\"{0}\")]", f.Obsolete);
}
else if (f.Deprecated && Settings.IsEnabled(Settings.Legacy.AddDeprecationWarnings))
{ {
sw.WriteLine("[Obsolete(\"Deprecated in OpenGL {0}\")]", f.DeprecatedVersion); sw.WriteLine("[Obsolete(\"Deprecated in OpenGL {0}\")]", f.DeprecatedVersion);
} }

View file

@ -640,6 +640,12 @@ namespace Bind
{ {
Debug.Print("Profile override not yet implemented"); Debug.Print("Profile override not yet implemented");
} }
var obsolete = function_override.GetAttribute("obsolete", String.Empty);
if (!String.IsNullOrEmpty(obsolete))
{
d.Obsolete = obsolete;
}
} }
} }

View file

@ -52,6 +52,7 @@ namespace Bind.Structures
Deprecated = d.Deprecated; Deprecated = d.Deprecated;
DeprecatedVersion = d.DeprecatedVersion; DeprecatedVersion = d.DeprecatedVersion;
EntryPoint = d.EntryPoint; EntryPoint = d.EntryPoint;
Obsolete = d.Obsolete;
} }
#endregion #endregion
@ -239,6 +240,7 @@ namespace Bind.Structures
public bool Deprecated { get; set; } public bool Deprecated { get; set; }
public string DeprecatedVersion { get; set; } public string DeprecatedVersion { get; set; }
public string EntryPoint { get; set; } public string EntryPoint { get; set; }
public string Obsolete { get; set; }
#endregion #endregion

View file

@ -281,6 +281,7 @@ namespace Bind
DeprecatedVersion = node.GetAttribute("deprecated", String.Empty).Trim(), DeprecatedVersion = node.GetAttribute("deprecated", String.Empty).Trim(),
Deprecated = !String.IsNullOrEmpty(node.GetAttribute("deprecated", String.Empty)), Deprecated = !String.IsNullOrEmpty(node.GetAttribute("deprecated", String.Empty)),
Extension = node.GetAttribute("extension", String.Empty).Trim() ?? "Core", Extension = node.GetAttribute("extension", String.Empty).Trim() ?? "Core",
Obsolete = node.GetAttribute("obsolete", String.Empty).Trim()
}; };
if (!extensions.Contains(d.Extension)) if (!extensions.Contains(d.Extension))
extensions.Add(d.Extension); extensions.Add(d.Extension);