本文整理汇总了C++中CItemType::GetAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemType::GetAttributes方法的具体用法?C++ CItemType::GetAttributes怎么用?C++ CItemType::GetAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemType
的用法示例。
在下文中一共展示了CItemType::GetAttributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutputByAttribute
void OutputByAttribute (SItemTableCtx &Ctx, const SItemTypeList &ItemList)
{
int i, j;
// Make a categorized list by attribute
SByAttributeTypeList ByAttributeTable;
for (i = 0; i < ItemList.GetCount(); i++)
{
const CString &sKey = ItemList.GetKey(i);
CItemType *pType = ItemList[i];
// Loop over all attributes
TArray<CString> Attribs;
ParseAttributes(pType->GetAttributes(), &Attribs);
for (j = 0; j < Attribs.GetCount(); j++)
{
bool bNew;
SAttributeEntry *pEntry = ByAttributeTable.SetAt(Attribs[j], &bNew);
if (bNew)
pEntry->sAttribute = Attribs[j];
pEntry->ItemTable.Insert(sKey, pType);
}
// If no attribute
if (Attribs.GetCount() == 0)
{
bool bNew;
SAttributeEntry *pEntry = ByAttributeTable.SetAt(CONSTLIT("(none)"), &bNew);
if (bNew)
pEntry->sAttribute = CONSTLIT("(none)");
pEntry->ItemTable.Insert(sKey, pType);
}
}
// Now loop over all attributes
for (i = 0; i < ByAttributeTable.GetCount(); i++)
{
const SAttributeEntry &Entry = ByAttributeTable[i];
printf("%s\n\n", Entry.sAttribute.GetASCIIZPointer());
OutputHeader(Ctx);
OutputTable(Ctx, Entry.ItemTable);
printf("\n");
}
}