本文整理汇总了C++中IPropertyTree::hasChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::hasChildren方法的具体用法?C++ IPropertyTree::hasChildren怎么用?C++ IPropertyTree::hasChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::hasChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FlattenTree
bool CLogThread::FlattenTree(IArrayOf<IEspLogInfo>& valueArray,IPropertyTree& tree,StringBuffer& RootName)
{
StringBuffer Value,Name;
if (tree.hasChildren() == true)
{
Owned<IPropertyTreeIterator> itr = tree.getElements("*");
itr->first();
while(itr->isValid())
{
IPropertyTree &node = itr->query();
if(RootName.length() > 0)
Name.appendf("%s_",RootName.str());
Name.appendf("%s",node.queryName());
if (node.hasChildren() == true)
{
if(IsArray(node)==true)
FlattenArray(valueArray,node,Name);
else
FlattenTree(valueArray,node,Name);
}
else
{
const char* _value = tree.queryProp(node.queryName());
if(tree.hasProp(node.queryName())==true && _value!=0 && _value!='\0')
{
Value.appendf("%s",tree.queryProp(node.queryName()));
IClientLogInfo& logElement = addLogInfoElement(valueArray);
logElement.setName(Name.str());
logElement.setValue(Value.str());
//DBGLOG("Add log element: %s, %s", Name.str(), Value.str());
Value.clear();
}
}
Name.clear();
itr->next();
}
}
else
{
return false;
}
return true;
}
示例2: FlattenArray
bool CLogThread::FlattenArray(IArrayOf<IEspLogInfo>& valueArray,IPropertyTree& tree,StringBuffer& RootName)
{
StringBuffer Value,Name;
if (tree.hasChildren() == true)
{
Name.appendf("%s",tree.queryName());
Owned<IPropertyTreeIterator> itrItem = tree.getElements("./*");
itrItem->first();
while(itrItem->isValid()==true)
{
IPropertyTree &node = itrItem->query();
if(Value.length()!=0)
Value.append(",");
Value.appendf("%s",node.queryProp(""));
itrItem->next();
}
IClientLogInfo& logElement = addLogInfoElement(valueArray);
logElement.setName(Name.str());
logElement.setValue(Value.str());
}
return true;
}