@@ -20,25 +20,32 @@ public class GeneratorKind : IEquatable<GeneratorKind>
20
20
21
21
public string ID { get ; }
22
22
public string Name { get ; }
23
- public System . Type Type { get ; }
23
+ public System . Type GeneratorType { get ; }
24
+ public System . Type TypePrinterType { get ; }
24
25
public string [ ] CLIOptions { get ; }
25
26
26
- public GeneratorKind ( string id , string name , System . Type type , string [ ] cLIOptions = null )
27
+ public GeneratorKind ( string id , string name , System . Type generatorType , System . Type typePrinterType , string [ ] cLIOptions = null )
27
28
{
28
29
if ( Registered . Any ( kind => kind . ID == id ) )
29
30
{
30
31
throw new Exception ( $ "GeneratorKind has an already registered ID: { ID } ") ;
31
32
}
32
33
ID = id ;
33
34
Name = name ;
34
- Type = type ;
35
+ GeneratorType = generatorType ;
36
+ TypePrinterType = typePrinterType ;
35
37
CLIOptions = cLIOptions ;
36
38
Registered . Add ( this ) ;
37
39
}
38
40
39
41
public Generator CreateGenerator ( BindingContext context )
40
42
{
41
- return ( Generator ) Activator . CreateInstance ( Type , context ) ;
43
+ return ( Generator ) Activator . CreateInstance ( GeneratorType , context ) ;
44
+ }
45
+
46
+ public TypePrinter CreateTypePrinter ( BindingContext context )
47
+ {
48
+ return ( TypePrinter ) Activator . CreateInstance ( TypePrinterType , context ) ;
42
49
}
43
50
44
51
public bool IsCLIOptionMatch ( string cliOption )
@@ -93,37 +100,44 @@ public override int GetHashCode()
93
100
}
94
101
95
102
public const string CLI_ID = "CLI" ;
96
- public static readonly GeneratorKind CLI = new ( CLI_ID , "C++/CLI" , typeof ( CLIGenerator ) , new [ ] { "cli" } ) ;
103
+ public static readonly GeneratorKind CLI = new ( CLI_ID , "C++/CLI" , typeof ( CLIGenerator ) , typeof ( CLITypePrinter ) , new [ ] { "cli" } ) ;
97
104
98
105
public const string CSharp_ID = "CSharp" ;
99
- public static readonly GeneratorKind CSharp = new ( CSharp_ID , "C#" , typeof ( CSharpGenerator ) , new [ ] { "csharp" } ) ;
106
+ public static readonly GeneratorKind CSharp = new ( CSharp_ID , "C#" , typeof ( CSharpGenerator ) , typeof ( CSharpTypePrinter ) , new [ ] { "csharp" } ) ;
100
107
101
108
public const string C_ID = "C" ;
102
- public static readonly GeneratorKind C = new ( C_ID , "C" , typeof ( CGenerator ) , new [ ] { "c" } ) ;
109
+ public static readonly GeneratorKind C = new ( C_ID , "C" , typeof ( CGenerator ) , typeof ( CppTypePrinter ) , new [ ] { "c" } ) ;
103
110
104
111
public const string CPlusPlus_ID = "CPlusPlus" ;
105
- public static readonly GeneratorKind CPlusPlus = new ( CPlusPlus_ID , "CPlusPlus" , typeof ( CppGenerator ) , new [ ] { "cpp" } ) ;
112
+ public static readonly GeneratorKind CPlusPlus = new ( CPlusPlus_ID , "CPlusPlus" , typeof ( CppGenerator ) , typeof ( CppTypePrinter ) , new [ ] { "cpp" } ) ;
106
113
107
114
public const string Emscripten_ID = "Emscripten" ;
108
- public static readonly GeneratorKind Emscripten = new ( Emscripten_ID , "Emscripten" , typeof ( EmscriptenGenerator ) , new [ ] { "emscripten" } ) ;
115
+ public static readonly GeneratorKind Emscripten = new ( Emscripten_ID , "Emscripten" , typeof ( EmscriptenGenerator ) , typeof ( EmscriptenTypePrinter ) , new [ ] { "emscripten" } ) ;
109
116
110
117
public const string ObjectiveC_ID = "ObjectiveC" ;
111
- public static readonly GeneratorKind ObjectiveC = new ( ObjectiveC_ID , "ObjectiveC" , typeof ( NotImplementedGenerator ) ) ;
118
+ public static readonly GeneratorKind ObjectiveC = new ( ObjectiveC_ID , "ObjectiveC" , typeof ( NotImplementedGenerator ) , typeof ( NotImplementedTypePrinter ) ) ;
112
119
113
120
public const string Java_ID = "Java" ;
114
- public static readonly GeneratorKind Java = new ( Java_ID , "Java" , typeof ( NotImplementedGenerator ) ) ;
121
+ public static readonly GeneratorKind Java = new ( Java_ID , "Java" , typeof ( NotImplementedGenerator ) , typeof ( NotImplementedTypePrinter ) ) ;
115
122
116
123
public const string Swift_ID = "Swift" ;
117
- public static readonly GeneratorKind Swift = new ( Swift_ID , "Swift" , typeof ( NotImplementedGenerator ) ) ;
124
+ public static readonly GeneratorKind Swift = new ( Swift_ID , "Swift" , typeof ( NotImplementedGenerator ) , typeof ( NotImplementedTypePrinter ) ) ;
118
125
119
126
public const string QuickJS_ID = "QuickJS" ;
120
- public static readonly GeneratorKind QuickJS = new ( QuickJS_ID , "QuickJS" , typeof ( QuickJSGenerator ) , new [ ] { "qjs" } ) ;
127
+ public static readonly GeneratorKind QuickJS = new ( QuickJS_ID , "QuickJS" , typeof ( QuickJSGenerator ) , typeof ( QuickJSTypePrinter ) , new [ ] { "qjs" } ) ;
121
128
122
129
public const string NAPI_ID = "NAPI" ;
123
- public static readonly GeneratorKind NAPI = new ( NAPI_ID , "N-API" , typeof ( NAPIGenerator ) , new [ ] { "napi" } ) ;
130
+ public static readonly GeneratorKind NAPI = new ( NAPI_ID , "N-API" , typeof ( NAPIGenerator ) , typeof ( NAPITypePrinter ) , new [ ] { "napi" } ) ;
124
131
125
132
public const string TypeScript_ID = "TypeScript" ;
126
- public static readonly GeneratorKind TypeScript = new ( TypeScript_ID , "TypeScript" , typeof ( TSGenerator ) , new [ ] { "ts" , "typescript" } ) ;
133
+ public static readonly GeneratorKind TypeScript = new ( TypeScript_ID , "TypeScript" , typeof ( TSGenerator ) , typeof ( TSTypePrinter ) , new [ ] { "ts" , "typescript" } ) ;
134
+ }
135
+
136
+ public class NotImplementedTypePrinter : TypePrinter
137
+ {
138
+ public NotImplementedTypePrinter ( BindingContext context ) : base ( context )
139
+ {
140
+ }
127
141
}
128
142
129
143
public class NotImplementedGenerator : Generator
@@ -142,10 +156,5 @@ public override bool SetupPasses()
142
156
{
143
157
throw new NotImplementedException ( ) ;
144
158
}
145
-
146
- protected override string TypePrinterDelegate ( CppSharp . AST . Type type )
147
- {
148
- throw new NotImplementedException ( ) ;
149
- }
150
159
}
151
160
}
0 commit comments