Browse Source

Rename CodeGenerator.Templates to Outputs.

pull/729/merge
Joao Matos 9 years ago
parent
commit
04ee2e5b7d
  1. 4
      src/CppParser/ParserGen/ParserGen.cs
  2. 2
      src/Generator/Driver.cs
  3. 8
      src/Generator/Generator.cs
  4. 2
      src/Generator/Passes/InlinesCodeGenerator.cs
  5. 4
      src/Generator/Passes/ObjectOverridesPass.cs
  6. 2
      tests/NamespacesDerived/NamespacesDerived.cs

4
src/CppParser/ParserGen/ParserGen.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -168,7 +168,7 @@ namespace CppSharp
{ {
driver.Generator.OnUnitGenerated += o => driver.Generator.OnUnitGenerated += o =>
{ {
Block firstBlock = o.Templates[0].RootBlock.Blocks[1]; Block firstBlock = o.Outputs[0].RootBlock.Blocks[1];
if (o.TranslationUnit.Module == driver.Options.SystemModule) if (o.TranslationUnit.Module == driver.Options.SystemModule)
{ {
firstBlock.NewLine(); firstBlock.NewLine();

2
src/Generator/Driver.cs

@ -373,7 +373,7 @@ namespace CppSharp
if (Options.GenerateName != null) if (Options.GenerateName != null)
fileBase = Options.GenerateName(output.TranslationUnit); fileBase = Options.GenerateName(output.TranslationUnit);
foreach (var template in output.Templates) foreach (var template in output.Outputs)
{ {
var fileRelativePath = string.Format("{0}.{1}", fileBase, template.FileExtension); var fileRelativePath = string.Format("{0}.{1}", fileBase, template.FileExtension);

8
src/Generator/Generator.cs

@ -31,7 +31,7 @@ namespace CppSharp.Generators
/// <summary> /// <summary>
/// Code generators with generated output. /// Code generators with generated output.
/// </summary> /// </summary>
public List<CodeGenerator> Templates; public List<CodeGenerator> Outputs;
} }
/// <summary> /// <summary>
@ -101,7 +101,7 @@ namespace CppSharp.Generators
var output = new GeneratorOutput var output = new GeneratorOutput
{ {
TranslationUnit = unit, TranslationUnit = unit,
Templates = templates Outputs = templates
}; };
outputs.Add(output); outputs.Add(output);
@ -122,9 +122,9 @@ namespace CppSharp.Generators
FilePath = string.Format("{0}.cs", module.LibraryName), FilePath = string.Format("{0}.cs", module.LibraryName),
Module = module Module = module
}, },
Templates = Generate(module.Units.GetGenerated()) Outputs = Generate(module.Units.GetGenerated())
}; };
output.Templates[0].Process(); output.Outputs[0].Process();
outputs.Add(output); outputs.Add(output);
OnUnitGenerated(output); OnUnitGenerated(output);

2
src/Generator/Passes/InlinesCodeGenerator.cs

@ -7,7 +7,7 @@ using CppSharp.Generators;
namespace CppSharp.Passes namespace CppSharp.Passes
{ {
public class InlinesCodeGenerator : CodeTemplate public class InlinesCodeGenerator : CodeGenerator
{ {
public override string FileExtension => "cpp"; public override string FileExtension => "cpp";

4
src/Generator/Passes/ObjectOverridesPass.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using CppSharp.AST; using CppSharp.AST;
@ -26,7 +26,7 @@ namespace CppSharp
private void OnUnitGenerated(GeneratorOutput output) private void OnUnitGenerated(GeneratorOutput output)
{ {
needsStreamInclude = false; needsStreamInclude = false;
foreach (var template in output.Templates) foreach (var template in output.Outputs)
{ {
foreach (var block in template.FindBlocks(CLIBlockKind.MethodBody)) foreach (var block in template.FindBlocks(CLIBlockKind.MethodBody))
{ {

2
tests/NamespacesDerived/NamespacesDerived.cs

@ -36,7 +36,7 @@ namespace CppSharp.Tests
{ {
driver.Generator.OnUnitGenerated += o => driver.Generator.OnUnitGenerated += o =>
{ {
Block firstBlock = o.Templates[0].RootBlock.Blocks[1]; Block firstBlock = o.Outputs[0].RootBlock.Blocks[1];
firstBlock.WriteLine("using System.Runtime.CompilerServices;"); firstBlock.WriteLine("using System.Runtime.CompilerServices;");
firstBlock.NewLine(); firstBlock.NewLine();
firstBlock.WriteLine("[assembly:InternalsVisibleTo(\"NamespacesDerived.CSharp\")]"); firstBlock.WriteLine("[assembly:InternalsVisibleTo(\"NamespacesDerived.CSharp\")]");

Loading…
Cancel
Save