Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

PdfObject * PoDoFo::PdfVecObjects::RemoveObject ( const PdfReference ref,
bool  bMarkAsFree = true 
)

Remove the object with the given object and generation number from the list of objects. The object is returned if it was found. Otherwise NULL is returned. The caller has to delete the object by hisself.

Parameters:
refthe object to be found
bMarkAsFreeif 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.

Definition at line 171 of file PdfVecObjects.cpp.

References AddFreeObject(), PoDoFo::PdfObject::Reference(), and Sort().

Referenced by PoDoFo::PdfPage::DeleteAnnotation(), PoDoFo::PdfPagesTree::DeletePageFromNode(), PoDoFo::PdfImmediateWriter::FinishLastObject(), PoDoFo::PdfFontType1::PdfFontType1(), and PoDoFo::PdfWriter::ReorderObjectsLinearized().

{
    if( !m_bSorted )
        this->Sort();


    PdfObject*         pObj;
    PdfObject refObj( ref, NULL );
    std::pair<TIVecObjects,TIVecObjects> it = 
        std::equal_range( m_vector.begin(), m_vector.end(), &refObj, ObjectComparatorPredicate() );

    if( it.first != it.second )
    {
        pObj = *(it.first);
        if( bMarkAsFree )
            this->AddFreeObject( pObj->Reference() );
        m_vector.erase( it.first );
        return pObj;
    }
    
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index