2018-01-11 03:49:32 +08:00
|
|
|
|
namespace UglyToad.PdfPig.Cos
|
2017-11-10 03:14:09 +08:00
|
|
|
|
{
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using ContentStream;
|
2018-01-21 02:42:29 +08:00
|
|
|
|
using Tokenization.Tokens;
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
internal class CrossReferenceTablePartBuilder
|
|
|
|
|
{
|
2018-01-14 22:48:54 +08:00
|
|
|
|
private readonly Dictionary<IndirectReference, long> objects = new Dictionary<IndirectReference, long>();
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
public long Offset { get; set; }
|
|
|
|
|
|
|
|
|
|
public long Previous { get; set; }
|
|
|
|
|
|
2018-01-21 02:42:29 +08:00
|
|
|
|
public DictionaryToken Dictionary { get; set; }
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
public CrossReferenceType XRefType { get; set; }
|
2018-01-05 05:09:47 +08:00
|
|
|
|
|
2017-11-10 03:14:09 +08:00
|
|
|
|
public void Add(long objectId, int generationNumber, long offset)
|
|
|
|
|
{
|
2018-01-14 22:48:54 +08:00
|
|
|
|
IndirectReference objKey = new IndirectReference(objectId, generationNumber);
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
if (!objects.ContainsKey(objKey))
|
|
|
|
|
{
|
|
|
|
|
objects[objKey] = offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-05 05:09:47 +08:00
|
|
|
|
public CrossReferenceTablePart Build()
|
2017-11-10 03:14:09 +08:00
|
|
|
|
{
|
|
|
|
|
return new CrossReferenceTablePart(objects, Offset, Previous, Dictionary, XRefType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|