PdfPig/src/UglyToad.PdfPig/CrossReference/CrossReferenceTablePartBuilder.cs

33 lines
956 B
C#
Raw Normal View History

namespace UglyToad.PdfPig.CrossReference
{
using System.Collections.Generic;
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; }
2018-01-21 02:42:29 +08:00
public DictionaryToken Dictionary { get; set; }
public CrossReferenceType XRefType { 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);
}
}
}