PoDoFo
0.9.20
|
#include <PdfIndirectObjectList.h>
Classes | |
class | Observer |
class | StreamFactory |
Public Member Functions | |
void | SetCanReuseObjectNumbers (bool canReuseObjectNumbers) |
void | Clear () |
unsigned | GetSize () const |
unsigned | GetObjectCount () const |
PdfObject & | MustGetObject (const PdfReference &ref) const |
PdfObject * | GetObject (const PdfReference &ref) const |
std::unique_ptr< PdfObject > | RemoveObject (const PdfReference &ref) |
std::unique_ptr< PdfObject > | RemoveObject (const iterator &it) |
std::unique_ptr< PdfObject > | ReplaceObject (const PdfReference &ref, PdfObject *obj) |
PdfObject & | CreateDictionaryObject (const std::string_view &type={}, const std::string_view &subtype={}) |
PdfObject & | CreateObject (const PdfObject &obj) |
void | Attach (Observer &observer) |
void | Detach (Observer &observer) |
void | SetStreamFactory (StreamFactory *factory) |
std::unique_ptr< PdfObjectStreamProvider > | CreateStream () |
void | WriteObject (PdfObject &obj) |
void | Finish () |
void | BeginAppendStream (PdfObjectStream &stream) |
void | EndAppendStream (PdfObjectStream &stream) |
void | TryIncrementObjectCount (const PdfReference &ref) |
iterator | begin () const |
iterator | end () const |
PdfDocument & | GetDocument () const |
bool | GetCanReuseObjectNumbers () const |
const ReferenceList & | GetFreeObjects () const |
A list of PdfObjects that constitutes the indirect object list of the document The PdfParser will read the PdfFile into memory and create a PdfIndirectObjectList of all dictionaries found in the PDF file.
The PdfWriter class contrary creates a PdfIndirectObjectList internally and writes it to a PDF file later with an appropriate table of contents.
This class contains also advanced functions for searching of PdfObject's in a PdfIndirectObjectList.
void PdfIndirectObjectList::Attach | ( | Observer & | observer | ) |
Attach a new observer
observer | to attach |
PdfIndirectObjectList::iterator PdfIndirectObjectList::begin | ( | ) | const |
Iterator pointing at the beginning of the vector
void PdfIndirectObjectList::BeginAppendStream | ( | PdfObjectStream & | stream | ) |
Every stream implementation has to call this in BeginAppend
stream | the stream object that is calling |
void PdfIndirectObjectList::Clear | ( | ) |
Removes all objects from the vector and resets it to the default state.
If SetAutoDelete is true all objects are deleted. All observers are removed from the vector.
PdfObject & PdfIndirectObjectList::CreateDictionaryObject | ( | const std::string_view & | type = { } , |
const std::string_view & | subtype = { } |
||
) |
unique_ptr< PdfObjectStreamProvider > PdfIndirectObjectList::CreateStream | ( | ) |
Creates a stream object This method is a factory for PdfObjectStream objects.
parent | parent object |
void PdfIndirectObjectList::Detach | ( | Observer & | observer | ) |
Detach an observer.
observer | observer to detach |
PdfIndirectObjectList::iterator PdfIndirectObjectList::end | ( | ) | const |
Iterator pointing at the end of the vector
void PdfIndirectObjectList::EndAppendStream | ( | PdfObjectStream & | stream | ) |
Every stream implementation has to call this in EndAppend
stream | the stream object that is calling |
void PdfIndirectObjectList::Finish | ( | ) |
Call whenever a document is finished
|
inline |
|
inline |
|
inline |
PdfObject * PdfIndirectObjectList::GetObject | ( | const PdfReference & | ref | ) | const |
Finds the object with the given reference and returns a pointer to it if it is found.
ref | the object to be found |
|
inline |
unsigned PdfIndirectObjectList::GetSize | ( | ) | const |
PdfObject & PdfIndirectObjectList::MustGetObject | ( | const PdfReference & | ref | ) | const |
Finds the object with the given reference and returns a pointer to it if it is found. Throws a PdfError exception with error code ePdfError_NoObject if no object was found
ref | the object to be found |
PdfError(ePdfError_NoObject) |
unique_ptr< PdfObject > PdfIndirectObjectList::RemoveObject | ( | const PdfReference & | ref | ) |
Remove the object with the given object and generation number from the list of objects. The object is returned if it was found. Otherwise nullptr is returned. The caller has to delete the object by himself.
ref | the object to be found |
markAsFree | if true the removed object reference is marked as free object you will always want to have this true as invalid PDF files can be generated otherwise |
unique_ptr< PdfObject > PdfIndirectObjectList::RemoveObject | ( | const iterator & | it | ) |
Remove the object with the iterator it from the vector and return it
ref | the reference of the object to remove |
unique_ptr< PdfObject > PdfIndirectObjectList::ReplaceObject | ( | const PdfReference & | ref, |
PdfObject * | obj | ||
) |
Replace the object at the given reference
ref | the reference of the object to replace |
obj | the object that will be inserted instead, must be non null |
void PdfIndirectObjectList::SetCanReuseObjectNumbers | ( | bool | canReuseObjectNumbers | ) |
Enable/disable object numbers re-use. By default object numbers re-use is enabled.
canReuseObjectNumbers | if true, free object numbers can be re-used when creating new objects. |
If set to false, the list of free object numbers is automatically cleared.
void PdfIndirectObjectList::SetStreamFactory | ( | StreamFactory * | factory | ) |
Sets a StreamFactory which is used whenever CreateStream is called.
factory | a stream factory or nullptr to reset to the default factory |
void PdfIndirectObjectList::TryIncrementObjectCount | ( | const PdfReference & | ref | ) |
Set the object count so that the object described this reference is contained in the object count.
ref | reference of newly added object |