本文整理汇总了C++中CPLStringList::AddStringDirectly方法的典型用法代码示例。如果您正苦于以下问题:C++ CPLStringList::AddStringDirectly方法的具体用法?C++ CPLStringList::AddStringDirectly怎么用?C++ CPLStringList::AddStringDirectly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPLStringList
的用法示例。
在下文中一共展示了CPLStringList::AddStringDirectly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XMLInit
int GDALMultiDomainMetadata::XMLInit( CPLXMLNode *psTree, CPL_UNUSED int bMerge )
{
CPLXMLNode *psMetadata;
/* ==================================================================== */
/* Process all <Metadata> elements, each for one domain. */
/* ==================================================================== */
for( psMetadata = psTree->psChild;
psMetadata != NULL; psMetadata = psMetadata->psNext )
{
CPLXMLNode *psMDI;
const char *pszDomain, *pszFormat;
if( psMetadata->eType != CXT_Element
|| !EQUAL(psMetadata->pszValue,"Metadata") )
continue;
pszDomain = CPLGetXMLValue( psMetadata, "domain", "" );
pszFormat = CPLGetXMLValue( psMetadata, "format", "" );
// Make sure we have a CPLStringList for this domain,
// without wiping out an existing one.
if( GetMetadata( pszDomain ) == NULL )
SetMetadata( NULL, pszDomain );
int iDomain = CSLFindString( papszDomainList, pszDomain );
CPLAssert( iDomain != -1 );
CPLStringList *poMDList = papoMetadataLists[iDomain];
/* -------------------------------------------------------------------- */
/* XML format subdocuments. */
/* -------------------------------------------------------------------- */
if( EQUAL(pszFormat,"xml") )
{
CPLXMLNode *psSubDoc;
/* find first non-attribute child of current element */
psSubDoc = psMetadata->psChild;
while( psSubDoc != NULL && psSubDoc->eType == CXT_Attribute )
psSubDoc = psSubDoc->psNext;
char *pszDoc = CPLSerializeXMLTree( psSubDoc );
poMDList->Clear();
poMDList->AddStringDirectly( pszDoc );
}
/* -------------------------------------------------------------------- */
/* Name value format. */
/* <MDI key="...">value_Text</MDI> */
/* -------------------------------------------------------------------- */
else
{
for( psMDI = psMetadata->psChild; psMDI != NULL;
psMDI = psMDI->psNext )
{
if( !EQUAL(psMDI->pszValue,"MDI")
|| psMDI->eType != CXT_Element
|| psMDI->psChild == NULL
|| psMDI->psChild->psNext == NULL
|| psMDI->psChild->eType != CXT_Attribute
|| psMDI->psChild->psChild == NULL )
continue;
char* pszName = psMDI->psChild->psChild->pszValue;
char* pszValue = psMDI->psChild->psNext->pszValue;
if( pszName != NULL && pszValue != NULL )
poMDList->SetNameValue( pszName, pszValue );
}
}
}
return CSLCount(papszDomainList) != 0;
}