|
|
|
@ -1,7 +1,12 @@
@@ -1,7 +1,12 @@
|
|
|
|
|
using CppSharp.AST; |
|
|
|
|
using CppSharp.Generators.C; |
|
|
|
|
using CppSharp.Generators.CLI; |
|
|
|
|
using CppSharp.Generators.Cpp; |
|
|
|
|
using CppSharp.Generators.CSharp; |
|
|
|
|
using CppSharp.Generators.Emscripten; |
|
|
|
|
using CppSharp.Generators.TS; |
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
using CppSharp.AST; |
|
|
|
|
|
|
|
|
|
namespace CppSharp.Generators |
|
|
|
|
{ |
|
|
|
@ -13,15 +18,22 @@ namespace CppSharp.Generators
@@ -13,15 +18,22 @@ namespace CppSharp.Generators
|
|
|
|
|
private static readonly HashSet<string> s_registeredIDSet = new(); |
|
|
|
|
|
|
|
|
|
public string ID { get; } |
|
|
|
|
public System.Type Type { get; } |
|
|
|
|
|
|
|
|
|
public GeneratorKind(string id) |
|
|
|
|
public GeneratorKind(string id, System.Type type) |
|
|
|
|
{ |
|
|
|
|
if (s_registeredIDSet.Contains(id)) |
|
|
|
|
{ |
|
|
|
|
throw new Exception($"GeneratorKind has an already registered ID: {ID}"); |
|
|
|
|
} |
|
|
|
|
ID = id; |
|
|
|
|
s_registeredIDSet.Add(id); |
|
|
|
|
ID = id; |
|
|
|
|
Type = type; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Generator CreateGenerator(BindingContext context) |
|
|
|
|
{ |
|
|
|
|
return (Generator)Activator.CreateInstance(Type, context); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static bool operator ==(GeneratorKind obj1, GeneratorKind obj2) |
|
|
|
@ -67,36 +79,59 @@ namespace CppSharp.Generators
@@ -67,36 +79,59 @@ namespace CppSharp.Generators
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public const string CLI_ID = "CLI"; |
|
|
|
|
public static readonly GeneratorKind CLI = new(CLI_ID); |
|
|
|
|
public static readonly GeneratorKind CLI = new(CLI_ID, typeof(CLIGenerator)); |
|
|
|
|
|
|
|
|
|
public const string CSharp_ID = "CSharp"; |
|
|
|
|
public static readonly GeneratorKind CSharp = new(CSharp_ID); |
|
|
|
|
public static readonly GeneratorKind CSharp = new(CSharp_ID, typeof(CSharpGenerator)); |
|
|
|
|
|
|
|
|
|
public const string C_ID = "C"; |
|
|
|
|
public static readonly GeneratorKind C = new(C_ID); |
|
|
|
|
public static readonly GeneratorKind C = new(C_ID, typeof(CGenerator)); |
|
|
|
|
|
|
|
|
|
public const string CPlusPlus_ID = "CPlusPlus"; |
|
|
|
|
public static readonly GeneratorKind CPlusPlus = new(CPlusPlus_ID); |
|
|
|
|
public static readonly GeneratorKind CPlusPlus = new(CPlusPlus_ID, typeof(CppGenerator)); |
|
|
|
|
|
|
|
|
|
public const string Emscripten_ID = "Emscripten"; |
|
|
|
|
public static readonly GeneratorKind Emscripten = new(Emscripten_ID); |
|
|
|
|
public static readonly GeneratorKind Emscripten = new(Emscripten_ID, typeof(EmscriptenGenerator)); |
|
|
|
|
|
|
|
|
|
public const string ObjectiveC_ID = "ObjectiveC"; |
|
|
|
|
public static readonly GeneratorKind ObjectiveC = new(ObjectiveC_ID); |
|
|
|
|
public static readonly GeneratorKind ObjectiveC = new(ObjectiveC_ID, typeof(NotImplementedGenerator)); |
|
|
|
|
|
|
|
|
|
public const string Java_ID = "Java"; |
|
|
|
|
public static readonly GeneratorKind Java = new(Java_ID); |
|
|
|
|
public static readonly GeneratorKind Java = new(Java_ID, typeof(NotImplementedGenerator)); |
|
|
|
|
|
|
|
|
|
public const string Swift_ID = "Swift"; |
|
|
|
|
public static readonly GeneratorKind Swift = new(Swift_ID); |
|
|
|
|
public static readonly GeneratorKind Swift = new(Swift_ID, typeof(NotImplementedGenerator)); |
|
|
|
|
|
|
|
|
|
public const string QuickJS_ID = "QuickJS"; |
|
|
|
|
public static readonly GeneratorKind QuickJS = new(QuickJS_ID); |
|
|
|
|
public static readonly GeneratorKind QuickJS = new(QuickJS_ID, typeof(QuickJSGenerator)); |
|
|
|
|
|
|
|
|
|
public const string NAPI_ID = "NAPI"; |
|
|
|
|
public static readonly GeneratorKind NAPI = new(NAPI_ID); |
|
|
|
|
public static readonly GeneratorKind NAPI = new(NAPI_ID, typeof(NAPIGenerator)); |
|
|
|
|
|
|
|
|
|
public const string TypeScript_ID = "TypeScript"; |
|
|
|
|
public static readonly GeneratorKind TypeScript = new(TypeScript_ID); |
|
|
|
|
public static readonly GeneratorKind TypeScript = new(TypeScript_ID, typeof(TSGenerator)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public class NotImplementedGenerator : Generator |
|
|
|
|
{ |
|
|
|
|
public NotImplementedGenerator(BindingContext context) : base(context) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override List<CodeGenerator> Generate(IEnumerable<TranslationUnit> units) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override bool SetupPasses() |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected override string TypePrinterDelegate(CppSharp.AST.Type type) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|