Tools and libraries to glue C/C++ APIs to high-level languages
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.
 
 
 
 
 

40 lines
1.0 KiB

using System.Collections.Generic;
using CppSharp.AST;
using CppSharp.Generators.Cpp;
namespace CppSharp.Generators.C
{
/// <summary>
/// C generator responsible for driving the generation of source and
/// header files.
/// </summary>
public class CGenerator : Generator
{
private readonly CppTypePrinter typePrinter;
public CGenerator(BindingContext context) : base(context)
{
typePrinter = new CppTypePrinter(Context);
}
public override List<CodeGenerator> Generate(IEnumerable<TranslationUnit> units)
{
var outputs = new List<CodeGenerator>();
var header = new CppHeaders(Context, units);
outputs.Add(header);
var source = new CppSources(Context, units);
outputs.Add(source);
return outputs;
}
public override bool SetupPasses() => true;
protected override string TypePrinterDelegate(Type type)
{
return type.Visit(typePrinter).ToString();
}
}
}