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

int PoDoFo::PdfPagesTree::GetPosInKids ( PdfObject pPageObj,
PdfObject pPageParent 
) [private]

Find the position of pPageObj in the kids array of pPageParent

Returns:
the index in the kids array or -1 if pPageObj is no child of pPageParent

Definition at line 401 of file PdfPagesTree.cpp.

References PoDoFo::PdfArray::begin(), PoDoFo::PdfArray::end(), PoDoFo::PdfVariant::GetArray(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDictionary::GetKey(), and PoDoFo::PdfObject::Reference().

Referenced by DeletePage(), DeletePageFromNode(), and InsertPage().

{
    if( !pPageParent )
    {
        //printf("pPageParent=%p\n", pPageParent );
        return -1;
    }

    const PdfArray & rKids = pPageParent->GetDictionary().GetKey( PdfName("Kids") )->GetArray();
    PdfArray::const_iterator it = rKids.begin();

    int index = 0;
    while( it != rKids.end() ) 
    {
        if( (*it).GetReference() == pPageObj->Reference() )
        {
            //printf("Found at: %i \n", index );
            return index;
        }

        ++index;
        ++it;
    }

    //printf("Not found %i 0 R in %i 0 R\n", pPageObj->Reference().ObjectNumber(),
    //       pPageParent->Reference().ObjectNumber());
    return -1;
}

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