mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 10:55:04 +08:00
#10 some tidying for a couple of tokens
This commit is contained in:
@@ -1,16 +1,61 @@
|
||||
namespace UglyToad.PdfPig.Tokens
|
||||
{
|
||||
using Util.JetBrains.Annotations;
|
||||
|
||||
/// <summary>
|
||||
/// The boolean object either <see cref="True"/> (<see langword="true"/>) or <see cref="False"/> (<see langword="true"/>).
|
||||
/// </summary>
|
||||
internal class BooleanToken : IDataToken<bool>
|
||||
{
|
||||
/// <summary>
|
||||
/// The boolean token corresponding to <see langword="true"/>.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
public static BooleanToken True { get; } = new BooleanToken(true);
|
||||
|
||||
/// <summary>
|
||||
/// The boolean token corresponding to <see langword="false"/>
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
public static BooleanToken False { get; } = new BooleanToken(false);
|
||||
|
||||
/// <summary>
|
||||
/// The value true/false of this boolean token.
|
||||
/// </summary>
|
||||
public bool Data { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="BooleanToken"/>.
|
||||
/// </summary>
|
||||
/// <param name="data">The value of the boolean.</param>
|
||||
private BooleanToken(bool data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is BooleanToken other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return other.Data == Data;
|
||||
}
|
||||
|
||||
protected bool Equals(BooleanToken other)
|
||||
{
|
||||
return Data == other.Data;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Data.GetHashCode();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Data.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,24 @@
|
||||
namespace UglyToad.PdfPig.Tokens
|
||||
{
|
||||
using Util.JetBrains.Annotations;
|
||||
|
||||
/// <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>
|
||||
internal class CommentToken : IDataToken<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// The text of the comment (excluding the initial percent '%' sign).
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public string Data { get; }
|
||||
|
||||
public CommentToken(string data)
|
||||
/// <summary>
|
||||
/// Create a new <see cref="CommentToken"/>.
|
||||
/// </summary>
|
||||
/// <param name="data">The text of the comment.</param>
|
||||
public CommentToken([CanBeNull]string data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
Reference in New Issue
Block a user