Browse Source

Extract file preamble generation into CodeGenerator.

pull/761/head
Joao Matos 9 years ago
parent
commit
2ad1f8b001
  1. 14
      src/Generator/Generators/CSharp/CSharpSources.cs
  2. 12
      src/Generator/Generators/CodeGenerator.cs

14
src/Generator/Generators/CSharp/CSharpSources.cs

@ -147,7 +147,7 @@ namespace CppSharp.Generators.CSharp @@ -147,7 +147,7 @@ namespace CppSharp.Generators.CSharp
public override void Process()
{
GenerateHeader();
GenerateFilePreamble();
PushBlock(CSharpBlockKind.Usings);
WriteLine("using System;");
@ -187,18 +187,6 @@ namespace CppSharp.Generators.CSharp @@ -187,18 +187,6 @@ namespace CppSharp.Generators.CSharp
}
}
public void GenerateHeader()
{
PushBlock(BlockKind.Header);
WriteLine("//----------------------------------------------------------------------------");
WriteLine("// <auto-generated>");
WriteLine("// This is autogenerated code by CppSharp.");
WriteLine("// Do not edit this file or all your changes will be lost after re-generation.");
WriteLine("// </auto-generated>");
WriteLine("//----------------------------------------------------------------------------");
PopBlock();
}
public override bool VisitDeclContext(DeclarationContext context)
{
var isNamespace = context is Namespace;

12
src/Generator/Generators/CodeGenerator.cs

@ -40,6 +40,18 @@ namespace CppSharp.Generators @@ -40,6 +40,18 @@ namespace CppSharp.Generators
return base.Generate();
}
public virtual void GenerateFilePreamble()
{
PushBlock(BlockKind.Header);
WriteLine("//----------------------------------------------------------------------------");
WriteLine("// <auto-generated>");
WriteLine("// This is autogenerated code by CppSharp.");
WriteLine("// Do not edit this file or all your changes will be lost after re-generation.");
WriteLine("// </auto-generated>");
WriteLine("//----------------------------------------------------------------------------");
PopBlock();
}
#region Visitor methods
public virtual bool VisitDeclaration(Declaration decl)

Loading…
Cancel
Save