comparison 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
comparison
equal deleted inserted replaced
5:00fb4879d273 6:e640ca67b819
1 using System;
2 using System.Collections.Generic;
3 using System.Runtime.InteropServices;
4
5 namespace VBoxSDK {
6 public class LibraryInfo {
7 public Dictionary<String, EnumInfo> Enums { get; private set; }
8 public Dictionary<String, InterfaceInfo> Interfaces { get; private set; }
9 public LibraryInfo() {
10 Enums = new Dictionary<string, EnumInfo>();
11 Interfaces = new Dictionary<string, InterfaceInfo>();
12 }
13 }
14 public class EnumInfo {
15 public Dictionary<String, Int32> Values { get; private set; }
16 public String Name { get; private set; }
17 public EnumInfo(String name) {
18 Name = name;
19 Values = new Dictionary<string, int>();
20 }
21 }
22 public class InterfaceInfo {
23 public InterfaceInfo Extends { get; private set; }
24 public Guid IID { get; private set; }
25 public String Name { get; private set; }
26 public List<InterfaceMemberInfo> Members { get; private set; }
27 public InterfaceInfo(String name, Guid iid) : this(name, iid, null) { }
28 public InterfaceInfo(String name, Guid iid, InterfaceInfo extends) {
29 Name = name;
30 IID = iid;
31 Extends = extends;
32 Members = new List<InterfaceMemberInfo>();
33 }
34 }
35 public class InterfaceMemberInfo {
36 }
37 public class PropertyInfo : InterfaceMemberInfo {
38 public String Name { get; private set; }
39 public TypeInfo Type { get; private set; }
40 public Boolean Gettable { get; private set; }
41 public Boolean Settable { get; private set; }
42 public PropertyInfo(String name, TypeInfo type, Boolean gettable, Boolean settable) {
43 Name = name;
44 Type = type;
45 Gettable = gettable;
46 Settable = settable;
47 }
48 }
49 public class MethodInfo : InterfaceMemberInfo {
50 public String Name { get; private set; }
51 public TypeInfo ReturnType { get; private set; }
52 public List<MethodParameterInfo> Parameters { get; private set; }
53 public MethodInfo(String name, TypeInfo returnType) {
54 Name = name;
55 ReturnType = returnType;
56 Parameters = new List<MethodParameterInfo>();
57 }
58 }
59 public class MethodParameterInfo {
60 public String Name { get; private set; }
61 public TypeInfo Type { get; private set; }
62 public Boolean Input { get; private set; }
63 public Boolean Reference { get; private set; }
64 public Boolean Output { get; private set; }
65 public MethodParameterInfo(String name, TypeInfo type, Boolean input, Boolean reference, Boolean output) {
66 Name = name;
67 Type = type;
68 Input = input;
69 Reference = reference | output;
70 Output = output;
71 }
72 }
73 public class TypeInfo {
74 public String Name { get; private set; }
75 public TypeInfo(String name) {
76 Name = name;
77 }
78 }
79 public class ValueTypeInfo : TypeInfo {
80 public ValueTypeInfo(String name)
81 : base(name) {
82 }
83 public ValueTypeInfo(Type type)
84 : base(type.Name) {
85 }
86 }
87 public class StringTypeInfo : TypeInfo {
88 public UnmanagedType UnmanagedType { get; set; }
89 public StringTypeInfo(UnmanagedType unmanagedType) : base("String") {
90 UnmanagedType = unmanagedType;
91 }
92 public StringTypeInfo()
93 : this(UnmanagedType.BStr) {
94 }
95 }
96 public class InterfaceTypeInfo : TypeInfo {
97 public InterfaceTypeInfo(String name) : base(name) {
98 }
99 }
100 }