PoDoFo  0.9.4
Public Member Functions | Protected Member Functions | List of all members
PoDoFo::PdfXRef Class Reference

#include <PdfXRef.h>

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

Public Member Functions

 PdfXRef ()
 
virtual ~PdfXRef ()
 
void AddObject (const PdfReference &rRef, pdf_uint64 offset, bool bUsed)
 
void Write (PdfOutputDevice *pDevice)
 
pdf_uint32 GetSize () const
 
virtual pdf_uint64 GetOffset () const
 
void SetFirstEmptyBlock ()
 

Protected Member Functions

virtual void BeginWrite (PdfOutputDevice *pDevice)
 
virtual void WriteSubSection (PdfOutputDevice *pDevice, pdf_objnum nFirst, pdf_uint32 nCount)
 
virtual void WriteXRefEntry (PdfOutputDevice *pDevice, pdf_uint64 offset, pdf_gennum generation, char cMode, pdf_objnum objectNumber=0)
 
virtual void EndWrite (PdfOutputDevice *pDevice)
 

Detailed Description

Creates an XRef table.

This is an internal class of PoDoFo used by PdfWriter.

Constructor & Destructor Documentation

PoDoFo::PdfXRef::PdfXRef ( )

Create a new XRef table

PoDoFo::PdfXRef::~PdfXRef ( )
virtual

Destruct the XRef table

Member Function Documentation

void PoDoFo::PdfXRef::AddObject ( const PdfReference rRef,
pdf_uint64  offset,
bool  bUsed 
)

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

Parameters
rRefreference of this object
offsetthe offset where on the device the object was written
bUsedspecifies wether this is an used or free object. Set this value to true for all normal objects and to false for free object references.
void PoDoFo::PdfXRef::BeginWrite ( PdfOutputDevice pDevice)
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
pDevicethe output device to which the XRef table should be written.

Reimplemented in PoDoFo::PdfXRefStream.

void PoDoFo::PdfXRef::EndWrite ( PdfOutputDevice pDevice)
protectedvirtual

Called at the end of writing the XRef table. Sub classes can overload this method to finish a XRef table.

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

Reimplemented in PoDoFo::PdfXRefStream.

pdf_uint64 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.

pdf_uint32 PoDoFo::PdfXRef::GetSize ( ) const

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

Returns
the size of the xref table
void PoDoFo::PdfXRef::SetFirstEmptyBlock ( )

Mark as empty block.

void PoDoFo::PdfXRef::Write ( PdfOutputDevice pDevice)

Write the XRef table to an output device.

Parameters
pDevicean output device (usually a PDF file)
void PoDoFo::PdfXRef::WriteSubSection ( PdfOutputDevice pDevice,
pdf_objnum  nFirst,
pdf_uint32  nCount 
)
protectedvirtual

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

Parameters
pDevicethe output device to which the XRef table should be written.
nFirstthe object number of the first object in this subsection
nCountthe number of entries in this subsection

Reimplemented in PoDoFo::PdfXRefStream.

void PoDoFo::PdfXRef::WriteXRefEntry ( PdfOutputDevice pDevice,
pdf_uint64  offset,
pdf_gennum  generation,
char  cMode,
pdf_objnum  objectNumber = 0 
)
protectedvirtual

Write a single entry to the XRef table

Parameters
pDevicethe output device to which the XRef table should be written.
offsetthe offset of the object
generationthe generation number
cModethe mode 'n' for object and 'f' for free objects
objectNumberthe object number of the currently written object if cMode = 'n' otherwise undefined

Reimplemented in PoDoFo::PdfXRefStream.