本文整理汇总了C++中CPLString::back方法的典型用法代码示例。如果您正苦于以下问题:C++ CPLString::back方法的具体用法?C++ CPLString::back怎么用?C++ CPLString::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPLString
的用法示例。
在下文中一共展示了CPLString::back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CPLStrdup
void ISIS2Dataset::CleanString( CPLString &osInput )
{
if( ( osInput.size() < 2 ) ||
((osInput.at(0) != '"' || osInput.back() != '"' ) &&
( osInput.at(0) != '\'' || osInput.back() != '\'')) )
return;
char *pszWrk = CPLStrdup(osInput.c_str() + 1);
pszWrk[strlen(pszWrk)-1] = '\0';
for( int i = 0; pszWrk[i] != '\0'; i++ )
{
if( pszWrk[i] == ' ' )
pszWrk[i] = '_';
}
osInput = pszWrk;
CPLFree( pszWrk );
}
示例2: AnalyseAzureFileList
bool VSIDIRAz::AnalyseAzureFileList(
const CPLString& osBaseURL,
const char* pszXML)
{
#if DEBUG_VERBOSE
CPLDebug("AZURE", "%s", pszXML);
#endif
CPLXMLNode* psTree = CPLParseXMLString(pszXML);
if( psTree == nullptr )
return false;
CPLXMLNode* psEnumerationResults = CPLGetXMLNode(psTree, "=EnumerationResults");
bool bNonEmpty = false;
if( psEnumerationResults )
{
CPLString osPrefix = CPLGetXMLValue(psEnumerationResults, "Prefix", "");
CPLXMLNode* psBlobs = CPLGetXMLNode(psEnumerationResults, "Blobs");
if( psBlobs == nullptr )
{
psBlobs = CPLGetXMLNode(psEnumerationResults, "Containers");
if( psBlobs != nullptr )
bNonEmpty = true;
}
// Count the number of occurrences of a path. Can be 1 or 2. 2 in the case
// that both a filename and directory exist
std::map<CPLString, int> aoNameCount;
for(CPLXMLNode* psIter = psBlobs ? psBlobs->psChild : nullptr;
psIter != nullptr; psIter = psIter->psNext )
{
if( psIter->eType != CXT_Element )
continue;
if( strcmp(psIter->pszValue, "Blob") == 0 )
{
const char* pszKey = CPLGetXMLValue(psIter, "Name", nullptr);
if( pszKey && strstr(pszKey, GDAL_MARKER_FOR_DIR) != nullptr )
{
bNonEmpty = true;
}
else if( pszKey && strlen(pszKey) > osPrefix.size() )
{
bNonEmpty = true;
aoNameCount[pszKey + osPrefix.size()] ++;
}
}
else if( strcmp(psIter->pszValue, "BlobPrefix") == 0 ||
strcmp(psIter->pszValue, "Container") == 0 )
{
bNonEmpty = true;
const char* pszKey = CPLGetXMLValue(psIter, "Name", nullptr);
if( pszKey && strncmp(pszKey, osPrefix, osPrefix.size()) == 0 )
{
CPLString osKey = pszKey;
if( !osKey.empty() && osKey.back() == '/' )
osKey.resize(osKey.size()-1);
if( osKey.size() > osPrefix.size() )
{
aoNameCount[osKey.c_str() + osPrefix.size()] ++;
}
}
}
}
for(CPLXMLNode* psIter = psBlobs ? psBlobs->psChild : nullptr;
psIter != nullptr; psIter = psIter->psNext )
{
if( psIter->eType != CXT_Element )
continue;
if( strcmp(psIter->pszValue, "Blob") == 0 )
{
const char* pszKey = CPLGetXMLValue(psIter, "Name", nullptr);
if( pszKey && strstr(pszKey, GDAL_MARKER_FOR_DIR) != nullptr )
{
if( nRecurseDepth < 0 )
{
aoEntries.push_back(
std::unique_ptr<VSIDIREntry>(new VSIDIREntry()));
auto& entry = aoEntries.back();
entry->pszName = CPLStrdup(pszKey + osPrefix.size());
char* pszMarker = strstr(entry->pszName, GDAL_MARKER_FOR_DIR);
if( pszMarker )
*pszMarker = '\0';
entry->nMode = S_IFDIR;
entry->bModeKnown = true;
}
}
else if( pszKey && strlen(pszKey) > osPrefix.size() )
{
aoEntries.push_back(
std::unique_ptr<VSIDIREntry>(new VSIDIREntry()));
auto& entry = aoEntries.back();
entry->pszName = CPLStrdup(pszKey + osPrefix.size());
entry->nSize = static_cast<GUIntBig>(
CPLAtoGIntBig(CPLGetXMLValue(psIter, "Properties.Content-Length", "0")));
entry->bSizeKnown = true;
entry->nMode = S_IFDIR;
entry->bModeKnown = true;
//.........这里部分代码省略.........
示例3: while
OGRFeature *OGRAeronavFAARouteLayer::GetNextRawFeature()
{
OGRFeature* poFeature = nullptr;
OGRLineString* poLS = nullptr;
while( true )
{
const char* pszLine = nullptr;
if (!osLastReadLine.empty())
pszLine = osLastReadLine.c_str();
else
pszLine = CPLReadLine2L(fpAeronavFAA, 87, nullptr);
osLastReadLine = "";
if (pszLine == nullptr)
{
bEOF = true;
break;
}
if (strlen(pszLine) != 85)
continue;
if (bIsDPOrSTARS && STARTS_WITH(pszLine, "===") && pszLine[3] != '=')
{
osAPTName = pszLine + 3;
const char* pszComma = strchr(pszLine + 3, ',');
if (pszComma)
{
osAPTName.resize(pszComma - (pszLine + 3));
osStateName = pszComma + 2;
const char* pszEqual = strchr(pszComma + 2, '=');
if (pszEqual)
osStateName.resize(pszEqual - (pszComma + 2));
}
else
{
const char* pszEqual = strchr(pszLine + 3, '=');
if (pszEqual)
osAPTName.resize(pszEqual - (pszLine + 3));
osStateName = "";
}
}
if (STARTS_WITH(pszLine + 2, "FACILITY OR"))
continue;
if (STARTS_WITH(pszLine + 2, "INTERSECTION"))
continue;
if (strcmp(pszLine, "================================DELETIONS LIST=================================198326") == 0)
{
bEOF = true;
break;
}
if (poFeature == nullptr)
{
if (pszLine[2] == ' ' || pszLine[2] == '-' )
{
continue;
}
if (STARTS_WITH(pszLine + 29, " ") ||
strchr(pszLine, '(') != nullptr)
{
CPLString osName = pszLine + 2;
osName.resize(60);
while(!osName.empty() && osName.back() == ' ')
{
osName.resize(osName.size()-1);
}
if (strcmp(osName.c_str(), "(DELETIONS LIST)") == 0)
{
bEOF = true;
return nullptr;
}
poFeature = new OGRFeature(poFeatureDefn);
poFeature->SetFID(nNextFID ++);
if (bIsDPOrSTARS)
{
poFeature->SetField(0, osAPTName);
poFeature->SetField(1, osStateName);
poFeature->SetField(2, osName);
}
else
poFeature->SetField(0, osName);
poLS = new OGRLineString();
}
continue;
}
if (STARTS_WITH(pszLine, " 0"))
{
if (poLS->getNumPoints() == 0)
continue;
else
break;
}
//.........这里部分代码省略.........