PdfPig/src/UglyToad.PdfPig/CrossReference/CrossReferenceTablePartBuilder.cs
Jason Nelson a412a239be
Enable nullable annotations (#803)
* Enable nullable annotations

* Remove unused Jetbrain annotations

* Ensure system using statements are first

* Improve nullability annotations

* Annotate encryptionDictionary is non-null when IsEncrypted is true

* Disable nullable for PdfTokenScanner.Get

* Improve nullability annotations for ObjectLocationProvider.TryGetCached

* Revert changes to RGBWorkingSpace

* Update UglyToad.PdfPig.Package with new framework targets (fixes nightly builds)
2024-03-17 18:51:40 +00:00

36 lines
1.0 KiB
C#

namespace UglyToad.PdfPig.CrossReference
{
using System.Collections.Generic;
using Core;
using Tokens;
internal class CrossReferenceTablePartBuilder
{
private readonly Dictionary<IndirectReference, long> objects = new Dictionary<IndirectReference, long>();
public long Offset { get; set; }
public long Previous { get; set; }
public DictionaryToken? Dictionary { get; set; }
public CrossReferenceType XRefType { get; set; }
public long? TiedToPreviousAtOffset { get; set; }
public void Add(long objectId, int generationNumber, long offset)
{
IndirectReference objKey = new IndirectReference(objectId, generationNumber);
if (!objects.ContainsKey(objKey))
{
objects[objKey] = offset;
}
}
public CrossReferenceTablePart Build()
{
return new CrossReferenceTablePart(objects, Offset, Previous, Dictionary!, XRefType, TiedToPreviousAtOffset);
}
}
}