2007-07-23 00:15:18 +00:00
|
|
|
#region License
|
|
|
|
//Copyright (c) 2006 Stefanos Apostolopoulos
|
|
|
|
//See license.txt for license info
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
|
2007-08-01 09:27:57 +00:00
|
|
|
namespace Bind.Structures
|
2007-07-23 00:15:18 +00:00
|
|
|
{
|
|
|
|
#region class Enum
|
|
|
|
|
|
|
|
public class Enum
|
|
|
|
{
|
2007-08-01 09:27:57 +00:00
|
|
|
public Enum()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
public Enum(string name)
|
|
|
|
{
|
|
|
|
Name = name;
|
|
|
|
}
|
|
|
|
|
2007-07-23 00:15:18 +00:00
|
|
|
string _name;
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
{
|
|
|
|
get { return _name; }
|
|
|
|
set { _name = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
System.Collections.Hashtable _constant_collection = new System.Collections.Hashtable();
|
|
|
|
|
|
|
|
public System.Collections.Hashtable ConstantCollection
|
|
|
|
{
|
|
|
|
get { return _constant_collection; }
|
|
|
|
set { _constant_collection = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
2007-08-01 09:27:57 +00:00
|
|
|
sb.AppendLine("public enum " + Name);
|
|
|
|
sb.AppendLine("{");
|
2007-07-23 00:15:18 +00:00
|
|
|
foreach (Constant c in ConstantCollection.Values)
|
|
|
|
{
|
2007-08-01 09:27:57 +00:00
|
|
|
sb.Append(" ");
|
|
|
|
sb.Append(c.ToString());
|
|
|
|
sb.AppendLine(",");
|
|
|
|
}
|
|
|
|
sb.AppendLine("}");
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region class EnumCollection
|
|
|
|
|
|
|
|
class EnumCollection : Dictionary<string, Enum>
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
foreach (Bind.Structures.Enum e in this.Values)
|
|
|
|
{
|
|
|
|
sb.AppendLine(e.ToString());
|
2007-07-23 00:15:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
}
|
2007-08-01 09:27:57 +00:00
|
|
|
*/
|
2007-07-23 00:15:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|