view InteropCodeGen/LibraryInformation.cs @ 6:e640ca67b819

Added extended COM interop code generator for interfaces and proxies
author Ivo Smits
date Fri, 06 May 2011 04:02:43 +0200
parents
children
line wrap: on
line source

???using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace VBoxSDK {
	public class LibraryInfo {
		public Dictionary<String, EnumInfo> Enums { get; private set; }
		public Dictionary<String, InterfaceInfo> Interfaces { get; private set; }
		public LibraryInfo() {
			Enums = new Dictionary<string, EnumInfo>();
			Interfaces = new Dictionary<string, InterfaceInfo>();
		}
	}
	public class EnumInfo {
		public Dictionary<String, Int32> Values { get; private set; }
		public String Name { get; private set; }
		public EnumInfo(String name) {
			Name = name;
			Values = new Dictionary<string, int>();
		}
	}
	public class InterfaceInfo {
		public InterfaceInfo Extends { get; private set; }
		public Guid IID { get; private set; }
		public String Name { get; private set; }
		public List<InterfaceMemberInfo> Members { get; private set; }
		public InterfaceInfo(String name, Guid iid) : this(name, iid, null) { }
		public InterfaceInfo(String name, Guid iid, InterfaceInfo extends) {
			Name = name;
			IID = iid;
			Extends = extends;
			Members = new List<InterfaceMemberInfo>();
		}
	}
	public class InterfaceMemberInfo {
	}
	public class PropertyInfo : InterfaceMemberInfo {
		public String Name { get; private set; }
		public TypeInfo Type { get; private set; }
		public Boolean Gettable { get; private set; }
		public Boolean Settable { get; private set; }
		public PropertyInfo(String name, TypeInfo type, Boolean gettable, Boolean settable) {
			Name = name;
			Type = type;
			Gettable = gettable;
			Settable = settable;
		}
	}
	public class MethodInfo : InterfaceMemberInfo {
		public String Name { get; private set; }
		public TypeInfo ReturnType { get; private set; }
		public List<MethodParameterInfo> Parameters { get; private set; }
		public MethodInfo(String name, TypeInfo returnType) {
			Name = name;
			ReturnType = returnType;
			Parameters = new List<MethodParameterInfo>();
		}
	}
	public class MethodParameterInfo {
		public String Name { get; private set; }
		public TypeInfo Type { get; private set; }
		public Boolean Input { get; private set; }
		public Boolean Reference { get; private set; }
		public Boolean Output { get; private set; }
		public MethodParameterInfo(String name, TypeInfo type, Boolean input, Boolean reference, Boolean output) {
			Name = name;
			Type = type;
			Input = input;
			Reference = reference | output;
			Output = output;
		}
	}
	public class TypeInfo {
		public String Name { get; private set; }
		public TypeInfo(String name) {
			Name = name;
		}
	}
	public class ValueTypeInfo : TypeInfo {
		public ValueTypeInfo(String name)
			: base(name) {
		}
		public ValueTypeInfo(Type type)
			: base(type.Name) {
		}
	}
	public class StringTypeInfo : TypeInfo {
		public UnmanagedType UnmanagedType { get; set; }
		public StringTypeInfo(UnmanagedType unmanagedType) : base("String") {
			UnmanagedType = unmanagedType;
		}
		public StringTypeInfo()
			: this(UnmanagedType.BStr) {
		}
	}
	public class InterfaceTypeInfo : TypeInfo {
		public InterfaceTypeInfo(String name) : base(name) {
		}
	}
}