Browse Source

Renamed RawCommentKind to CommentKind.

pull/769/head
Joao Matos 9 years ago
parent
commit
9a4c0bae82
  1. 54
      src/AST/Comment.cs
  2. 2
      src/Generator/Generators/CLI/CLIHeaders.cs
  3. 2
      src/Generator/Generators/CLI/CLISources.cs
  4. 2
      src/Generator/Generators/CSharp/CSharpSources.cs
  5. 4
      src/Generator/Generators/CodeGenerator.cs
  6. 18
      src/Parser/ASTConverter.cs

54
src/AST/Comment.cs

@ -4,9 +4,9 @@ using System.Collections.Generic; @@ -4,9 +4,9 @@ using System.Collections.Generic;
namespace CppSharp.AST
{
/// <summary>
/// Raw comment kind.
/// Comment kind.
/// </summary>
public enum RawCommentKind
public enum CommentKind
{
// Invalid comment.
Invalid,
@ -53,7 +53,7 @@ namespace CppSharp.AST @@ -53,7 +53,7 @@ namespace CppSharp.AST
/// <summary>
/// Kind of the comment.
/// </summary>
public RawCommentKind Kind;
public CommentKind Kind;
/// <summary>
/// Raw text of the comment.
@ -70,7 +70,7 @@ namespace CppSharp.AST @@ -70,7 +70,7 @@ namespace CppSharp.AST
/// </summary>
public bool IsInvalid
{
get { return Kind == RawCommentKind.Invalid; }
get { return Kind == CommentKind.Invalid; }
}
/// <summary>
@ -80,8 +80,8 @@ namespace CppSharp.AST @@ -80,8 +80,8 @@ namespace CppSharp.AST
{
get
{
return Kind == RawCommentKind.OrdinaryBCPL ||
Kind == RawCommentKind.OrdinaryC;
return Kind == CommentKind.OrdinaryBCPL ||
Kind == CommentKind.OrdinaryC;
}
}
@ -127,55 +127,55 @@ namespace CppSharp.AST @@ -127,55 +127,55 @@ namespace CppSharp.AST
public abstract void Visit<T>(ICommentVisitor<T> visitor);
public static string GetMultiLineCommentPrologue(RawCommentKind kind)
public static string GetMultiLineCommentPrologue(CommentKind kind)
{
switch (kind)
{
case RawCommentKind.OrdinaryBCPL:
case RawCommentKind.BCPLExcl:
case CommentKind.OrdinaryBCPL:
case CommentKind.BCPLExcl:
return "//";
case RawCommentKind.OrdinaryC:
case RawCommentKind.JavaDoc:
case RawCommentKind.Qt:
case CommentKind.OrdinaryC:
case CommentKind.JavaDoc:
case CommentKind.Qt:
return " *";
case RawCommentKind.BCPLSlash:
case CommentKind.BCPLSlash:
return "///";
default:
throw new ArgumentOutOfRangeException();
}
}
public static string GetLineCommentPrologue(RawCommentKind kind)
public static string GetLineCommentPrologue(CommentKind kind)
{
switch (kind)
{
case RawCommentKind.OrdinaryBCPL:
case RawCommentKind.BCPLSlash:
case CommentKind.OrdinaryBCPL:
case CommentKind.BCPLSlash:
return string.Empty;
case RawCommentKind.OrdinaryC:
case CommentKind.OrdinaryC:
return "/*";
case RawCommentKind.BCPLExcl:
case CommentKind.BCPLExcl:
return "//!";
case RawCommentKind.JavaDoc:
case CommentKind.JavaDoc:
return "/**";
case RawCommentKind.Qt:
case CommentKind.Qt:
return "/*!";
default:
throw new ArgumentOutOfRangeException();
}
}
public static string GetLineCommentEpilogue(RawCommentKind kind)
public static string GetLineCommentEpilogue(CommentKind kind)
{
switch (kind)
{
case RawCommentKind.OrdinaryBCPL:
case RawCommentKind.BCPLSlash:
case RawCommentKind.BCPLExcl:
case CommentKind.OrdinaryBCPL:
case CommentKind.BCPLSlash:
case CommentKind.BCPLExcl:
return string.Empty;
case RawCommentKind.OrdinaryC:
case RawCommentKind.JavaDoc:
case RawCommentKind.Qt:
case CommentKind.OrdinaryC:
case CommentKind.JavaDoc:
case CommentKind.Qt:
return " */";
default:
throw new ArgumentOutOfRangeException();

2
src/Generator/Generators/CLI/CLIHeaders.cs

@ -21,7 +21,7 @@ namespace CppSharp.Generators.CLI @@ -21,7 +21,7 @@ namespace CppSharp.Generators.CLI
public override void Process()
{
GenerateFilePreamble(RawCommentKind.OrdinaryBCPL);
GenerateFilePreamble(CommentKind.OrdinaryBCPL);
PushBlock(CLIBlockKind.Includes);
WriteLine("#pragma once");

2
src/Generator/Generators/CLI/CLISources.cs

@ -24,7 +24,7 @@ namespace CppSharp.Generators.CLI @@ -24,7 +24,7 @@ namespace CppSharp.Generators.CLI
public override void Process()
{
GenerateFilePreamble(RawCommentKind.OrdinaryBCPL);
GenerateFilePreamble(CommentKind.OrdinaryBCPL);
var file = Path.GetFileNameWithoutExtension(TranslationUnit.FileName)
.Replace('\\', '/');

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

@ -144,7 +144,7 @@ namespace CppSharp.Generators.CSharp @@ -144,7 +144,7 @@ namespace CppSharp.Generators.CSharp
public override void Process()
{
GenerateFilePreamble(RawCommentKind.OrdinaryBCPL);
GenerateFilePreamble(CommentKind.OrdinaryBCPL);
GenerateUsings();

4
src/Generator/Generators/CodeGenerator.cs

@ -40,7 +40,7 @@ namespace CppSharp.Generators @@ -40,7 +40,7 @@ namespace CppSharp.Generators
return base.Generate();
}
public void GenerateMultiLineComment(List<string> lines, RawCommentKind kind)
public void GenerateMultiLineComment(List<string> lines, CommentKind kind)
{
var lineCommentPrologue = Comment.GetLineCommentPrologue(kind);
if (!string.IsNullOrWhiteSpace(lineCommentPrologue))
@ -55,7 +55,7 @@ namespace CppSharp.Generators @@ -55,7 +55,7 @@ namespace CppSharp.Generators
WriteLine("{0}", lineCommentEpilogue);
}
public virtual void GenerateFilePreamble(RawCommentKind kind)
public virtual void GenerateFilePreamble(CommentKind kind)
{
var lines = new List<string>
{

18
src/Parser/ASTConverter.cs

@ -887,26 +887,26 @@ namespace CppSharp @@ -887,26 +887,26 @@ namespace CppSharp
return _rawComment;
}
private AST.RawCommentKind ConvertRawCommentKind(RawCommentKind kind)
private AST.CommentKind ConvertRawCommentKind(RawCommentKind kind)
{
switch (kind)
{
case RawCommentKind.Invalid:
return AST.RawCommentKind.Invalid;
return AST.CommentKind.Invalid;
case RawCommentKind.OrdinaryBCPL:
return AST.RawCommentKind.OrdinaryBCPL;
return AST.CommentKind.OrdinaryBCPL;
case RawCommentKind.OrdinaryC:
return AST.RawCommentKind.OrdinaryC;
return AST.CommentKind.OrdinaryC;
case RawCommentKind.BCPLSlash:
return AST.RawCommentKind.BCPLSlash;
return AST.CommentKind.BCPLSlash;
case RawCommentKind.BCPLExcl:
return AST.RawCommentKind.BCPLExcl;
return AST.CommentKind.BCPLExcl;
case RawCommentKind.JavaDoc:
return AST.RawCommentKind.JavaDoc;
return AST.CommentKind.JavaDoc;
case RawCommentKind.Qt:
return AST.RawCommentKind.Qt;
return AST.CommentKind.Qt;
case RawCommentKind.Merged:
return AST.RawCommentKind.Merged;
return AST.CommentKind.Merged;
default:
throw new ArgumentOutOfRangeException("kind");
}

Loading…
Cancel
Save