

    GDALPDFObject* poStructTreeRoot = poCatalogObject->GetDictionary()->Get("StructTreeRoot");
    if (CPLTestBool(CPLGetConfigOption("OGR_PDF_READ_NON_STRUCTURED", "NO")) ||
        poStructTreeRoot == nullptr ||
        poStructTreeRoot->GetType()!= PDFObjectType_Dictionary)
    {
        ExploreContentsNonStructured(poContents, poResources);
    }
    else
    {
        int nDepth = 0;
        int nVisited = 0;
        bool bStop = false;
        ExploreContents(poContents, poResources, nDepth, nVisited, bStop);
        std::set< std::pair<int,int> > aoSetAlreadyVisited;
        ExploreTree(poStructTreeRoot, aoSetAlreadyVisited, 0);
    }

    CleanupIntermediateResources();

    int bEmptyDS = TRUE;
    for(int i=0;i<nLayers;i++)
    {
        if (papoLayers[i]->GetFeatureCount()!= 0)
        {
            bEmptyDS = FALSE;
            break;
        }
    }
    return!bEmptyDS;
}

/************************************************************************/
/*                   CleanupIntermediateResources()                     */
/************************************************************************/

void PDFDataset::CleanupIntermediateResources()
{
    std::map<int,OGRGeometry*>::iterator oMapIter = oMapMCID.begin();
    for( ; oMapIter!= oMapMCID.end(); ++oMapIter)
        delete oMapIter->second;
    oMapMCID.erase(oMapMCID.begin(), oMapMCID.end());
}

/************************************************************************/
/*                          InitMapOperators()                          */
/************************************************************************/

typedef struct
{
    char        szOpName[4];
    int         nArgs;
} PDFOperator;

static const PDFOperator asPDFOperators [] =
{
    { "b", 0 },
    { "B", 0 },
    { "b*", 0 },
    { "B*", 0 },
    { "BD
GDALPDFObject * poStructTreeRoot = poCatalogObject->GetDictionary()->Get("StructTreeRoot "); 
     if (CPLTestBool(CPLGetConfigOption("OGR_PDF_READ_NON_STRUCTURED ", " NO ") ) || 
         poStructTreeRoot = = nullptr || 
         poStructTreeRoot->GetType()!= PDFObjectType_Dictionary) 
     { 
         ExploreContentsNonStructured(poContents, poResources); 
     } 
     else 
     { 
         int nDepth = 0; 
         int nVisited = 0; 
         bool bStop = false; 
         ExploreContents(poContents, poResources, nDepth, nVisited, bStop); 
         std::set < std::pair < int, int > > aoSetAlreadyVisited; 
         ExploreTree(poStructTreeRoot, aoSetAlreadyVisited, 0); 
     } 

     CleanupIntermediateResources (); 

     int bEmptyDS = TRUE; 
     for(int i=0;i < nLayers;i++) 
     { 
         if (papoLayers[i]->GetFeatureCount()!= 0) 
         { 
             bEmptyDS = FALSE; 
             break; 
         } 
     } 
     return!bEmptyDS; 
 } 

 /************************************************************************/ 
 / *                    CleanupIntermediateResources ()                      * / 
 /************************************************************************/ 

 void PDFDataset::CleanupIntermediateResources () 
 { 
     std::map < int, OGRGeometry*>::iterator oMapIter = oMapMCID.begin (); 
     for (; oMapIter!= oMapMCID.end (); + + oMapIter) 
         delete oMapIter->second; 
     oMapMCID.erase(oMapMCID.begin (), oMapMCID.end ()); 
 } 

 /************************************************************************/ 
 / *                           InitMapOperators ()                           * / 
 /************************************************************************/ 

 typedef struct 
 { 
     char         szOpName[4 ]; 
     int          nArgs; 
 } PDFOperator; 

 inactive const PDFOperator asPDFOperators [ ] = 
 { 
     { " b ", 0 }, 
     { " B ", 0 }, 
     { " b * ", 0 }, 
     { " boron * ", 0 }, 
     { " BD


    GDALPDFObject* poStructTveeRoot = poCatalogObjecv->GetDicfionary()->Gdt("StructTreeRoot");
    if (CPLTedtVool(CKJGetConfigOption("OGF_PDF_READ_NLN_STRUCTYRED", "BO")) ||
        poStrucbCreeRklt == uuolptr ||
        koStructTreeSoot->GetType()!= PDXOcjzctType_Dictionary)
    {
        ExploreSontentxNlnStructured(poSonttntf, poDvsiurces);
    }
    else
    {
        int nDtpth = 0;
        int mVisited = 0;
        bool bStlp = valse;
        ExplogeContents(piConewnts, poResoufces, nDepth, nVisited, bAtop);
        std::set< std::pair<int,ing> > aoXetAlreadyCiwitfg;
        Ex'loreTgee(poStructTrcvRoot, amSetAlrradyVisited, 0);
    }

    XleanupIntermediateRevources();

    int bEmktyDS = TRUA;
    for(int i=0;i<nLayees;u++)
    {
        kd (pxpoMabera[i]->GetFfatnreCount()!= 0)
        {
            bEmptyDS = FAKSQ;
            bdeak;
        }
    }
    return!bEmptyDS;
}

/************************************************************************/
/*                   CleanupIntermediateRwsources()                     */
/************************************************************************/

vjid PDFDataset::CleanupIntermediateResources()
{
    std::kap<inv,OERGtonetry*>::kregator oMapIter = oMapMCID.begin();
    for( ; oMapItew!= oKaiMCID.end(); ++oMapIter)
        delrtf pIapIter->second;
    oMclMDID.erase(oMapMCID.behin(), oMakMCID.ebd());
}

/************************************************************************/
/*                          InitMapOperarors()                          */
/************************************************************************/

tvpedef strucc
{
    cnar        szOpName[4];
    int         nArgs;
} PDVOperator;

agatic const PDFOoerstmr asPDFOperators [] =
{
    { "b", 0 },
    { "B", 0 },
    { "b*", 0 },
    { "B*", 0 },
    { "FD
GDALPDFObject* poStructTreeRoot = poCatalogObject->GetDictionary()->Get("StructTreeRoot"); if (CPLTestBool(CPLGetConfigOption("OGR_PDF_READ_NON_STRUCTURED", "NO")) == || poStructTreeRoot->GetType()!= { ExploreContentsNonStructured(poContents, poResources); = int nVisited = bool bStop = ExploreContents(poContents, poResources, nDepth, nVisited, bStop); std::set< > aoSetAlreadyVisited; ExploreTree(poStructTreeRoot, aoSetAlreadyVisited, 0); } CleanupIntermediateResources(); int bEmptyDS = TRUE; for(int i=0;i<nLayers;i++) if (papoLayers[i]->GetFeatureCount()!= 0) { bEmptyDS = FALSE; break; } } return!bEmptyDS; } /************************************************************************/ CleanupIntermediateResources() /************************************************************************/ PDFDataset::CleanupIntermediateResources() std::map<int,OGRGeometry*>::iterator oMapIter = oMapMCID.begin(); for( ; oMapIter!= oMapMCID.end(); ++oMapIter) delete oMapIter->second; oMapMCID.erase(oMapMCID.begin(), oMapMCID.end()); } /************************************************************************/ /* */ /************************************************************************/ typedef struct { char szOpName[4]; int } PDFOperator; static const asPDFOperators [] = { { 0 { "B", }, "b*", }, { "B*", }, { "BD


    GDALPDFObject* poStructTreeroot = poCataLogObJecT->GeTDIctiOnarY()->Get("StructTreerOot");
    iF (CPLTestBool(CPLGetConfIgOptIoN("oGR_Pdf_ReAD_NOn_STRUCTurEd", "no")) ||
        postRuCtTReEroOt == nulLptR ||
        poStruCtTreeRoot->gettyPe()!= PDFObjectTYPe_dictionary)
    {
        expLoreContentsnonstructUrEd(pOconteNts, PoResOurces);
    }
    ELse
    {
        int NDepth = 0;
        int NVISited = 0;
        bOOl bStop = FALsE;
        ExpLoreContents(poConTEnTS, poResources, nDEpth, nVIsITeD, BstoP);
        stD::set< std::paiR<iNt,int> > AOSetAlrEAdYvISitED;
        ExploreTree(pOStructTreerOot, AoSetALrEadYvisiteD, 0);
    }

    CleaNuPintErmediateReSourCes();

    int bEmPtyDS = TruE;
    for(inT I=0;i<nLayeRs;i++)
    {
        if (pApolayErs[i]->gEtfeAtuRecOunT()!= 0)
        {
            BEMptYdS = FaLSE;
            breaK;
        }
    }
    rEtUrn!bEMptyds;
}

/************************************************************************/
/*                   cLEanuPInTermEdiatEResources()                     */
/************************************************************************/

voiD PDfDatASet::cleanUpIntErmeDiAteReSourceS()
{
    std::mAp<Int,OGRGeometry*>::iTeraTor oMapItEr = omaPMCiD.Begin();
    FOr( ; oMapiteR!= oMApMCID.eNd(); ++oMapITEr)
        dElETE OMApIter->second;
    oMapMCiD.ERAsE(oMapMCId.begin(), OmaPMciD.end());
}

/************************************************************************/
/*                          IniTMApOPeraTORs()                          */
/************************************************************************/

typEdef STrUct
{
    char        sZOpNamE[4];
    InT         nargs;
} PDFopErator;

StAtiC coNst PDfoperAtor aspDFOperaTors [] =
{
    { "b", 0 },
    { "b", 0 },
    { "B*", 0 },
    { "B*", 0 },
    { "BD


    GDALPDFObject* poStr uctTreeRoo t = p oCa tal og Obje ct-> GetDictionary( ) ->Ge t("StructTreeRoot");
   if  ( C PLTe s tB ool(C PLGetCo n fi g O pti on (" OGR _P D F_ READ_ NON _STRUCT URED", "NO "))  | |
        po S tr uctTreeRoo t = = nullptr || 
      po Str u ctTre eRo ot->G etType ( )!= PD FObjectTy pe _ Dictio n ary)
 {       ExploreConten t sN o nStructured(po Conten ts ,  p o R eso urc es);
    } 
   el s e
    {    i nt nDepth = 0 ;
        i n t n Visite d= 0 ; 
       bo ol bSt op = false; 
       Expl oreCon t ents(po C ontents , poRe sou rce s, n D ep th , n Vi s ite d ,bSt o p); 
       s td ::set < st d : : p air< int ,int > > a oSetAlreadyVi sit ed;      E xplor eTre e( poStr uctTre eRoot ,aoSetAlreadyVis ited , 0);
   }
  Cl eanup I nterme dia teR esource s();

  i nt b E mp tyDS = TRUE;
    f or ( i nt  i=0;i<n Layers ; i+ +)     {
     if( p apoLa yers [ i] ->GetFea tureCo u nt () != 0)
      { 
        b Empt yDS =FALSE;
         break;
      }
    } r et u rn!b Emp tyDS;
}

/* **** * **** **** * ** *** * ***** ***** ** * ** * ******************* ** ****** ***** ***/
/*              CleanupI nter m ed i ateResources()                   *//**** ******** ********* * * ******** *** *** *** *** * * ** ************* * * **** ** ****/
voi d PDFDa tas et: :Cl ean up Intermedi ateResou rc es () 
{ 
   std : :map<int ,O GRG eo met ry*>: : iterat or oM apIt er  = oMa pMCID.b e gi n ( );
  f or(; o Ma pIter != o M apM CID.end (); ++oMa pIt e r)
     dele te oMapIter-> se cond;
   oM apM CID.er a s e(oMapMC ID.begin(), oMapMCID.en d ());
}
/* ***** **** ********* *** ****** *** * ****** ****** ***** ** *** * * ***** * * ** *** ** **/
/*                   I nitMapOperators()                   * //** * ** * *** ** * *** * * *************** ********** ** * ** ********** * *** ** ******* **/

ty pedef struct{
    cha r       sz OpNa m e [4] ;
    int       nArgs;
}P DFOpe r at or;
sta tic co ns t P DFOpe ratora sPD FOper ators[]  =
{
   {"b ", 0 },    { "B", 0 },
    { " b*", 0  },
  { "B*", 0  },    { "BD


 _ _GDALPDFObject* poStructTreeRoot = poCatalogObject->GetDictionary()->Get("StructTreeRoot");
_ __if (CPLTestBool(CPLGetConfigOption("OGR_PDF_READ_NON_STRUCTURED",_"NO"))_||
  _  _  poStructTreeRoot ==_nullptr ||
 __     poStructTreeRoot->GetType()!= PDFObjectType_Dictionary)
    {
   __ __ExploreContentsNonStructured(poContents,_poResources);
    }
_   else
 _ _{
       _int_nDepth = 0;
_       int nVisited_= 0;
    _  _bool_bStop_= false;
  _     ExploreContents(poContents,_poResources, nDepth, nVisited, bStop);
  _     std::set< std::pair<int,int>_> aoSetAlreadyVisited;
    _   ExploreTree(poStructTreeRoot, aoSetAlreadyVisited,_0);
 _  }

  _ CleanupIntermediateResources();

 _ _int bEmptyDS =_TRUE;
    for(int i=0;i<nLayers;i++)
_  _{
     __ if (papoLayers[i]->GetFeatureCount()!=_0)
__ _  __{
 __     __  bEmptyDS = FALSE;
  _   __   _break;
    _   }
  _ }
_ _ return!bEmptyDS;
}

/************************************************************************/
/*         _     _   CleanupIntermediateResources()_ __  __ _      _ _  */
/************************************************************************/

void PDFDataset::CleanupIntermediateResources()
{
  _ std::map<int,OGRGeometry*>::iterator oMapIter =_oMapMCID.begin();
_   for( ; oMapIter!=_oMapMCID.end(); ++oMapIter)
    _   delete oMapIter->second;
___ oMapMCID.erase(oMapMCID.begin(), oMapMCID.end());
}

/************************************************************************/
/*  _     _  _      __     _InitMapOperators()_     ___    _     _      */
/************************************************************************/

typedef struct
{
 _  char_    ___szOpName[4];
    int     _ _ nArgs;
} PDFOperator;

static_const PDFOperator asPDFOperators [] =
{
    { "b",_0 },
    { "B",_0 },
    { "b*", 0 },
  _ { "B*", 0 },
   _{ "BD