mirror of https://github.com/mono/CppSharp.git
c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
949 B
46 lines
949 B
using System; |
|
using System.Linq; |
|
using System.IO; |
|
using System.Reflection; |
|
using System.Collections.Generic; |
|
|
|
using System.CodeDom; |
|
|
|
namespace Mono.VisualC.Code.Atoms { |
|
public class Enumeration : CodeAtom { |
|
|
|
public struct Item { |
|
public string Name; |
|
public int Value; |
|
} |
|
|
|
public string Name { get; set; } |
|
public IList<Item> Items { get; set; } |
|
|
|
public Enumeration (string name) |
|
{ |
|
Name = name; |
|
Items = new List<Item> (); |
|
} |
|
|
|
internal protected override object InsideCodeNamespace (CodeNamespace ns) |
|
{ |
|
var type = new CodeTypeDeclaration (Name) { |
|
TypeAttributes = TypeAttributes.Public, |
|
IsEnum = true |
|
}; |
|
|
|
foreach (Item i in Items) |
|
type.Members.Add (new CodeMemberField (typeof (int), i.Name) { InitExpression = new CodePrimitiveExpression (i.Value) }); |
|
|
|
ns.Types.Add (type); |
|
return type; |
|
} |
|
|
|
public override void Write (TextWriter writer) |
|
{ |
|
throw new NotImplementedException (); |
|
} |
|
} |
|
} |
|
|
|
|