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

void PoDoFo::PdfVecObjects::GetObjectDependencies ( const PdfObject pObj,
TPdfReferenceList *  pList 
) const

Get a set with all references of objects that the passed object depends on.

Parameters:
pObjthe object to calculate all dependencies for
pListwrite the list of dependencies to this list

Definition at line 371 of file PdfVecObjects.cpp.

References PoDoFo::PdfArray::begin(), PoDoFo::PdfArray::end(), PoDoFo::PdfVariant::GetArray(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDictionary::GetKeys(), PoDoFo::PdfVariant::GetReference(), PoDoFo::PdfVariant::IsArray(), PoDoFo::PdfVariant::IsDictionary(), and PoDoFo::PdfVariant::IsReference().

Referenced by PoDoFo::PdfWriter::FindCatalogDependencies(), and PoDoFo::PdfWriter::ReorderObjectsLinearized().

{
    PdfArray::const_iterator   itArray;
    TCIKeyMap                  itKeys;
  
    if( pObj->IsReference() )
    {
        if( std::find( pList->begin(), pList->end(), pObj->GetReference() ) == pList->end() )
            pList->push_back( pObj->GetReference() );
    }
    else if( pObj->IsArray() )
    {
        itArray = pObj->GetArray().begin(); 
        while( itArray != pObj->GetArray().end() )
        {
            if( (*itArray).IsArray() ||
                (*itArray).IsDictionary() ||
                (*itArray).IsReference() )
                GetObjectDependencies( &(*itArray), pList );

            ++itArray;
        }
    }
    else if( pObj->IsDictionary() )
    {
        itKeys = pObj->GetDictionary().GetKeys().begin();
        while( itKeys != pObj->GetDictionary().GetKeys().end() )
        {
            // optimization as this is really slow:
            // Call only for dictionaries, references and arrays
            if( (*itKeys).second->IsArray() ||
                (*itKeys).second->IsDictionary() ||
                (*itKeys).second->IsReference() )
                GetObjectDependencies( (*itKeys).second, pList );
            
            ++itKeys;
        }
    }
}

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