本文整理汇总了C++中IPropertyTree类的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree类的具体用法?C++ IPropertyTree怎么用?C++ IPropertyTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IPropertyTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doCreate
void doCreate(const char *partname, const char *xml, unsigned updateFlags, StringArray &filesNotFound)
{
createPart(partname, xml);
if (pmExisting)
{
if (!checkFlag(PKGADD_MAP_REPLACE))
throw MakeStringException(PKG_NAME_EXISTS, "PackageMap %s already exists, either delete it or specify overwrite", pmid.str());
}
cloneDfsInfo(updateFlags, filesNotFound);
if (pmExisting)
packageMaps->removeTree(pmExisting);
Owned<IPropertyTree> pmTree = createPTree("PackageMap", ipt_ordered);
pmTree->setProp("@id", pmid);
pmTree->setPropBool("@multipart", true);
pmTree->addPropTree("Part", pmPart.getClear());
packageMaps->addPropTree("PackageMap", pmTree.getClear());
VStringBuffer xpath("PackageMap[@id='%s'][@querySet='%s']", pmid.str(), target.get());
Owned<IPropertyTree> pkgSet = getPkgSetRegistry(process, false);
IPropertyTree *psEntry = pkgSet->queryPropTree(xpath);
if (!psEntry)
{
psEntry = pkgSet->addPropTree("PackageMap", createPTree("PackageMap"));
psEntry->setProp("@id", pmid);
psEntry->setProp("@querySet", target);
}
makePackageActive(pkgSet, psEntry, target, checkFlag(PKGADD_MAP_ACTIVATE));
}
示例2: querySDS
IPropertyTree *getPkgSetRegistry(const char *process, bool readonly)
{
Owned<IRemoteConnection> globalLock = querySDS().connect("/PackageSets/", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_QUERY, SDS_LOCK_TIMEOUT);
if (!globalLock)
throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to connect to PackageSet information in dali /PackageSets");
IPropertyTree *pkgSets = globalLock->queryRoot();
if (!pkgSets)
throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to open PackageSet information in dali /PackageSets");
if (!process || !*process)
process = "*";
StringBuffer id;
buildPkgSetId(id, process);
//Only lock the branch for the target we're interested in.
VStringBuffer xpath("/PackageSets/PackageSet[@id='%s']", id.str());
Owned<IRemoteConnection> conn = querySDS().connect(xpath.str(), myProcessSession(), readonly ? RTM_LOCK_READ : RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT);
if (!conn)
{
if (readonly)
return NULL;
Owned<IPropertyTree> pkgSet = createPTree();
pkgSet->setProp("@id", id.str());
pkgSet->setProp("@process", process);
pkgSets->addPropTree("PackageSet", pkgSet.getClear());
globalLock->commit();
conn.setown(querySDS().connect(xpath.str(), myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT));
}
return (conn) ? conn->getRoot() : NULL;
}
示例3: strrchr
void WebServicesExtractor::getAttributeText(StringBuffer & text, const char* attributeName)
{
const char * dot = strrchr(attributeName, '.');
if(!dot || !dot[1])
throw MakeStringException(3, "Please specify both module and attribute");
OwnedHqlExpr symbol = getResolveAttributeFullPath(attributeName, LSFpublic, lookupCtx);
if (!symbol || !hasNamedSymbol(symbol) || !symbol->hasText())
{
StringBuffer txt;
txt.append("Could not read attribute: ").append(attributeName);
DBGLOG("%s", txt.str());
throw MakeStringException(ERR_NO_ATTRIBUTE_TEXT, "%s", txt.str());
}
symbol->getTextBuf(text);
/* MORE: It would be preferable if this was better integrated with hqlgram2.cpp. It's a reasonable stopgap */
if (archive)
{
StringAttr moduleName(attributeName, dot-attributeName);
IPropertyTree * moduleTree = queryEnsureArchiveModule(archive, moduleName, NULL);
IPropertyTree * attrTree = queryArchiveAttribute(moduleTree, dot+1);
if (!attrTree)
{
attrTree = createArchiveAttribute(moduleTree, dot+1);
const char * p = text.str();
if (0 == strncmp(p, UTF8_BOM,3))
p += 3;
attrTree->setProp("", p);
}
}
}
示例4: ForEachChild
ForEachChild(i, record)
{
IHqlExpression * cur = record->queryChild(i);
switch (cur->getOperator())
{
case no_record:
//MORE: If this is a public symbol it should be expanded, otherwise it will be elsewhere.
expandRecordSymbolsMeta(metaTree, cur);
break;
case no_field:
{
IPropertyTree * field = metaTree->addPropTree("Field");
field->setProp("@name", str(cur->queryId()));
StringBuffer ecltype;
cur->queryType()->getECLType(ecltype);
field->setProp("@type", ecltype);
break;
}
case no_ifblock:
{
IPropertyTree * block = metaTree->addPropTree("IfBlock");
expandRecordSymbolsMeta(block, cur->queryChild(1));
break;
}
case no_attr:
case no_attr_link:
case no_attr_expr:
{
IPropertyTree * attr = metaTree->addPropTree("Attr");
attr->setProp("@name", str(cur->queryName()));
break;
}
}
}
示例5: ForEach
CWsMachineSoapBindingEx::CWsMachineSoapBindingEx(IPropertyTree* cfg,
const char *bindname/*=NULL*/,
const char *procname/*=NULL*/)
:Cws_machineSoapBinding(cfg, bindname, procname)
{
StringBuffer xpath;
xpath.appendf("Software/EspProcess[@name=\"%s\"]", procname);
IPropertyTree* pEspProcess = cfg->queryPropTree(xpath.str());
if (pEspProcess)
{
xpath.clear().appendf("EspBinding[@name=\"%s\"]/@service", bindname);
const char* service = pEspProcess->queryProp(xpath.str());
if (service)
{
xpath.clear().appendf("EspService[@name=\"%s\"]/MachineInfo/Software/*", service);
Owned<IPropertyTreeIterator> it = pEspProcess->getElements(xpath.str());
ForEach(*it)
{
m_processTypes.append(it->query().queryName());
}
m_processTypes.sort(SortFunction);
}
}
}
示例6: ensureThorIsDown
static bool ensureThorIsDown(const char *cluster, bool nofail, bool wait)
{
bool retry = false;
do {
Owned<IRemoteConnection> pStatus = querySDS().connect("/Status/Servers", myProcessSession(), RTM_NONE, SDS_LOCK_TIMEOUT);
Owned<IPropertyTreeIterator> it = pStatus->queryRoot()->getElements("Server[@name='ThorMaster']");
retry = false;
ForEach(*it) {
IPropertyTree* pServer = &it->query();
if (pServer->hasProp("@cluster") && !strcmp(pServer->queryProp("@cluster"), cluster)) {
if (nofail) {
WARNLOG("A Thor on cluster %s is still active", cluster);
if (!wait)
return false;
Sleep(1000*10);
PROGLOG("Retrying...");
retry = true;
break;
}
throw MakeStringException(-1, "A Thor cluster node swap requires the cluster to be offline. Please stop the Thor cluster '%s' and try again.", cluster);
}
}
} while (retry);
return true;
}
示例7: getIsOpt
bool getIsOpt(const IPropertyTree &graphNode)
{
if (graphNode.hasProp("att[@name='_isOpt']"))
return graphNode.getPropBool("att[@name='_isOpt']/@value", false);
else
return graphNode.getPropBool("att[@name='_isIndexOpt']/@value", false);
}
示例8: xpath
void CLogContentFilter::readAllLogFilters(IPropertyTree* cfg)
{
bool groupFilterRead = false;
VStringBuffer xpath("Filters/Filter[@type='%s']", espLogContentGroupNames[ESPLCGBackEndResp]);
IPropertyTree* filter = cfg->queryBranch(xpath.str());
if (filter && filter->hasProp("@value"))
{
logBackEndResp = filter->getPropBool("@value");
groupFilterRead = true;
}
xpath.setf("Filters/Filter[@type='%s']", espLogContentGroupNames[ESPLCGBackEndReq]);
filter = cfg->queryBranch(xpath.str());
if (filter && filter->hasProp("@value"))
{
logBackEndReq = filter->getPropBool("@value");
groupFilterRead = true;
}
for (unsigned i = 0; i < ESPLCGBackEndReq; i++)
{
if (readLogFilters(cfg, i))
groupFilterRead = true;
}
if (!groupFilterRead)
{
groupFilters.clear();
readLogFilters(cfg, ESPLCGAll);
}
}
示例9: makeAbsolutePath
bool ResourceManifest::loadInclude(IPropertyTree &include, const char *dir)
{
const char *filename = include.queryProp("@filename");
StringBuffer includePath;
makeAbsolutePath(filename, dir, includePath);
VStringBuffer xpath("Include[@originalFilename='%s']", includePath.str());
if (manifest->hasProp(xpath.str()))
return false;
include.setProp("@originalFilename", includePath.str());
StringBuffer includeDir;
splitDirTail(includePath, includeDir);
Owned<IPropertyTree> manifestInclude = createPTreeFromXMLFile(includePath.str());
Owned<IPropertyTreeIterator> it = manifestInclude->getElements("*");
ForEach(*it)
{
IPropertyTree &item = it->query();
if (streq(item.queryName(), "Resource"))
updateResourcePaths(item, includeDir.str());
else if (streq(item.queryName(), "Include"))
{
if (!loadInclude(item, includeDir.str()))
continue;
}
manifest->addPropTree(item.queryName(), LINK(&item));
}
return true;
}
示例10: appendSchemaResource
void appendSchemaResource(IPropertyTree &res, ILoadedDllEntry *dll)
{
if (!dll || (flags & WWV_OMIT_SCHEMAS))
return;
if (res.getPropInt("@seq", -1)>=0 && res.hasProp("@id"))
{
int id = res.getPropInt("@id");
size32_t len = 0;
const void *data = NULL;
if (dll->getResource(len, data, "RESULT_XSD", (unsigned) id) && len>0)
{
buffer.append("<XmlSchema name=\"").append(res.queryProp("@name")).append("\">");
if (res.getPropBool("@compressed"))
{
StringBuffer decompressed;
decompressResource(len, data, decompressed);
if (flags & WWV_CDATA_SCHEMAS)
buffer.append("<![CDATA[");
buffer.append(decompressed.str());
if (flags & WWV_CDATA_SCHEMAS)
buffer.append("]]>");
}
else
buffer.append(len, (const char *)data);
buffer.append("</XmlSchema>");
}
}
}
示例11: assert
unsigned SWProcess::add(IPropertyTree *params)
{
unsigned rc = SWComponentBase::add(params);
IPropertyTree * envTree = m_envHelper->getEnvTree();
const char* key = params->queryProp("@key");
StringBuffer xpath;
xpath.clear().appendf(XML_TAG_SOFTWARE "/%s[@name=\"%s\"]", m_processName.str(), key);
IPropertyTree * compTree = envTree->queryPropTree(xpath.str());
assert(compTree);
const char* selector = params->queryProp("@selector");
if (selector)
{
String str(selector);
if (str.startsWith("instance"))
{
addInstances(compTree, params);
}
else
{
// Following method can be overwritten.
// For example, NodeGroup in BackupNodeProcess, EspBinding in EspProcess
addOtherSelector(compTree, params);
}
}
else
{
IPropertyTree* pAttrs = params->queryPropTree("Attributes");
updateNode(compTree, pAttrs);
}
return rc;
}
示例12: DBGLOG
IHqlExpression * XmlEclRepository::doLoadSymbol(IPropertyTree * repository, IAtom * modname, IAtom * attrname)
{
StringBuffer s;
IPropertyTree* module = repository->queryPropTree(s.append("./Module[@name=\"").append(*modname).append("\"]").str());
if(!module)
{
if (logging())
DBGLOG("No data for module %s",modname->getAtomNamePtr());
return 0;
}
int access = module->getPropInt("@access",cs_full);
s.clear().append("./Attribute[@name=\"").append(*attrname).append("\"]");
Owned<IPropertyTreeIterator> it = module->getElements(s.str());
for(it->first();it->isValid();it->next())
{
Owned<IHqlExpression> item = toNamedSymbol(&it->query(), *modname,access);
CHqlNamedSymbol* cur = QUERYINTERFACE(item.get(), CHqlNamedSymbol);
if(cur)
return LINK(cur);
}
return 0;
}
示例13: saveSubGraphs
void LogicalGraphCreator::beginSubGraph(const char * label, bool nested)
{
savedGraphId.append(subGraphId);
if (!nested)
saveSubGraphs();
if ((subGraphs.ordinality() == 0) && rootSubGraph)
{
subGraphs.append(*LINK(rootSubGraph));
subGraphId = rootGraphId;
return;
}
subGraphId = ++seq;
IPropertyTree * node = createPTree("node");
node = curSubGraph()->addPropTree("node", node);
node->setPropInt64("@id", subGraphId);
IPropertyTree * graphAttr = node->addPropTree("att", createPTree("att"));
IPropertyTree * subGraph = graphAttr->addPropTree("graph", createPTree("graph"));
subGraphs.append(*LINK(subGraph));
if (!rootSubGraph)
{
rootSubGraph.set(subGraph);
rootGraphId = subGraphId;
}
}
示例14: MakeStringException
void SWProcess::addInstances(IPropertyTree *parent, IPropertyTree *params)
{
IPropertyTree* pAttrs = params->queryPropTree("Attributes");
if (!pAttrs)
throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss instance attributes input");
const char * instanceXMLTagName = getInstanceXMLTagName(params->queryProp("@selector"));
Owned<IPropertyTreeIterator> iter = pAttrs->getElements("Attribute");
ForEach (*iter)
{
IPropertyTree *attr = &iter->query();
const char* propName = attr->queryProp("@name");
if (!stricmp(propName, "ip") || !stricmp(propName, "ipfile"))
{
bool isFile = false;
if (!stricmp(propName, "ipfile")) isFile = true;
StringArray ips;
m_envHelper->processNodeAddress(attr->queryProp("@value"), ips, isFile);
for ( unsigned i = 0; i < ips.ordinality() ; i++)
{
IPropertyTree * computerNode = addComputer(ips.item(i));
addInstance(computerNode, parent, pAttrs, instanceXMLTagName);
}
}
}
}
示例15: assert
void SWBackupNode::addOtherSelector(IPropertyTree *compTree, IPropertyTree *params)
{
StringBuffer xpath;
assert(compTree);
const char* selector = params->queryProp("@selector");
if (selector && !stricmp("NodeGroup", selector))
{
IPropertyTree *nodeGroup = createPTree(selector);
IPropertyTree* pAttrs = params->queryPropTree("Attributes");
updateNode(nodeGroup, pAttrs, NULL);
if (!nodeGroup->hasProp("@interval"))
{
xpath.clear().appendf("xs:element/xs:complexType/xs:sequence/xs:element[@name=\"NodeGroup\"]/xs:complexType/xs:attribute[@name=\"interval\"]/@default");
const char *interval = m_pSchema->queryProp(xpath.str());
if ( interval && *interval )
{
nodeGroup->addProp("@interval", interval);
}
else
{
throw MakeStringException(CfgEnvErrorCode::MissingRequiredParam,
"Missing required paramter \"interval\" and there is no default value.");
}
}
compTree->addPropTree(selector, nodeGroup);
}
}