Browse Source

Renamed CommentKind to DocumentationCommentKind.

pull/769/head
Joao Matos 9 years ago
parent
commit
b1f7ad6f70
  1. 30
      src/AST/Comment.cs
  2. 28
      src/Generator/Generators/CSharp/CSharpCommentPrinter.cs

30
src/AST/Comment.cs

@ -26,7 +26,7 @@ namespace CppSharp.AST
Merged Merged
} }
public enum CommentKind public enum DocumentationCommentKind
{ {
FullComment, FullComment,
BlockContentComment, BlockContentComment,
@ -123,7 +123,7 @@ namespace CppSharp.AST
/// </summary> /// </summary>
public abstract class Comment public abstract class Comment
{ {
public CommentKind Kind { get; set; } public DocumentationCommentKind Kind { get; set; }
public abstract void Visit<T>(ICommentVisitor<T> visitor); public abstract void Visit<T>(ICommentVisitor<T> visitor);
@ -236,7 +236,7 @@ namespace CppSharp.AST
public BlockCommandComment() public BlockCommandComment()
{ {
Kind = CommentKind.BlockCommandComment; Kind = DocumentationCommentKind.BlockCommandComment;
Arguments = new List<Argument>(); Arguments = new List<Argument>();
} }
@ -256,7 +256,7 @@ namespace CppSharp.AST
public ParamCommandComment() public ParamCommandComment()
{ {
Kind = CommentKind.ParamCommandComment; Kind = DocumentationCommentKind.ParamCommandComment;
} }
public enum PassDirection public enum PassDirection
@ -307,7 +307,7 @@ namespace CppSharp.AST
public TParamCommandComment() public TParamCommandComment()
{ {
Kind = CommentKind.TParamCommandComment; Kind = DocumentationCommentKind.TParamCommandComment;
Position = new List<uint>(); Position = new List<uint>();
} }
@ -328,7 +328,7 @@ namespace CppSharp.AST
public VerbatimBlockComment() public VerbatimBlockComment()
{ {
Kind = CommentKind.VerbatimBlockComment; Kind = DocumentationCommentKind.VerbatimBlockComment;
Lines = new List<VerbatimBlockLineComment>(); Lines = new List<VerbatimBlockLineComment>();
} }
@ -349,7 +349,7 @@ namespace CppSharp.AST
public VerbatimLineComment() public VerbatimLineComment()
{ {
Kind = CommentKind.VerbatimLineComment; Kind = DocumentationCommentKind.VerbatimLineComment;
} }
public override void Visit<T>(ICommentVisitor<T> visitor) public override void Visit<T>(ICommentVisitor<T> visitor)
@ -369,7 +369,7 @@ namespace CppSharp.AST
public ParagraphComment() public ParagraphComment()
{ {
Kind = CommentKind.ParagraphComment; Kind = DocumentationCommentKind.ParagraphComment;
Content = new List<InlineContentComment>(); Content = new List<InlineContentComment>();
} }
@ -386,7 +386,7 @@ namespace CppSharp.AST
{ {
protected InlineContentComment() protected InlineContentComment()
{ {
Kind = CommentKind.InlineContentComment; Kind = DocumentationCommentKind.InlineContentComment;
} }
public bool HasTrailingNewline { get; set; } public bool HasTrailingNewline { get; set; }
@ -403,7 +403,7 @@ namespace CppSharp.AST
protected HTMLTagComment() protected HTMLTagComment()
{ {
Kind = CommentKind.HTMLTagComment; Kind = DocumentationCommentKind.HTMLTagComment;
} }
} }
@ -422,7 +422,7 @@ namespace CppSharp.AST
public HTMLStartTagComment() public HTMLStartTagComment()
{ {
Kind = CommentKind.HTMLStartTagComment; Kind = DocumentationCommentKind.HTMLStartTagComment;
Attributes = new List<Attribute>(); Attributes = new List<Attribute>();
} }
@ -439,7 +439,7 @@ namespace CppSharp.AST
{ {
public HTMLEndTagComment() public HTMLEndTagComment()
{ {
Kind = CommentKind.HTMLEndTagComment; Kind = DocumentationCommentKind.HTMLEndTagComment;
} }
public override void Visit<T>(ICommentVisitor<T> visitor) public override void Visit<T>(ICommentVisitor<T> visitor)
@ -457,7 +457,7 @@ namespace CppSharp.AST
public TextComment() public TextComment()
{ {
Kind = CommentKind.TextComment; Kind = DocumentationCommentKind.TextComment;
} }
public override void Visit<T>(ICommentVisitor<T> visitor) public override void Visit<T>(ICommentVisitor<T> visitor)
@ -497,7 +497,7 @@ namespace CppSharp.AST
public InlineCommandComment() public InlineCommandComment()
{ {
Kind = CommentKind.InlineCommandComment; Kind = DocumentationCommentKind.InlineCommandComment;
Arguments = new List<Argument>(); Arguments = new List<Argument>();
} }
@ -516,7 +516,7 @@ namespace CppSharp.AST
public VerbatimBlockLineComment() public VerbatimBlockLineComment()
{ {
Kind = CommentKind.VerbatimBlockLineComment; Kind = DocumentationCommentKind.VerbatimBlockLineComment;
} }
public override void Visit<T>(ICommentVisitor<T> visitor) public override void Visit<T>(ICommentVisitor<T> visitor)

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

@ -22,12 +22,12 @@ namespace CppSharp.Generators.CSharp
{ {
switch (comment.Kind) switch (comment.Kind)
{ {
case CommentKind.FullComment: case DocumentationCommentKind.FullComment:
var fullComment = (FullComment) comment; var fullComment = (FullComment) comment;
foreach (var block in fullComment.Blocks) foreach (var block in fullComment.Blocks)
block.GetCommentSections(sections); block.GetCommentSections(sections);
break; break;
case CommentKind.BlockCommandComment: case DocumentationCommentKind.BlockCommandComment:
var blockCommandComment = (BlockCommandComment) comment; var blockCommandComment = (BlockCommandComment) comment;
if (blockCommandComment.CommandKind == CommentCommandKind.Return && if (blockCommandComment.CommandKind == CommentCommandKind.Return &&
blockCommandComment.ParagraphComment != null) blockCommandComment.ParagraphComment != null)
@ -36,7 +36,7 @@ namespace CppSharp.Generators.CSharp
blockCommandComment.ParagraphComment.GetCommentSections(sections); blockCommandComment.ParagraphComment.GetCommentSections(sections);
} }
break; break;
case CommentKind.ParamCommandComment: case DocumentationCommentKind.ParamCommandComment:
var paramCommandComment = (ParamCommandComment) comment; var paramCommandComment = (ParamCommandComment) comment;
var param = new Section(CommentElement.Param); var param = new Section(CommentElement.Param);
sections.Add(param); sections.Add(param);
@ -47,13 +47,13 @@ namespace CppSharp.Generators.CSharp
foreach (var inlineContentComment in paramCommandComment.ParagraphComment.Content) foreach (var inlineContentComment in paramCommandComment.ParagraphComment.Content)
inlineContentComment.GetCommentSections(sections); inlineContentComment.GetCommentSections(sections);
break; break;
case CommentKind.TParamCommandComment: case DocumentationCommentKind.TParamCommandComment:
break; break;
case CommentKind.VerbatimBlockComment: case DocumentationCommentKind.VerbatimBlockComment:
break; break;
case CommentKind.VerbatimLineComment: case DocumentationCommentKind.VerbatimLineComment:
break; break;
case CommentKind.ParagraphComment: case DocumentationCommentKind.ParagraphComment:
var summaryParagraph = sections.Count == 1; var summaryParagraph = sections.Count == 1;
var paragraphComment = (ParagraphComment) comment; var paragraphComment = (ParagraphComment) comment;
foreach (var inlineContentComment in paragraphComment.Content) foreach (var inlineContentComment in paragraphComment.Content)
@ -65,24 +65,24 @@ namespace CppSharp.Generators.CSharp
sections.Add(new Section(CommentElement.Remarks)); sections.Add(new Section(CommentElement.Remarks));
} }
break; break;
case CommentKind.HTMLTagComment: case DocumentationCommentKind.HTMLTagComment:
break; break;
case CommentKind.HTMLStartTagComment: case DocumentationCommentKind.HTMLStartTagComment:
break; break;
case CommentKind.HTMLEndTagComment: case DocumentationCommentKind.HTMLEndTagComment:
break; break;
case CommentKind.TextComment: case DocumentationCommentKind.TextComment:
var section = sections.Last(); var section = sections.Last();
section.Lines.Add(GetText(comment, section.Lines.Add(GetText(comment,
section.Type == CommentElement.Returns || section.Type == CommentElement.Param)); section.Type == CommentElement.Returns || section.Type == CommentElement.Param));
if (sections.Count == 1) if (sections.Count == 1)
sections.Add(new Section(CommentElement.Remarks)); sections.Add(new Section(CommentElement.Remarks));
break; break;
case CommentKind.InlineContentComment: case DocumentationCommentKind.InlineContentComment:
break; break;
case CommentKind.InlineCommandComment: case DocumentationCommentKind.InlineCommandComment:
break; break;
case CommentKind.VerbatimBlockLineComment: case DocumentationCommentKind.VerbatimBlockLineComment:
break; break;
} }
} }

Loading…
Cancel
Save