Avoid singletons; improved ToString()

This is part of a long-due series of source cleanup patches. ToString()
is no longer used for code generation (this is handled by an ISpecWriter
implementation). This class is no longer public.
This commit is contained in:
Stefanos A. 2013-11-01 09:18:53 +01:00
parent 679afcc27a
commit 229856abba

View file

@ -17,7 +17,7 @@ namespace Bind.Structures
/// can be retrieved or set. The value can be either a number, another constant
/// or an alias to a constant
/// </summary>
public class Constant : IComparable<Constant>
class Constant : IComparable<Constant>
{
static StringBuilder translator = new StringBuilder();
@ -194,23 +194,16 @@ namespace Bind.Structures
return true;
}
#region public override string ToString()
#region ToString
/// <summary>
/// Returns a string that represents the full constant declaration without decorations
/// (eg GL_XXX_YYY = (int)0xDEADBEEF or GL_XXX_YYY = GL_ZZZ.FOOBAR).
/// </summary>
/// <returns></returns>
[Obsolete("This belongs to the language-specific ISpecWriter implementations.")]
public override string ToString()
{
if (String.IsNullOrEmpty(Name))
return "";
return String.Format("{0} = {1}((int){2}{3})",
Name, Unchecked ? "unchecked" : "",
!String.IsNullOrEmpty(Reference) ? Reference + Settings.NamespaceSeparator : "", Value);
//return String.Format("{0} = {1}((int){2})", Name, Unchecked ? "unchecked" : "", Value);
return
String.Format("{0} = {1}((int){2}{3})",
Name,
Unchecked ? "unchecked" : String.Empty,
!String.IsNullOrEmpty(Reference) ? Reference + "." : String.Empty,
Value);
}
#endregion