#include <PdfIndirectObjectList.h>
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.
◆ Attach()
void PdfIndirectObjectList::Attach |
( |
Observer & | observer | ) |
|
Attach a new observer
- Parameters
-
◆ begin()
PdfIndirectObjectList::iterator PdfIndirectObjectList::begin |
( |
| ) |
const |
Iterator pointing at the beginning of the vector
- Returns
- beginning iterator
◆ BeginAppendStream()
Every stream implementation has to call this in BeginAppend
- Parameters
-
stream | the stream object that is calling |
◆ Clear()
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.
- See also
- SetAutoDelete
-
IsAutoDelete
◆ CreateDictionaryObject()
PdfObject & PdfIndirectObjectList::CreateDictionaryObject |
( |
const std::string_view & | type = { }, |
|
|
const std::string_view & | subtype = { } ) |
Creates a new object and inserts it into the vector. This function assigns the next free object number to the PdfObject.
- Parameters
-
type | optional value of the /Type key of the object |
subtype | optional value of the /SubType key of the object |
- Returns
- PdfObject pointer to the new PdfObject
◆ CreateObject()
Creates a new object and inserts it into the vector. This function assigns the next free object number to the PdfObject.
- Parameters
-
- Returns
- PdfObject pointer to the new PdfObject
◆ CreateStream()
unique_ptr< PdfObjectStreamProvider > PdfIndirectObjectList::CreateStream |
( |
| ) |
|
Creates a stream object This method is a factory for PdfObjectStream objects.
- Parameters
-
- Returns
- a new stream object
◆ Detach()
void PdfIndirectObjectList::Detach |
( |
Observer & | observer | ) |
|
Detach an observer.
- Parameters
-
observer | observer to detach |
◆ end()
PdfIndirectObjectList::iterator PdfIndirectObjectList::end |
( |
| ) |
const |
Iterator pointing at the end of the vector
- Returns
- ending iterator
◆ EndAppendStream()
Every stream implementation has to call this in EndAppend
- Parameters
-
stream | the stream object that is calling |
◆ Finish()
void PdfIndirectObjectList::Finish |
( |
| ) |
|
Call whenever a document is finished
◆ GetCanReuseObjectNumbers()
bool PoDoFo::PdfIndirectObjectList::GetCanReuseObjectNumbers |
( |
| ) |
const |
|
inline |
- Returns
- whether can re-use free object numbers when creating new objects.
◆ GetDocument()
PdfDocument & PoDoFo::PdfIndirectObjectList::GetDocument |
( |
| ) |
const |
|
inline |
- Returns
- a pointer to a PdfDocument that is the parent of this vector. Might be nullptr if the vector has no parent.
◆ GetFreeObjects()
const ReferenceList & PoDoFo::PdfIndirectObjectList::GetFreeObjects |
( |
| ) |
const |
|
inline |
- Returns
- a list of free references in this vector
◆ GetObject()
Finds the object with the given reference and returns a pointer to it if it is found.
- Parameters
-
ref | the object to be found |
- Returns
- the found object or nullptr if no object was found.
◆ GetObjectCount()
unsigned PoDoFo::PdfIndirectObjectList::GetObjectCount |
( |
| ) |
const |
|
inline |
- Returns
- the highest object number in the vector
◆ GetSize()
unsigned PdfIndirectObjectList::GetSize |
( |
| ) |
const |
- Returns
- the size of the internal vector
◆ MustGetObject()
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
- Parameters
-
ref | the object to be found |
- Returns
- the found object
- Exceptions
-
PdfError(ePdfError_NoObject) | |
◆ RemoveObject() [1/2]
unique_ptr< PdfObject > PdfIndirectObjectList::RemoveObject |
( |
const iterator & | it | ) |
|
Remove the object with the iterator it from the vector and return it
- Parameters
-
ref | the reference of the object to remove |
- Returns
- the removed object
◆ RemoveObject() [2/2]
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.
- Parameters
-
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 |
- Returns
- The removed object.
◆ ReplaceObject()
Replace the object at the given reference
- Parameters
-
ref | the reference of the object to replace |
obj | the object that will be inserted instead, must be non null |
- Returns
- the replaced object
◆ SetCanReuseObjectNumbers()
void PdfIndirectObjectList::SetCanReuseObjectNumbers |
( |
bool | canReuseObjectNumbers | ) |
|
Enable/disable object numbers re-use. By default object numbers re-use is enabled.
- Parameters
-
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.
◆ SetStreamFactory()
void PdfIndirectObjectList::SetStreamFactory |
( |
StreamFactory * | factory | ) |
|
Sets a StreamFactory which is used whenever CreateStream is called.
- Parameters
-
factory | a stream factory or nullptr to reset to the default factory |
◆ TryIncrementObjectCount()
void PdfIndirectObjectList::TryIncrementObjectCount |
( |
const PdfReference & | ref | ) |
|
Set the object count so that the object described this reference is contained in the object count.
- Parameters
-
ref | reference of newly added object |
◆ WriteObject()
void PdfIndirectObjectList::WriteObject |
( |
PdfObject & | obj | ) |
|
Can be called to force objects to be written to disk.
- Parameters
-
obj | a PdfObject that should be written to disk. |