mitab/mitab_tabfile.cpp
int TABFile::GetNextFeatureId(int nPrevId)
{
    if (m_eAccessMode != TABRead)
    {
        CPLError(CE_Failure, CPLE_NotSupported,
                 "GetNextFeatureId() can be used only with Read access.");
        return -1;
    }

    /*-----------------------------------------------------------------
     * Are we using spatial rather than .ID based traversal?
     *----------------------------------------------------------------*/
    if( bUseSpatialTraversal )
        return m_poMAPFile->GetNextFeatureId( nPrevId );

    /*-----------------------------------------------------------------
     * Establish what the next logical feature ID should be
     *----------------------------------------------------------------*/
    int nFeatureId = -1;

    if (nPrevId <= 0 && m_nLastFeatureId > 0)
        nFeatureId = 1;       // Feature Ids start at 1
    else if (nPrevId > 0 && nPrevId < m_nLastFeatureId)
        nFeatureId = nPrevId + 1;
    else
    {
        // This was the last feature
        return OGRNullFID;
    }

    /*-----------------------------------------------------------------
     * Skip any feature with NONE geometry and a deleted attribute record
     *----------------------------------------------------------------*/
    while(nFeatureId <= m_nLastFeatureId)
    {
        if ( m_poMAPFile->MoveToObjId(nFeatureId) != 0 ||
             m_poDATFile->GetRecordBlock(nFeatureId) == NULL )
        {
            CPLError(CE_Failure, CPLE_IllegalArg,
                     "GetNextFeatureId() failed: unable to set read pointer "
                     "to feature id %d",  nFeatureId);
            return -1;
        }

// __TODO__ Add a test here to check if object is deleted, 
// i.e. 0x40 set on object_id in object block
        if (m_poMAPFile->GetCurObjType() != TAB_GEOM_NONE ||
            m_poDATFile->IsCurrentRecordDeleted() == FALSE)
        {
            // This feature contains at least a geometry or some attributes...
            // return its id.
            return nFeatureId;
        }

        nFeatureId++;
    }

    // If we reached this point, then we kept skipping deleted features
    // and stopped when EOF was reached.
    return -1;
}
/**********************************************************************
 *                   TABFile::GetNextFeatureId()
 *
 * Returns feature id that follows nPrevId, or -1 if it is the
 * last feature id.  Pass nPrevId=-1 to fetch the first valid feature id.
 **********************************************************************/
:GetNextFeatureId()
Returns feature id that follows nPrevId, or -1 if it is the
last feature id.  Pass nPrevId=-1 to fetch the first valid feature id.
: GetNextFeatureId () Returns feature id that follows nPrevId or - 1 if it is the last feature id . Pass nPrevId = - 1 to fetch the first valid feature id .
int TABFile::GetNextFeatureId(int nPrevId)
{
    if (m_eAccessMode != TABRead)
    {
        CPLError(CE_Failure, CPLE_NotSupported,
                 "GetNextFeatureId() can be used only with Read access.");
        return -1;
    }
    if( bUseSpatialTraversal )
        return m_poMAPFile->GetNextFeatureId( nPrevId );
    int nFeatureId = -1;
    if (nPrevId <= 0 && m_nLastFeatureId > 0)
        nFeatureId = 1;       
    else if (nPrevId > 0 && nPrevId < m_nLastFeatureId)
        nFeatureId = nPrevId + 1;
    else
    {
        return OGRNullFID;
    }
    while(nFeatureId <= m_nLastFeatureId)
    {
        if ( m_poMAPFile->MoveToObjId(nFeatureId) != 0 ||
             m_poDATFile->GetRecordBlock(nFeatureId) == NULL )
        {
            CPLError(CE_Failure, CPLE_IllegalArg,
                     "GetNextFeatureId() failed: unable to set read pointer "
                     "to feature id %d",  nFeatureId);
            return -1;
        }
        if (m_poMAPFile->GetCurObjType() != TAB_GEOM_NONE ||
            m_poDATFile->IsCurrentRecordDeleted() == FALSE)
        {
            return nFeatureId;
        }
        nFeatureId++;
    }
    return -1;
}
int TABFile :: GetNextFeatureId ( int nPrevId ) { if ( m_eAccessMode != TABRead ) { CPLError ( CE_Failure , CPLE_NotSupported , " " ) ; return -1 ; } if ( bUseSpatialTraversal ) return m_poMAPFile -> GetNextFeatureId ( nPrevId ) ; int nFeatureId = -1 ; if ( nPrevId <= 0 && m_nLastFeatureId > 0 ) nFeatureId = 1 ; else if ( nPrevId > 0 && nPrevId < m_nLastFeatureId ) nFeatureId = nPrevId + 1 ; else { return OGRNullFID ; } while ( nFeatureId <= m_nLastFeatureId ) { if ( m_poMAPFile -> MoveToObjId ( nFeatureId ) != 0 || m_poDATFile -> GetRecordBlock ( nFeatureId ) == NULL ) { CPLError ( CE_Failure , CPLE_IllegalArg , " " " " , nFeatureId ) ; return -1 ; } if ( m_poMAPFile -> GetCurObjType ( ) != TAB_GEOM_NONE || m_poDATFile -> IsCurrentRecordDeleted ( ) == FALSE ) { return nFeatureId ; } nFeatureId ++ ; } return -1 ; }
TABFile::GetNextFeatureId()
 Returns feature id that follows nPrevId, or -1 if it is the
 last feature id.
TABFile :: GetNextFeatureId () Returns feature id that follows nPrevId or - 1 if it is the last feature id .
/*-----------------------------------------------------------------
     * Are we using spatial rather than .ID based traversal?
     *----------------------------------------------------------------*/ /*-----------------------------------------------------------------
     * Establish what the next logical feature ID should be
     *----------------------------------------------------------------*/ // Feature Ids start at 1 // This was the last feature /*-----------------------------------------------------------------
     * Skip any feature with NONE geometry and a deleted attribute record
     *----------------------------------------------------------------*/ // __TODO__ Add a test here to check if object is deleted,  // i.e. 0x40 set on object_id in object block // This feature contains at least a geometry or some attributes... // return its id. // If we reached this point, then we kept skipping deleted features // and stopped when EOF was reached.