本文整理汇总了C++中BNode::GetNextAttrName方法的典型用法代码示例。如果您正苦于以下问题:C++ BNode::GetNextAttrName方法的具体用法?C++ BNode::GetNextAttrName怎么用?C++ BNode::GetNextAttrName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BNode
的用法示例。
在下文中一共展示了BNode::GetNextAttrName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/* copy atribytes */
bool
BF_GUI_FilesPanel_CopyTask::Copy_Atributes(BNode & o_NodeSrc,BNode & o_NodeDest)
{
char pcName[B_ATTR_NAME_LENGTH];
attr_info uAttrInfo;
uint32 iBufMaxSize=255;
char *pcBuf = (char*)malloc(iBufMaxSize);
o_NodeSrc.RewindAttrs();
//
while(B_OK==o_NodeSrc.GetNextAttrName(pcName)) {
if(B_OK==o_NodeSrc.GetAttrInfo(pcName,&uAttrInfo)) {
/* check buffer size */
if(uAttrInfo.size>iBufMaxSize) {
DELETE(pcBuf);
iBufMaxSize = uAttrInfo.size;
pcBuf = (char*)malloc(iBufMaxSize);
}
/* read attr */
o_NodeSrc.ReadAttr(pcName,uAttrInfo.type,0,
(void*)pcBuf,uAttrInfo.size);
/* write attr */
o_NodeDest.WriteAttr(pcName,uAttrInfo.type,
0,(void*)pcBuf,uAttrInfo.size);
/* check for cancel_process */
if(Canceled()) return false;
}
}
DELETE(pcBuf);
return true;
}/* end of atributes */
示例2: file
void
ResView::OpenFile(const entry_ref &ref)
{
// Add all the 133t resources and attributes of the file
BFile file(&ref, B_READ_ONLY);
BResources resources;
if (resources.SetTo(&file) != B_OK)
return;
file.Unset();
resources.PreloadResourceType();
int32 index = 0;
ResDataRow *row;
ResourceData *resData = new ResourceData();
while (resData->SetFromResource(index, resources)) {
row = new ResDataRow(resData);
fListView->AddRow(row);
fDataList.AddItem(resData);
resData = new ResourceData();
index++;
}
delete resData;
BNode node;
if (node.SetTo(&ref) == B_OK) {
char attrName[B_ATTR_NAME_LENGTH];
node.RewindAttrs();
resData = new ResourceData();
while (node.GetNextAttrName(attrName) == B_OK) {
if (resData->SetFromAttribute(attrName, node)) {
row = new ResDataRow(resData);
fListView->AddRow(row);
fDataList.AddItem(resData);
resData = new ResourceData();
}
}
delete resData;
}
}