当前位置: 首页>>代码示例>>C++>>正文


C++ IPropertyTree::numChildren方法代码示例

本文整理汇总了C++中IPropertyTree::numChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::numChildren方法的具体用法?C++ IPropertyTree::numChildren怎么用?C++ IPropertyTree::numChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPropertyTree的用法示例。


在下文中一共展示了IPropertyTree::numChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: genRoxieMessage

void MessageGenerator::genRoxieMessage(const char* templatemsg, StringBuffer& message)
{
    Owned<IPropertyTree> tmplat;
    StringBuffer root;

    if (templatemsg)
    {
        tmplat.setown(createPTreeFromXMLString(templatemsg));
        if(!tmplat.get())
            throw MakeStringException(-1, "can't generate property tree from input, please make sure it's valid xml.");
        root = tmplat->queryName();
        tmplat.setown(tmplat->getPropTree(VStringBuffer("//Results/Result")));
        if (!tmplat.get())
            throw MakeStringException(-1, "can't find Results/Result in input XML");
    }
    else 
        root = "Unknown"; // TODO: find out the root?

    message.appendf("<!-- <%s> --> %s", root.str(), LT);
    message.appendf(" <!-- <Results> --> %s", LT);
    message.appendf("  <Result>%s", LT);

    Owned<IPropertyTreeIterator> it = m_roxieSchemaRoot->getElements(VStringBuffer("XmlSchema"));
    for (it->first(); it->isValid(); it->next())
    {
        IPropertyTree* ds = &it->query();

        const char* name = ds->queryProp("@name");
        if (!name)
        {
            ERRLOG("XmlSchema without name");
            continue;
        }
        
        IPropertyTree* p = ds->queryBranch(VStringBuffer("%s:schema", xsdNs()));
        m_schemaTree.setown(LINK(p));
        IXmlSchema* xs = createXmlSchemaFromPTree(m_schemaTree);
        IXmlType* type = xs->queryElementType("Dataset");
        if (!type)
        {
            ERRLOG("Can not find type '%s'", name);
            continue;
        }
        // get the Row type
        type = type->queryFieldType(0);
        if (!type)
        {
            ERRLOG("The root element for %s is not an array", name);
            continue;
        }

        IPropertyTree* dsTmplat = tmplat.get() ? tmplat->queryPropTree(VStringBuffer("Dataset[@name='%s']",name)) : NULL;
        if (dsTmplat && dsTmplat->numChildren()>0)
        {
            message.appendf("    <Dataset name=\"%s\">%s", name, LT);
    
            Owned<IPropertyTreeIterator> row = dsTmplat->getElements("Row");
            for (row->first(); row->isValid(); row->next())
            {
                message.appendf("     <Row>%s", LT);
    
                StringStack parent;
                doType(parent,5,"Row",type, &row->query(), message);

                message.appendf("     </Row>%s", LT);
            }

            message.appendf("   </Dataset>%s", LT);
        }
        else if (m_genAllDatasets)
        {
            message.appendf("    <Dataset name=\"%s\">%s", name, LT);
            for (int i=0; i < m_items; i++)
            {
                message.appendf("     <Row>%s", LT);
                StringStack parent;
                doType(parent,6,"Row",type,message);
                message.appendf("     </Row>%s", LT);
            }
            if (m_ecl2esp)
                message.appendf("     <Row/>%s", LT);

            message.appendf("   </Dataset>%s", LT);
        }
    }

    message.appendf("  </Result>%s", LT);
    message.appendf(" <!-- </Results> --> %s", LT);
    message.appendf("<!-- </%s> --> %s", root.str(), LT);
}
开发者ID:AlexLuya,项目名称:HPCC-Platform,代码行数:90,代码来源:msggenerator.cpp


注:本文中的IPropertyTree::numChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。