Files
PdfPig/src/UglyToad.PdfPig.Tokens/CommentToken.cs
InusualZ 02289d75ac Use ReferenceEquals to avoid infinite recursion
Fix InlineImageDataToken not checking Data length before comparing bytes
Use a more straightforward compare Dictionary Content
2020-03-15 16:05:23 +01:00

46 lines
1.2 KiB
C#

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>
public CommentToken(string data)
{
Data = data ?? string.Empty;
}
/// <inheritdoc />
public override string ToString()
{
return Data;
}
/// <inheritdoc />
public bool Equals(IToken obj)
{
if (ReferenceEquals(this, obj))
{
return true;
}
if (!(obj is CommentToken other))
{
return false;
}
return other.Data == Data;
}
}
}