本文整理汇总了C++中IPropertyTree::addPropTree方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::addPropTree方法的具体用法?C++ IPropertyTree::addPropTree怎么用?C++ IPropertyTree::addPropTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::addPropTree方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: beginSubGraph
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;
}
}
示例2: getNavigationData
void CEspBinding::getNavigationData(IEspContext &context, IPropertyTree & data)
{
IEspWsdlSections *wsdl = dynamic_cast<IEspWsdlSections *>(this);
if (wsdl)
{
StringBuffer serviceName, params;
wsdl->getServiceName(serviceName);
if (!getUrlParams(context.queryRequestParameters(), params))
{
if (context.getClientVersion()>0)
params.appendf("%cver_=%g", params.length()?'&':'?', context.getClientVersion());
}
StringBuffer encodedparams;
if (params.length())
encodeUtf8XML(params.str(), encodedparams, 0);
if (params.length())
params.setCharAt(0,'&'); //the entire params string will follow the initial param: "?form"
VStringBuffer folderpath("Folder[@name='%s']", serviceName.str());
IPropertyTree *folder = data.queryPropTree(folderpath.str());
if(!folder)
{
folder=createPTree("Folder");
folder->addProp("@name", serviceName.str());
folder->addProp("@info", serviceName.str());
folder->addProp("@urlParams", encodedparams);
if (showSchemaLinks())
folder->addProp("@showSchemaLinks", "true");
folder->addPropBool("@isDynamicBinding", isDynamicBinding());
folder->addPropBool("@isBound", isBound());
data.addPropTree("Folder", folder);
}
MethodInfoArray methods;
wsdl->getQualifiedNames(context, methods);
ForEachItemIn(idx, methods)
{
CMethodInfo &method = methods.item(idx);
IPropertyTree *link=createPTree("Link");
link->addProp("@name", method.m_label.str());
link->addProp("@info", method.m_label.str());
StringBuffer path;
path.appendf("../%s/%s?form%s", serviceName.str(), method.m_label.str(),params.str());
link->addProp("@path", path.str());
folder->addPropTree("Link", link);
}
}
示例3: add
unsigned SWBackupNode::add(IPropertyTree *params)
{
unsigned rc = SWProcess::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 && !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);
}
return rc;
}
示例4: MakeStringException
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;
}
示例5: addUpdateAttributesFromString
void CEnvGen::addUpdateAttributesFromString(IPropertyTree *updateTree, const char *attrs)
{
StringArray saAttrs;
saAttrs.appendList(attrs, ATTR_SEP);
//printf("attribute: %s\n",attrs);
IPropertyTree *pAttrs = updateTree->addPropTree("Attributes", createPTree("Attributes"));
for ( unsigned i = 0; i < saAttrs.ordinality() ; i++)
{
IPropertyTree *pAttr = pAttrs->addPropTree("Attribute", createPTree("Attribute"));
StringArray keyValues;
keyValues.appendList(saAttrs[i], "=");
pAttr->addProp("@name", keyValues[0]);
StringBuffer sbValue;
sbValue.clear().appendf("%s", keyValues[1]);
sbValue.replaceString("[equal]", "=");
StringArray newOldValues;
if (strcmp(keyValues[1], ""))
{
newOldValues.appendList(sbValue.str(), ATTR_V_SEP);
pAttr->addProp("@value", newOldValues[0]);
if (newOldValues.ordinality() > 1) pAttr->addProp("@oldValue", newOldValues[1]);
}
else
pAttr->addProp("@value", "");
}
}
示例6: 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));
}
示例7: querySDS
static unsigned fn2(unsigned n, unsigned m, unsigned seed, unsigned depth, StringBuffer &parentname)
{
if (!Rconn)
return 0;
if ((n+m+seed)%25==0) {
Rconn->commit();
Rconn->Release();
Rconn = querySDS().connect("/DAREGRESS",myProcessSession(), 0, 1000000);
if (!Rconn) {
ERROR("Failed to connect to /DAREGRESS");
return 0;
}
}
IPropertyTree *parent = parentname.length()?Rconn->queryRoot()->queryPropTree(parentname.str()):Rconn->queryRoot();
if (!parent) {
ERROR1("Failed to connect to %s",parentname.str());
Rconn->Release();
Rconn = NULL;
return 0;
}
__int64 val = parent->getPropInt64("val",0);
parent->setPropInt64("val",n+val);
val = parent->getPropInt64("@val",0);
parent->setPropInt64("@val",m+val);
val = parent->getPropInt64(NULL,0);
parent->setPropInt64(NULL,seed+val);
if (!seed)
return m+n;
if (n==m)
return seed;
if (depth>10)
return seed+n+m;
if (seed%7==n%7)
return n;
if (seed%7==m%7)
return m;
char name[64];
unsigned v = seed;
name[0] = 's';
name[1] = 'u';
name[2] = 'b';
unsigned i = 3;
while (v) {
name[i++] = ('A'+v%26 );
v /= 26;
}
name[i] = 0;
unsigned l = parentname.length();
if (parentname.length())
parentname.append('/');
parentname.append(name);
IPropertyTree *child = parent->queryPropTree(name);
if (!child)
child = parent->addPropTree(name, createPTree(name));
unsigned ret = fn2(fn2(n,seed,seed*17+11,depth+1,parentname),fn2(seed,m,seed*11+17,depth+1,parentname),seed*19+7,depth+1,parentname);
parentname.setLength(l);
return ret;
}
示例8: convertExisting
void convertExisting()
{
Linked<IPropertyTree> pmPart = pmExisting;
const char *s = strstr(pmid.str(), "::");
if (s)
pmPart->addProp("@id", s+2);
packageMaps->removeTree(pmExisting);
Owned<IPropertyTree> pmTree = createPTree("PackageMap", ipt_ordered);
pmTree->setProp("@id", pmid);
pmTree->setPropBool("@multipart", true);
pmTree->addPropTree("Part", pmPart.getClear());
pmExisting = packageMaps->addPropTree("PackageMap", pmTree.getClear());
}
示例9: addLogContentBranch
void CLogContentFilter::addLogContentBranch(StringArray& branchNames, IPropertyTree* contentToLogBranch, IPropertyTree* updateLogRequestTree)
{
IPropertyTree* pTree = updateLogRequestTree;
unsigned numOfBranchNames = branchNames.length();
unsigned i = 0;
while (i < numOfBranchNames)
{
const char* branchName = branchNames.item(i);
if (branchName && *branchName)
pTree = ensurePTree(pTree, branchName);
i++;
}
pTree->addPropTree(contentToLogBranch->queryName(), LINK(contentToLogBranch));
}
示例10: addToArchive
void ResourceManifest::addToArchive(IPropertyTree *archive)
{
IPropertyTree *additionalFiles = ensurePTree(archive, "AdditionalFiles");
//xsi namespace required for proper representaion after PTree::setPropBin()
if (!additionalFiles->hasProp("@xmlns:xsi"))
additionalFiles->setProp("@xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
Owned<IPropertyTreeIterator> resources = manifest->getElements("Resource[@resourcePath]");
ForEach(*resources)
{
IPropertyTree &item = resources->query();
const char *respath = item.queryProp("@resourcePath");
VStringBuffer xpath("Resource[@resourcePath='%s']", respath);
if (!additionalFiles->hasProp(xpath.str()))
{
IPropertyTree *resTree = additionalFiles->addPropTree("Resource", createPTree("Resource"));
const char *filepath = item.queryProp("@originalFilename");
resTree->setProp("@originalFilename", filepath);
resTree->setProp("@resourcePath", respath);
MemoryBuffer content;
loadResource(filepath, content);
resTree->setPropBin(NULL, content.length(), content.toByteArray());
}
}
StringBuffer xml;
toXML(manifest, xml);
IPropertyTree *manifest = additionalFiles->addPropTree("Manifest", createPTree("Manifest", ipt_none));
manifest->setProp("@originalFilename", absFilename.str());
manifest->setProp(NULL, xml.str());
}
示例11: addDirList
//---------------------------------------------------------------------------
// addDirList
//---------------------------------------------------------------------------
IPropertyTree* addDirList(const char* comp, const char* path)
{
// Get or add Component node
IPropertyTree* compNode = addComponent(comp);
assertex(compNode);
// Add new Directory node
assertex(path);
char ppath[_MAX_PATH];
strcpy(ppath, path);
removeTrailingPathSepChar(ppath);
IPropertyTree* node = createPTree("Directory");
node->addProp("@name", ppath);
getDirList(ppath, node);
return compNode->addPropTree("Directory", node);
}
示例12: createPTree
IPropertyTree *readOldIni()
{
IPropertyTree *ret = createPTree("DFUSERVER", ipt_caseInsensitive);
ret->setProp("@name","mydfuserver");
ret->addPropTree("SSH",createPTree("SSH", ipt_caseInsensitive));
Owned<IProperties> props = createProperties("dfuserver.ini", true);
if (props) {
XF(*ret,"@name",*props,"name");
XF(*ret,"@daliservers",*props,"daliservers");
XF(*ret,"@enableSNMP",*props,"enableSNMP");
XF(*ret,"@enableSysLog",*props,"enableSysLog");
XF(*ret,"@queue",*props,"queue");
XF(*ret,"@monitorqueue",*props,"monitorqueue");
XF(*ret,"@monitorinterval",*props,"monitorinterval");
XF(*ret,"@transferBufferSize",*props,"transferBufferSize");
XF(*ret,"@replicatequeue",*props,"replicatequeue");
XF(*ret,"@log_dir",*props,"log_dir");
}
return ret;
}
示例13: getNavigationData
void CEspBinding::getNavigationData(IEspContext &context, IPropertyTree & data)
{
IEspWsdlSections *wsdl = dynamic_cast<IEspWsdlSections *>(this);
if (wsdl)
{
StringBuffer serviceName, params;
wsdl->getServiceName(serviceName);
if (!getUrlParams(context.queryRequestParameters(), params))
{
if (context.getClientVersion()>0)
params.appendf("&ver_=%g", context.getClientVersion());
}
if (params.length())
params.setCharAt(0,'&');
IPropertyTree *folder=createPTree("Folder");
folder->addProp("@name", serviceName.str());
folder->addProp("@info", serviceName.str());
folder->addProp("@urlParams", params.str());
if (showSchemaLinks())
folder->addProp("@showSchemaLinks", "true");
MethodInfoArray methods;
wsdl->getQualifiedNames(context, methods);
ForEachItemIn(idx, methods)
{
CMethodInfo &method = methods.item(idx);
IPropertyTree *link=createPTree("Link");
link->addProp("@name", method.m_label.str());
link->addProp("@info", method.m_label.str());
StringBuffer path;
path.appendf("../%s/%s?form%s", serviceName.str(), method.m_label.str(),params.str());
link->addProp("@path", path.str());
folder->addPropTree("Link", link);
}
data.addPropTree("Folder", folder);
}
示例14: addUpdateTaskFromFile
void CEnvGen::addUpdateTaskFromFile(const char * inFile)
{
Owned<IPropertyTree> inPTree;
if ((String(inFile).toLowerCase())->endsWith(".json"))
{
StringBuffer sbFile;
sbFile.loadFile(inFile);
inPTree.setown(createPTreeFromJSONString(sbFile.str()));
}
else
{
inPTree.setown(createPTreeFromXMLFile(inFile));
}
// add Config attributies to params
IPropertyTree *pCfg = m_params->queryPropTree("Config");
assert(pCfg);
Owned<IAttributeIterator> attrIter = inPTree->getAttributes();
ForEach(*attrIter)
{
const char* propName = attrIter->queryName();
if (!(*propName)) continue;
pCfg->setProp(propName, attrIter->queryValue());
}
// add Tasks to params
Owned<IPropertyTreeIterator> taskIter = inPTree->getElements("Task");
ForEach(*taskIter)
{
IPropertyTree* task = &taskIter->query();
StringBuffer sb;
toXML(task, sb);
pCfg->addPropTree("Task", createPTreeFromXMLString(sb.str()));
}
}
示例15: addPart
void addPart(const char *partname, const char *xml, unsigned updateFlags, StringArray &filesNotFound)
{
init();
if (!pmExisting)
{
doCreate(partname, xml, updateFlags, filesNotFound);
return;
}
createPart(partname, xml);
VStringBuffer xpath("Part[@id='%s']", partname);
IPropertyTree *existingPart = pmExisting->queryPropTree(xpath);
if (existingPart && !checkFlag(PKGADD_SEG_REPLACE))
throw MakeStringException(PKG_NAME_EXISTS, "Package Part %s already exists, remove, or specify 'delete previous'", partname);
cloneDfsInfo(updateFlags, filesNotFound);
if (existingPart)
pmExisting->removeTree(existingPart);
pmExisting->addPropTree("Part", pmPart.getClear());
}