Browse Source

Removed redundant paragraphs and spaces when printing C# XML comments.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/778/head
Dimitar Dobrev 9 years ago
parent
commit
f809dbf2d4
  1. 12
      src/CppParser/Bindings/CLI/CppParser.h
  2. 4
      src/Generator.Tests/AST/TestAST.cs
  3. 27
      src/Generator/Generators/CSharp/CSharpCommentPrinter.cs

12
src/CppParser/Bindings/CLI/CppParser.h

@ -38,17 +38,17 @@ namespace CppSharp @@ -38,17 +38,17 @@ namespace CppSharp
{
public enum struct LanguageVersion
{
/// <summary> The C programming language. </summary>
/// <summary>The C programming language.</summary>
C = 0,
/// <summary> The C programming language (GNU version). </summary>
/// <summary>The C programming language (GNU version).</summary>
GNUC = 1,
/// <summary> The C++ programming language year 1998; supports deprecated constructs. </summary>
/// <summary>The C++ programming language year 1998; supports deprecated constructs.</summary>
CPlusPlus98 = 2,
/// <summary> The C++ programming language year 1998; supports deprecated constructs (GNU version). </summary>
/// <summary>The C++ programming language year 1998; supports deprecated constructs (GNU version).</summary>
GNUPlusPlus98 = 3,
/// <summary> The C++ programming language year 2011. </summary>
/// <summary>The C++ programming language year 2011.</summary>
CPlusPlus11 = 4,
/// <summary> The C++ programming language year 2011 (GNU version). </summary>
/// <summary>The C++ programming language year 2011 (GNU version).</summary>
GNUPlusPlus11 = 5
};

4
src/Generator.Tests/AST/TestAST.cs

@ -400,9 +400,7 @@ namespace CppSharp.Generator.Tests.AST @@ -400,9 +400,7 @@ namespace CppSharp.Generator.Tests.AST
// <para>terminal, so this function allows GUI programs to emulate this</para>
// <para>functionality.</para>
// </remarks>
// <param name=""ch"">
// <para>The character that was typed along with the control key</para>
// </param>
// <param name=""ch"">The character that was typed along with the control key</param>
// <returns>
// <para>The string that should be written into the file handle that is</para>
// <para>feeding the input stream for the debugger, or NULL if there is</para>

27
src/Generator/Generators/CSharp/CSharpCommentPrinter.cs

@ -123,17 +123,22 @@ namespace CppSharp.Generators.CSharp @@ -123,17 +123,22 @@ namespace CppSharp.Generators.CSharp
foreach (var section in sections.Where(s => s.Lines.Count > 0))
{
var tag = section.Type.ToString().ToLowerInvariant();
commentBuilder.AppendFormat("{0} <{1}{2}>", commentPrefix,
tag + (section.Attributes.Count == 0 ? string.Empty : " "),
string.Join(" ", section.Attributes));
commentBuilder.AppendLine();
foreach (var line in section.Lines)
var attributes = string.Empty;
if (section.Attributes.Any())
attributes = ' ' + string.Join(" ", section.Attributes);
commentBuilder.Append($"{commentPrefix} <{tag}{attributes}>");
if (section.Lines.Count == 1)
{
commentBuilder.Append($"{section.Lines[0]}");
}
else
{
commentBuilder.AppendFormat("{0} <para>{1}</para>", commentPrefix, line);
commentBuilder.AppendLine();
foreach (var line in section.Lines)
commentBuilder.AppendLine($"{commentPrefix} <para>{line}</para>");
commentBuilder.Append($"{commentPrefix} ");
}
commentBuilder.AppendFormat("{0} </{1}>", commentPrefix, tag);
commentBuilder.AppendLine();
commentBuilder.AppendLine($"</{tag}>");
}
if (commentBuilder.Length > 0)
{
@ -148,15 +153,13 @@ namespace CppSharp.Generators.CSharp @@ -148,15 +153,13 @@ namespace CppSharp.Generators.CSharp
public Section(CommentElement type)
{
Type = type;
Attributes = new List<string>();
Lines = new List<string>();
}
public CommentElement Type { get; set; }
public List<string> Attributes { get; set; }
public List<string> Attributes { get; } = new List<string>();
public List<string> Lines { get; private set; }
public List<string> Lines { get; } = new List<string>();
}
private enum CommentElement

Loading…
Cancel
Save