PoDoFo 0.9.20
PoDoFo::PdfXRef Class Reference

#include <PdfXRef.h>

Inheritance diagram for PoDoFo::PdfXRef:
PoDoFo::PdfXRefStream

Public Member Functions

void AddInUseObject (const PdfReference &ref, nullable< uint64_t > offset)
 
void AddFreeObject (const PdfReference &ref)
 
void Write (OutputStreamDevice &device, charbuff &buffer)
 
uint32_t GetSize () const
 
void SetFirstEmptyBlock ()
 
virtual bool ShouldSkipWrite (const PdfReference &ref)
 
virtual uint64_t GetOffset () const
 

Protected Member Functions

virtual void BeginWrite (OutputStreamDevice &device, charbuff &buffer)
 
virtual void WriteSubSection (OutputStreamDevice &device, uint32_t first, uint32_t count, charbuff &buffer)
 
virtual void WriteXRefEntry (OutputStreamDevice &device, const PdfReference &ref, const PdfXRefEntry &entry, charbuff &buffer)
 
virtual void EndWriteImpl (OutputStreamDevice &device, charbuff &buffer)
 

Detailed Description

Creates an XRef table.

This is an internal class of PoDoFo used by PdfWriter.

Member Function Documentation

◆ AddFreeObject()

void PdfXRef::AddFreeObject ( const PdfReference & ref)

Add a free object to the XRef table.

Parameters
refreference of this object
offsetthe offset where on the device the object was written
bUsedspecifies whether this is an used or free object. Set this value to true for all normal objects and to false for free object references.

◆ AddInUseObject()

void PdfXRef::AddInUseObject ( const PdfReference & ref,
nullable< uint64_t > offset )

Add an used object to the XRef table. The object should have been written to an output device already.

Parameters
refreference of this object
offsetthe offset where on the device the object was written if std::nullopt, the object will be accounted for trailer's /Size but not written in the entries list

◆ BeginWrite()

void PdfXRef::BeginWrite ( OutputStreamDevice & device,
charbuff & buffer )
protectedvirtual

Called at the start of writing the XRef table. This method can be overwritten in subclasses to write a general header for the XRef table.

Parameters
devicethe output device to which the XRef table should be written.

Reimplemented in PoDoFo::PdfXRefStream.

◆ EndWriteImpl()

void PdfXRef::EndWriteImpl ( OutputStreamDevice & device,
charbuff & buffer )
protectedvirtual

Sub classes can overload this method to finish a XRef table.

Parameters
devicethe output device to which the XRef table should be written.

Reimplemented in PoDoFo::PdfXRefStream.

◆ GetOffset()

virtual uint64_t PoDoFo::PdfXRef::GetOffset ( ) const
inlinevirtual
Returns
the offset in the file at which the XRef table starts after it was written

Reimplemented in PoDoFo::PdfXRefStream.

◆ GetSize()

uint32_t PdfXRef::GetSize ( ) const

Get the size of the XRef table. I.e. the highest object number + 1.

Returns
the size of the xref table

◆ SetFirstEmptyBlock()

void PdfXRef::SetFirstEmptyBlock ( )

Mark as empty block.

◆ ShouldSkipWrite()

bool PdfXRef::ShouldSkipWrite ( const PdfReference & ref)
virtual

Should skip writing for this object

Parameters
refreference of the object

Reimplemented in PoDoFo::PdfXRefStream.

◆ Write()

void PdfXRef::Write ( OutputStreamDevice & device,
charbuff & buffer )

Write the XRef table to an output device.

Parameters
devicean output device (usually a PDF file)

◆ WriteSubSection()

void PdfXRef::WriteSubSection ( OutputStreamDevice & device,
uint32_t first,
uint32_t count,
charbuff & buffer )
protectedvirtual

Begin an XRef subsection. All following calls of WriteXRefEntry belong to this XRef subsection.

Parameters
devicethe output device to which the XRef table should be written.
firstthe object number of the first object in this subsection
countthe number of entries in this subsection

Reimplemented in PoDoFo::PdfXRefStream.

◆ WriteXRefEntry()

void PdfXRef::WriteXRefEntry ( OutputStreamDevice & device,
const PdfReference & ref,
const PdfXRefEntry & entry,
charbuff & buffer )
protectedvirtual

Write a single entry to the XRef table

Parameters
devicethe output device to which the XRef table should be written.
refthe reference of object of the entry
entrythe XRefEntry of this object

Reimplemented in PoDoFo::PdfXRefStream.