PdfPig/src/UglyToad.PdfPig.Tokens/CommentToken.cs

41 lines
1.1 KiB
C#
Raw Normal View History

namespace UglyToad.PdfPig.Tokens
{
/// <summary>
/// A comment from a PDF document. Any occurrence of the percent sign character (%) outside a string or stream
/// introduces a comment. The comment consists of all characters between the percent sign and the end of the line.
/// </summary>
public class CommentToken : IDataToken<string>
{
/// <summary>
/// The text of the comment (excluding the initial percent '%' sign).
/// </summary>
public string Data { get; }
/// <summary>
/// Create a new <see cref="CommentToken"/>.
/// </summary>
/// <param name="data">The text of the comment.</param>
2020-01-05 18:07:01 +08:00
public CommentToken(string data)
{
Data = data ?? string.Empty;
}
/// <inheritdoc />
public override string ToString()
{
return Data;
}
/// <inheritdoc />
public bool Equals(IToken obj)
{
if (!(obj is CommentToken other))
{
return false;
}
return other.Data == Data;
}
}
}