Opentk/Source/OpenGL/Bind/Structures/Constant.cs
the_fiddler 22fa16be89
2006-09-28 22:07:53 +00:00

92 lines
2.2 KiB
C#

/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
/// <summary>
/// Represents an opengl constant in C# format. Both the constant name and value
/// can be retrieved or set. All opengl constants are translated to 'const uint'.
/// </summary>
public class Constant
{
#region Name
string _name;
/// <summary>
/// Gets or sets the name of the opengl constant (eg. GL_LINES).
/// </summary>
public string Name
{
get { return _name; }
set
{
if (!String.IsNullOrEmpty(value))
_name = value.Trim();
}
}
#endregion
#region Value
string _value;
/// <summary>
/// Gets or sets the value of the opengl constant (eg. 0x00000001).
/// </summary>
public string Value
{
get { return _value; }
set
{
if (!String.IsNullOrEmpty(value))
_value = value.Trim();
}
}
#endregion
#region Constructors
/// <summary>
/// Creates an empty Constant.
/// </summary>
public Constant()
{
}
/// <summary>
/// Creates a Constant with the given name and value.
/// </summary>
/// <param name="name">The Name of the Constant.</param>
/// <param name="value">The Type of the Constant.</param>
public Constant(string name, string value)
{
Name = name;
Value = value;
}
#endregion
#region Helper functions
/// <summary>
/// Returns a string that represents the full constant declaration without decorations
/// (eg const uint GL_XXX_YYY = 0xDEADBEEF).
/// </summary>
/// <returns></returns>
new public string ToString()
{
return Name + " = " + Value;
}
#endregion
}
}