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.
42 lines
1.2 KiB
42 lines
1.2 KiB
using System.Collections.Generic; |
|
using CppSharp.AST; |
|
|
|
namespace CppSharp.Generators.CLI |
|
{ |
|
/// <summary> |
|
/// C++/CLI generator responsible for driving the generation of |
|
/// source and header files. |
|
/// </summary> |
|
public class CLIGenerator : Generator |
|
{ |
|
private readonly CLITypePrinter typePrinter; |
|
|
|
public CLIGenerator(Driver driver) : base(driver) |
|
{ |
|
typePrinter = new CLITypePrinter(driver); |
|
Type.TypePrinterDelegate += type => type.Visit(typePrinter); |
|
} |
|
|
|
public override List<Template> Generate(TranslationUnit unit) |
|
{ |
|
var outputs = new List<Template>(); |
|
|
|
var header = new CLIHeadersTemplate(Driver, unit); |
|
outputs.Add(header); |
|
|
|
var source = new CLISourcesTemplate(Driver, unit); |
|
outputs.Add(source); |
|
|
|
return outputs; |
|
} |
|
|
|
public override bool SetupPasses() |
|
{ |
|
// Note: The ToString override will only work if this pass runs |
|
// after the MoveOperatorToCallPass. |
|
if (Driver.Options.GenerateObjectOverrides) |
|
Driver.TranslationUnitPasses.AddPass(new ObjectOverridesPass()); |
|
return true; |
|
} |
|
} |
|
} |