Skip to content

Commit

Permalink
Make DirectObjectFinder public
Browse files Browse the repository at this point in the history
  • Loading branch information
BobLd committed Jun 11, 2024
1 parent 531e00e commit d96ec7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/UglyToad.PdfPig.Tests/PublicApiScannerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public void OnlyExposedApiIsPublic()
"UglyToad.PdfPig.Outline.Destinations.NamedDestinations",
"UglyToad.PdfPig.ParsingOptions",
"UglyToad.PdfPig.Parser.IPageContentParser",
"UglyToad.PdfPig.Parser.Parts.DirectObjectFinder",
"UglyToad.PdfPig.PdfDocument",
"UglyToad.PdfPig.PdfExtensions",
"UglyToad.PdfPig.Rendering.IPageImageRenderer",
Expand Down
14 changes: 13 additions & 1 deletion src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
using Tokenization.Scanner;
using Tokens;

internal static class DirectObjectFinder
/// <summary>
/// Direct object finder.
/// </summary>
public static class DirectObjectFinder
{
/// <summary>
/// Try and get the token value, using the <see cref="IPdfTokenScanner"/> if it is a <see cref="IndirectReferenceToken"/>.
/// </summary>
public static bool TryGet<T>(IToken? token, IPdfTokenScanner scanner, [NotNullWhen(true)] out T? tokenResult)
where T : class, IToken
{
Expand Down Expand Up @@ -45,6 +51,9 @@ public static bool TryGet<T>(IToken? token, IPdfTokenScanner scanner, [NotNullWh
return false;
}

/// <summary>
/// Get the token value.
/// </summary>
public static T? Get<T>(IndirectReference reference, IPdfTokenScanner scanner)
where T : class, IToken
{
Expand Down Expand Up @@ -83,6 +92,9 @@ public static bool TryGet<T>(IToken? token, IPdfTokenScanner scanner, [NotNullWh
}

#nullable disable
/// <summary>
/// Get the token value, using the <see cref="IPdfTokenScanner"/> if it is a <see cref="IndirectReferenceToken"/>.
/// </summary>
public static T Get<T>(IToken token, IPdfTokenScanner scanner) where T : class, IToken
{
if (token is T result)
Expand Down

0 comments on commit d96ec7a

Please sign in to comment.