From d96ec7a9afc2d398b7303bab348740e17d50f908 Mon Sep 17 00:00:00 2001 From: BobLd <38405645+BobLd@users.noreply.github.com> Date: Sat, 8 Jun 2024 09:53:15 +0100 Subject: [PATCH] Make DirectObjectFinder public --- src/UglyToad.PdfPig.Tests/PublicApiScannerTests.cs | 1 + .../Parser/Parts/DirectObjectFinder.cs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/UglyToad.PdfPig.Tests/PublicApiScannerTests.cs b/src/UglyToad.PdfPig.Tests/PublicApiScannerTests.cs index 7796e324e..dc387e6e8 100644 --- a/src/UglyToad.PdfPig.Tests/PublicApiScannerTests.cs +++ b/src/UglyToad.PdfPig.Tests/PublicApiScannerTests.cs @@ -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", diff --git a/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs b/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs index 90ca51943..b88b08c23 100644 --- a/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs +++ b/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs @@ -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 { @@ -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 { @@ -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)