static void NTFDump( const char * pszFile, char **papszOptions ) { OGRFeature *poFeature; OGRNTFDataSource oDS; oDS.SetOptionList( papszOptions ); if( !oDS.Open( pszFile ) ) return; while( (poFeature = oDS.GetNextFeature()) != NULL ) { printf( "-------------------------------------\n" ); poFeature->DumpReadable( stdout ); delete poFeature; } }
static GDALDataset *OGRNTFDriverOpen( GDALOpenInfo* poOpenInfo ) { if( !poOpenInfo->bStatOK ) return nullptr; if( poOpenInfo->fpL != nullptr ) { if( poOpenInfo->nHeaderBytes < 80 ) return nullptr; const char* pszHeader = (const char*)poOpenInfo->pabyHeader; if( !STARTS_WITH_CI(pszHeader, "01") ) return nullptr; int j = 0; // Used after for. for( ; j < 80; j++ ) { if( pszHeader[j] == 10 || pszHeader[j] == 13 ) break; } if( j == 80 || pszHeader[j-1] != '%' ) return nullptr; } OGRNTFDataSource *poDS = new OGRNTFDataSource; if( !poDS->Open( poOpenInfo->pszFilename, TRUE ) ) { delete poDS; poDS = nullptr; } if( poDS != nullptr && poOpenInfo->eAccess == GA_Update ) { CPLError( CE_Failure, CPLE_OpenFailed, "NTF Driver doesn't support update." ); delete poDS; poDS = nullptr; } return poDS; }