Browse Source

Fixed the documentation comments support in the generators to use the new comment APIs.

pull/22/merge
triton 12 years ago
parent
commit
2b3a8f79e4
  1. 3
      src/AST/Declaration.cs
  2. 12
      src/Generator/Generators/CLI/CLIHeadersTemplate.cs
  3. 12
      src/Generator/Generators/CLI/CLISourcesTemplate.cs
  4. 15
      src/Generator/Generators/CLI/CLITextTemplate.cs
  5. 5
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

3
src/AST/Declaration.cs

@ -94,9 +94,6 @@ namespace CppSharp.AST @@ -94,9 +94,6 @@ namespace CppSharp.AST
// Comment associated with declaration.
public RawComment Comment;
// Doxygen-style brief comment.
public string BriefComment;
// Keeps flags to know the type of ignore.
public IgnoreFlags IgnoreFlags { get; set; }

12
src/Generator/Generators/CLI/CLIHeadersTemplate.cs

@ -177,12 +177,6 @@ namespace CppSharp.Generators.CLI @@ -177,12 +177,6 @@ namespace CppSharp.Generators.CLI
PopBlock(NewLineKind.BeforeNextBlock);
}
public void GenerateDeclarationCommon(Declaration T)
{
GenerateSummary(T.BriefComment);
GenerateDebug(T);
}
public void GenerateClass(Class @class)
{
if (@class.Ignore || @class.IsIncomplete)
@ -589,12 +583,6 @@ namespace CppSharp.Generators.CLI @@ -589,12 +583,6 @@ namespace CppSharp.Generators.CLI
PopBlock();
}
public void GenerateDebug(Declaration decl)
{
if (Options.OutputDebug && !String.IsNullOrWhiteSpace(decl.DebugText))
WriteLine("// DEBUG: " + decl.DebugText);
}
public void GenerateEnum(Enumeration @enum)
{
if (@enum.Ignore || @enum.IsIncomplete)

12
src/Generator/Generators/CLI/CLISourcesTemplate.cs

@ -108,12 +108,6 @@ namespace CppSharp.Generators.CLI @@ -108,12 +108,6 @@ namespace CppSharp.Generators.CLI
PopBlock();
}
public void GenerateDeclarationCommon(Declaration decl)
{
if (!string.IsNullOrWhiteSpace(decl.BriefComment))
WriteLine("// {0}", decl.BriefComment);
}
public void GenerateClass(Class @class)
{
PushBlock(CLIBlockKind.Class);
@ -897,12 +891,6 @@ namespace CppSharp.Generators.CLI @@ -897,12 +891,6 @@ namespace CppSharp.Generators.CLI
Write(string.Join(", ", names));
}
public void GenerateDebug(Declaration decl)
{
if (Options.OutputDebug && !String.IsNullOrWhiteSpace(decl.DebugText))
WriteLine("// DEBUG: " + decl.DebugText);
}
public override string FileExtension { get { return "cpp"; } }
}
}

15
src/Generator/Generators/CLI/CLITextTemplate.cs

@ -76,6 +76,15 @@ namespace CppSharp.Generators.CLI @@ -76,6 +76,15 @@ namespace CppSharp.Generators.CLI
return string.Format("{0}", decl.QualifiedName);
}
public void GenerateDeclarationCommon(Declaration decl)
{
if (decl.Comment == null)
return;
GenerateSummary(decl.Comment.BriefText);
GenerateDebug(decl);
}
public void GenerateSummary(string comment)
{
if (string.IsNullOrWhiteSpace(comment))
@ -98,6 +107,12 @@ namespace CppSharp.Generators.CLI @@ -98,6 +107,12 @@ namespace CppSharp.Generators.CLI
PopBlock();
}
public void GenerateDebug(Declaration decl)
{
if (Options.OutputDebug && !String.IsNullOrWhiteSpace(decl.DebugText))
WriteLine("// DEBUG: " + decl.DebugText);
}
public void GenerateMethodParameters(Method method)
{
for (var i = 0; i < method.Parameters.Count; ++i)

5
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -262,7 +262,10 @@ namespace CppSharp.Generators.CSharp @@ -262,7 +262,10 @@ namespace CppSharp.Generators.CSharp
public void GenerateDeclarationCommon(Declaration decl)
{
GenerateSummary(decl.BriefComment);
if (decl.Comment == null)
return;
GenerateSummary(decl.Comment.BriefText);
GenerateDebug(decl);
}

Loading…
Cancel
Save