CPLFileFinder CPLPopFileFinder() { CPLFileFinder pfnReturn; CPLFinderInit(); #ifdef __WXOSX__ if( nFileFinders == 0) { CPLFree( papfnFinders ); papfnFinders = NULL; return NULL; } pfnReturn = papfnFinders[--nFileFinders]; #else if( nFileFinders == 0 ) return NULL; pfnReturn = papfnFinders[--nFileFinders]; if( nFileFinders == 0) { CPLFree( papfnFinders ); papfnFinders = NULL; } #endif return pfnReturn; }
void CPLPushFinderLocation( const char *pszLocation ) { FindFileTLS* pTLSData = CPLFinderInit(); pTLSData->papszFinderLocations = CSLAddString( pTLSData->papszFinderLocations, pszLocation ); }
void CPLPushFinderLocation( const char *pszLocation ) { CPLFinderInit(); papszFinderLocations = CSLAddString( papszFinderLocations, pszLocation ); }
void CPLPushFileFinder( CPLFileFinder pfnFinder ) { FindFileTLS* pTLSData = CPLFinderInit(); pTLSData->papfnFinders = (CPLFileFinder *) CPLRealloc(pTLSData->papfnFinders, sizeof(void*) * ++pTLSData->nFileFinders); pTLSData->papfnFinders[pTLSData->nFileFinders-1] = pfnFinder; }
void CPLPushFileFinder( CPLFileFinder pfnFinder ) { CPLFinderInit(); papfnFinders = (CPLFileFinder *) CPLRealloc(papfnFinders, sizeof(void*) * ++nFileFinders); papfnFinders[nFileFinders-1] = pfnFinder; }
void CPLPushFinderLocation( const char *pszLocation ) { FindFileTLS* pTLSData = CPLFinderInit(); if( pTLSData == NULL ) return; pTLSData->papszFinderLocations = CSLAddStringMayFail( pTLSData->papszFinderLocations, pszLocation ); }
void CPLPushFileFinder( CPLFileFinder pfnFinder ) { FindFileTLS* pTLSData = CPLFinderInit(); if (pTLSData == NULL ) return; pTLSData->papfnFinders = static_cast<CPLFileFinder *>( CPLRealloc(pTLSData->papfnFinders, sizeof(CPLFileFinder) * ++pTLSData->nFileFinders) ); pTLSData->papfnFinders[pTLSData->nFileFinders-1] = pfnFinder; }
/** CPLPushFinderLocation */ void CPLPushFinderLocation( const char *pszLocation ) { FindFileTLS* pTLSData = CPLFinderInit(); if( pTLSData == nullptr ) return; // Check if location already is in list. if( CSLFindStringCaseSensitive(pTLSData->papszFinderLocations, pszLocation) > -1 ) return; pTLSData->papszFinderLocations = CSLAddStringMayFail( pTLSData->papszFinderLocations, pszLocation ); }
const char *CPLFindFile( const char *pszClass, const char *pszBasename ) { FindFileTLS* pTLSData = CPLFinderInit(); if( pTLSData == NULL ) return NULL; for( int i = pTLSData->nFileFinders-1; i >= 0; i-- ) { const char * pszResult = (pTLSData->papfnFinders[i])( pszClass, pszBasename ); if( pszResult != NULL ) return pszResult; } return NULL; }
const char *CPLFindFile( const char *pszClass, const char *pszBasename ) { int i; CPLFinderInit(); for( i = nFileFinders-1; i >= 0; i-- ) { const char * pszResult; pszResult = (papfnFinders[i])( pszClass, pszBasename ); if( pszResult != NULL ) return pszResult; } return NULL; }
void CPLPopFinderLocation() { int nCount; CPLFinderInit(); nCount = CSLCount(papszFinderLocations); if( nCount == 0 ) return; CPLFree( papszFinderLocations[nCount-1] ); papszFinderLocations[nCount-1] = NULL; if( nCount == 1 ) { CPLFree( papszFinderLocations ); papszFinderLocations = NULL; } }
CPLFileFinder CPLPopFileFinder() { CPLFileFinder pfnReturn; CPLFinderInit(); if( nFileFinders == 0 ) return NULL; pfnReturn = papfnFinders[--nFileFinders]; if( nFileFinders == 0) { CPLFree( papfnFinders ); papfnFinders = NULL; } return pfnReturn; }
CPLFileFinder CPLPopFileFinder() { CPLFileFinder pfnReturn; FindFileTLS* pTLSData = CPLFinderInit(); if( pTLSData->nFileFinders == 0 ) return NULL; pfnReturn = pTLSData->papfnFinders[--pTLSData->nFileFinders]; if( pTLSData->nFileFinders == 0) { CPLFree( pTLSData->papfnFinders ); pTLSData->papfnFinders = NULL; } return pfnReturn; }
void CPLPopFinderLocation() { int nCount; FindFileTLS* pTLSData = CPLFinderInit(); if( pTLSData->papszFinderLocations == NULL ) return; nCount = CSLCount(pTLSData->papszFinderLocations); if( nCount == 0 ) return; CPLFree( pTLSData->papszFinderLocations[nCount-1] ); pTLSData->papszFinderLocations[nCount-1] = NULL; if( nCount == 1 ) { CPLFree( pTLSData->papszFinderLocations ); pTLSData->papszFinderLocations = NULL; } }
void CPLPopFinderLocation() { CPLPopFinderLocationInternal(CPLFinderInit()); }
CPLFileFinder CPLPopFileFinder() { return CPLPopFileFinderInternal(CPLFinderInit()); }