本文整理汇总了C++中STARTS_WITH_CI函数的典型用法代码示例。如果您正苦于以下问题:C++ STARTS_WITH_CI函数的具体用法?C++ STARTS_WITH_CI怎么用?C++ STARTS_WITH_CI使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STARTS_WITH_CI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OGRPGDriverIdentify
static int OGRPGDriverIdentify( GDALOpenInfo* poOpenInfo )
{
if( !STARTS_WITH_CI(poOpenInfo->pszFilename, "PGB:") &&
!STARTS_WITH_CI(poOpenInfo->pszFilename, "PG:") )
return FALSE;
return TRUE;
}
示例2: Identify
int DTEDDataset::Identify( GDALOpenInfo * poOpenInfo )
{
/* -------------------------------------------------------------------- */
/* Does the file start with one of the possible DTED header */
/* record types, and do we have a UHL marker? */
/* -------------------------------------------------------------------- */
if( poOpenInfo->nHeaderBytes < 240 )
return FALSE;
if( !STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader, "VOL")
&& !STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader, "HDR")
&& !STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader, "UHL") )
{
return FALSE;
}
bool bFoundUHL = false;
for(int i=0;i<poOpenInfo->nHeaderBytes-3 && !bFoundUHL ;i += DTED_UHL_SIZE)
{
if( STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader + i, "UHL") )
{
bFoundUHL = true;
}
}
if (!bFoundUHL)
return FALSE;
return TRUE;
}
示例3: CPLFormCIFilename
int TSXDataset::Identify( GDALOpenInfo *poOpenInfo )
{
if (poOpenInfo->fpL == NULL || poOpenInfo->nHeaderBytes < 260)
{
if( poOpenInfo->bIsDirectory )
{
const CPLString osFilename =
CPLFormCIFilename( poOpenInfo->pszFilename, CPLGetFilename( poOpenInfo->pszFilename ), "xml" );
/* Check if the filename contains TSX1_SAR (TerraSAR-X) or TDX1_SAR (TanDEM-X) */
if (!(STARTS_WITH_CI(CPLGetBasename( osFilename ), "TSX1_SAR") ||
STARTS_WITH_CI(CPLGetBasename( osFilename ), "TDX1_SAR")))
return 0;
VSIStatBufL sStat;
if( VSIStatL( osFilename, &sStat ) == 0 )
return 1;
}
return 0;
}
/* Check if the filename contains TSX1_SAR (TerraSAR-X) or TDX1_SAR (TanDEM-X) */
if (!(STARTS_WITH_CI(CPLGetBasename( poOpenInfo->pszFilename ), "TSX1_SAR") ||
STARTS_WITH_CI(CPLGetBasename( poOpenInfo->pszFilename ), "TDX1_SAR")))
return 0;
/* finally look for the <level1Product tag */
if (!STARTS_WITH_CI(reinterpret_cast<char *>( poOpenInfo->pabyHeader ),
"<level1Product") )
return 0;
return 1;
}
示例4: if
static GDALDataset *OGRBNADriverOpen( GDALOpenInfo* poOpenInfo )
{
// --------------------------------------------------------------------
// Does this appear to be a .bna file?
// --------------------------------------------------------------------
const char* pszFilename = poOpenInfo->pszFilename;
if( STARTS_WITH_CI(pszFilename, "BNA:") )
{
pszFilename += 4;
}
else if( poOpenInfo->fpL == nullptr ||
!(EQUAL( CPLGetExtension(pszFilename), "bna" )
|| ((STARTS_WITH_CI(pszFilename, "/vsigzip/") ||
STARTS_WITH_CI(pszFilename, "/vsizip/")) &&
(strstr( pszFilename, ".bna") ||
strstr( pszFilename, ".BNA")))) )
{
return nullptr;
}
OGRBNADataSource *poDS = new OGRBNADataSource();
if( !poDS->Open( pszFilename, poOpenInfo->eAccess == GA_Update ) )
{
delete poDS;
poDS = nullptr;
}
return poDS;
}
示例5: OGRGeoJSONDriverOpen
static GDALDataset* OGRGeoJSONDriverOpen( GDALOpenInfo* poOpenInfo )
{
GeoJSONSourceType nSrcType;
if( OGRGeoJSONDriverIdentifyInternal(poOpenInfo, nSrcType) == FALSE )
return NULL;
OGRGeoJSONDataSource* poDS
= new OGRGeoJSONDataSource();
/* -------------------------------------------------------------------- */
/* Processing configuration options. */
/* -------------------------------------------------------------------- */
// TODO: Currently, options are based on environment variables.
// This is workaround for not yet implemented Andrey's concept
// described in document 'RFC 10: OGR Open Parameters'.
poDS->SetGeometryTranslation( OGRGeoJSONDataSource::eGeometryPreserve );
const char* pszOpt = CPLGetConfigOption("GEOMETRY_AS_COLLECTION", NULL);
if( NULL != pszOpt && STARTS_WITH_CI(pszOpt, "YES") )
{
poDS->SetGeometryTranslation(
OGRGeoJSONDataSource::eGeometryAsCollection );
}
poDS->SetAttributesTranslation( OGRGeoJSONDataSource::eAttributesPreserve );
pszOpt = CPLGetConfigOption("ATTRIBUTES_SKIP", NULL);
if( NULL != pszOpt && STARTS_WITH_CI(pszOpt, "YES") )
{
poDS->SetAttributesTranslation(
OGRGeoJSONDataSource::eAttributesSkip );
}
/* -------------------------------------------------------------------- */
/* Open and start processing GeoJSON datasource to OGR objects. */
/* -------------------------------------------------------------------- */
if( !poDS->Open( poOpenInfo, nSrcType ) )
{
delete poDS;
poDS = NULL;
}
if( poDS != NULL && poDS->HasOtherPages() )
{
const char* pszFSP = CSLFetchNameValue(poOpenInfo->papszOpenOptions,
"FEATURE_SERVER_PAGING");
bool bHasResultOffset = CPLURLGetValue( poOpenInfo->pszFilename,
"resultOffset").size() > 0;
if( (!bHasResultOffset && (pszFSP == NULL || CPLTestBool(pszFSP))) ||
(bHasResultOffset && pszFSP != NULL && CPLTestBool(pszFSP)) )
{
return new OGRESRIFeatureServiceDataset(poOpenInfo->pszFilename,
poDS);
}
}
return poDS;
}
示例6: STARTS_WITH_CI
int NDFDataset::Identify( GDALOpenInfo * poOpenInfo )
{
/* -------------------------------------------------------------------- */
/* The user must select the header file (i.e. .H1). */
/* -------------------------------------------------------------------- */
return poOpenInfo->nHeaderBytes >= 50 &&
(STARTS_WITH_CI(reinterpret_cast<const char *>( poOpenInfo->pabyHeader ), "NDF_REVISION=2")
|| STARTS_WITH_CI(reinterpret_cast<const char *>( poOpenInfo->pabyHeader ), "NDF_REVISION=0")) ;
}
示例7: Open
int TABIDFile::Open(const char *pszFname, const char* pszAccess)
{
if( STARTS_WITH_CI(pszAccess, "r") )
return Open(pszFname, TABRead);
else if( STARTS_WITH_CI(pszAccess, "w") )
return Open(pszFname, TABWrite);
else
{
CPLError(CE_Failure, CPLE_FileIO,
"Open() failed: access mode \"%s\" not supported", pszAccess);
return -1;
}
}
示例8: GNMDBDriverIdentify
static int GNMDBDriverIdentify( GDALOpenInfo* poOpenInfo )
{
if( !STARTS_WITH_CI(poOpenInfo->pszFilename, "PGB:") &&
!STARTS_WITH_CI(poOpenInfo->pszFilename, "PG:") )
return FALSE;
if( (poOpenInfo->nOpenFlags & GDAL_OF_GNM) == 0 )
return FALSE;
// TODO: do we need to open datasource end check tables/layer exist?
return TRUE;
}
示例9: GeoJSONGetProtocolType
GeoJSONProtocolType GeoJSONGetProtocolType( const char* pszSource )
{
GeoJSONProtocolType ptclType = eGeoJSONProtocolUnknown;
if( STARTS_WITH_CI(pszSource, "http:") )
ptclType = eGeoJSONProtocolHTTP;
else if( STARTS_WITH_CI(pszSource, "https:") )
ptclType = eGeoJSONProtocolHTTPS;
else if( STARTS_WITH_CI(pszSource, "ftp:") )
ptclType = eGeoJSONProtocolFTP;
return ptclType;
}
示例10: Open
int IMapInfoFile::Open(const char *pszFname, const char* pszAccess,
GBool bTestOpenNoError)
{
if( STARTS_WITH_CI(pszAccess, "r") )
return Open(pszFname, TABRead, bTestOpenNoError);
else if( STARTS_WITH_CI(pszAccess, "w") )
return Open(pszFname, TABWrite, bTestOpenNoError);
else
{
CPLError(CE_Failure, CPLE_FileIO,
"Open() failed: access mode \"%s\" not supported", pszAccess);
return -1;
}
}
示例11: STARTS_WITH_CI
int E00GRIDDataset::Identify( GDALOpenInfo * poOpenInfo )
{
if (poOpenInfo->nHeaderBytes == 0)
return FALSE;
if (!(STARTS_WITH_CI((const char*)poOpenInfo->pabyHeader, "EXP 0") ||
STARTS_WITH_CI((const char*)poOpenInfo->pabyHeader, "EXP 1")))
return FALSE;
/* FIXME: handle GRD 3 if that ever exists ? */
if (strstr((const char*)poOpenInfo->pabyHeader, "GRD 2") == NULL)
return FALSE;
return TRUE;
}
示例12: GetRasterBand
void *MEMDataset::GetInternalHandle( const char * pszRequest )
{
// check for MEMORYnnn string in pszRequest (nnnn can be up to 10
// digits, or even omitted)
if( STARTS_WITH_CI(pszRequest, "MEMORY"))
{
if(int BandNumber = static_cast<int>(CPLScanLong(&pszRequest[6], 10)))
{
MEMRasterBand *RequestedRasterBand =
reinterpret_cast<MEMRasterBand *>( GetRasterBand(BandNumber) );
// we're within a MEMDataset so the only thing a RasterBand
// could be is a MEMRasterBand
if( RequestedRasterBand != NULL )
{
// return the internal band data pointer
return(RequestedRasterBand->GetData());
}
}
}
return NULL;
}
示例13: while
CPLString OGRGFTLayer::PatchSQL(const char* pszSQL)
{
CPLString osSQL;
while(*pszSQL)
{
if (STARTS_WITH_CI(pszSQL, "COUNT(") && strchr(pszSQL, ')'))
{
const char* pszNext = strchr(pszSQL, ')');
osSQL += "COUNT()";
pszSQL = pszNext + 1;
}
else if ((*pszSQL == '<' && pszSQL[1] == '>') ||
(*pszSQL == '!' && pszSQL[1] == '='))
{
osSQL += " NOT EQUAL TO ";
pszSQL += 2;
}
else
{
osSQL += *pszSQL;
pszSQL ++;
}
}
return osSQL;
}
示例14: OGRDB2DriverIdentify
static int OGRDB2DriverIdentify( GDALOpenInfo* poOpenInfo )
{
if( STARTS_WITH_CI(poOpenInfo->pszFilename, DB2ODBC_PREFIX) )
return TRUE;
return FALSE;
}
示例15: RawRasterBand
PAuxRasterBand::PAuxRasterBand( GDALDataset *poDSIn, int nBandIn,
VSILFILE * fpRawIn, vsi_l_offset nImgOffsetIn,
int nPixelOffsetIn, int nLineOffsetIn,
GDALDataType eDataTypeIn, int bNativeOrderIn ) :
RawRasterBand( poDSIn, nBandIn, fpRawIn,
nImgOffsetIn, nPixelOffsetIn, nLineOffsetIn,
eDataTypeIn, bNativeOrderIn, RawRasterBand::OwnFP::NO )
{
PAuxDataset *poPDS = reinterpret_cast<PAuxDataset *>( poDS );
/* -------------------------------------------------------------------- */
/* Does this channel have a description? */
/* -------------------------------------------------------------------- */
char szTarget[128] = { '\0' };
snprintf( szTarget, sizeof(szTarget), "ChanDesc-%d", nBand );
if( CSLFetchNameValue( poPDS->papszAuxLines, szTarget ) != nullptr )
GDALRasterBand::SetDescription(
CSLFetchNameValue( poPDS->papszAuxLines, szTarget ) );
/* -------------------------------------------------------------------- */
/* See if we have colors. Currently we must have color zero, */
/* but this should not really be a limitation. */
/* -------------------------------------------------------------------- */
snprintf( szTarget, sizeof(szTarget),
"METADATA_IMG_%d_Class_%d_Color", nBand, 0 );
if( CSLFetchNameValue( poPDS->papszAuxLines, szTarget ) != nullptr )
{
poCT = new GDALColorTable();
for( int i = 0; i < 256; i++ )
{
snprintf( szTarget, sizeof(szTarget),
"METADATA_IMG_%d_Class_%d_Color", nBand, i );
const char *pszLine
= CSLFetchNameValue( poPDS->papszAuxLines, szTarget );
while( pszLine && *pszLine == ' ' )
pszLine++;
int nRed = 0;
int nGreen = 0;
int nBlue = 0;
// TODO(schwehr): Replace sscanf with something safe.
if( pszLine != nullptr
&& STARTS_WITH_CI(pszLine, "(RGB:")
&& sscanf( pszLine+5, "%d %d %d",
&nRed, &nGreen, &nBlue ) == 3 )
{
GDALColorEntry oColor = {
static_cast<short>(nRed),
static_cast<short>(nGreen),
static_cast<short>(nBlue),
255
};
poCT->SetColorEntry( i, &oColor );
}
}
}
}