本文整理汇总了C++中CPLString::endsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ CPLString::endsWith方法的具体用法?C++ CPLString::endsWith怎么用?C++ CPLString::endsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPLString
的用法示例。
在下文中一共展示了CPLString::endsWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: osStatement
/*
* ExecuteSQL()
*/
OGRLayer *OGRNGWDataset::ExecuteSQL( const char *pszStatement,
OGRGeometry *poSpatialFilter, const char *pszDialect )
{
// Clean statement string.
CPLString osStatement(pszStatement);
osStatement = osStatement.Trim().replaceAll(" ", " ");
if( STARTS_WITH_CI(osStatement.c_str(), "DELLAYER:") )
{
CPLString osLayerName = osStatement.substr(9);
if( osLayerName.endsWith(";") )
{
osLayerName = osLayerName.substr(0, osLayerName.size() - 1);
osLayerName.Trim();
}
CPLDebug("NGW", "Delete layer with name %s.", osLayerName.c_str());
for( int iLayer = 0; iLayer < nLayers; ++iLayer )
{
if( EQUAL(papoLayers[iLayer]->GetName(), osLayerName.c_str() ) )
{
DeleteLayer( iLayer );
break;
}
}
return nullptr;
}
if( STARTS_WITH_CI(osStatement.c_str(), "DELETE FROM") )
{
// Get layer name from pszStatement DELETE FROM layer;.
CPLString osLayerName = osStatement.substr(12);
if( osLayerName.endsWith(";") )
{
osLayerName = osLayerName.substr(0, osLayerName.size() - 1);
osLayerName.Trim();
}
CPLDebug("NGW", "Delete features from layer with name %s.", osLayerName.c_str());
OGRNGWLayer *poLayer = static_cast<OGRNGWLayer*>(GetLayerByName(osLayerName));
if( poLayer )
{
poLayer->DeleteAllFeatures();
}
else
{
CPLError(CE_Failure, CPLE_AppDefined, "Unknown layer : %s",
osLayerName.c_str());
}
return nullptr;
}
return GDALDataset::ExecuteSQL(pszStatement, poSpatialFilter, pszDialect);
}