2018-11-17 04:00:12 +08:00
|
|
|
|
namespace UglyToad.PdfPig.Tokens
|
2017-11-14 07:48:25 +08:00
|
|
|
|
{
|
2018-11-17 04:08:00 +08:00
|
|
|
|
/// <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>
|
2018-11-25 03:02:06 +08:00
|
|
|
|
public class CommentToken : IDataToken<string>
|
2017-11-14 07:48:25 +08:00
|
|
|
|
{
|
2018-11-17 04:08:00 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The text of the comment (excluding the initial percent '%' sign).
|
|
|
|
|
/// </summary>
|
2017-11-14 07:48:25 +08:00
|
|
|
|
public string Data { get; }
|
|
|
|
|
|
2018-11-17 04:08:00 +08:00
|
|
|
|
/// <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)
|
2017-11-14 07:48:25 +08:00
|
|
|
|
{
|
2018-11-25 03:02:06 +08:00
|
|
|
|
Data = data ?? string.Empty;
|
2017-11-14 07:48:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-25 03:02:06 +08:00
|
|
|
|
/// <inheritdoc />
|
2017-11-14 07:48:25 +08:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2018-11-25 03:02:06 +08:00
|
|
|
|
return Data;
|
2017-11-14 07:48:25 +08:00
|
|
|
|
}
|
2020-03-07 23:25:56 +08:00
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public bool Equals(IToken obj)
|
|
|
|
|
{
|
|
|
|
|
if (!(obj is CommentToken other))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return other.Data == Data;
|
|
|
|
|
}
|
2017-11-14 07:48:25 +08:00
|
|
|
|
}
|
|
|
|
|
}
|