本文整理汇总了C++中IPropertyTree::addProp方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::addProp方法的具体用法?C++ IPropertyTree::addProp怎么用?C++ IPropertyTree::addProp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::addProp方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addOtherSelector
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);
}
}
示例2: createPTree
IPropertyTree *CEspBinding::addNavException(IPropertyTree &folder, const char *message/*=NULL*/, int code/*=0*/, const char *source/*=NULL*/)
{
IPropertyTree *ret = folder.addPropTree("Exception", createPTree());
ret->addProp("@message", message ? message : "Unknown exception");
ret->setPropInt("@code", code);
ret->setProp("@source", source);
return ret;
}
示例3:
IPropertyTree *CEspBinding::ensureNavDynFolder(IPropertyTree &root, const char *name, const char *tooltip, const char *params, const char *menuname)
{
StringBuffer xpath;
xpath.appendf("DynamicFolder[@name=\"%s\"]", name);
IPropertyTree *ret = root.queryPropTree(xpath.str());
if (!ret)
{
ret=createPTree("DynamicFolder");
ret->addProp("@name", name);
ret->addProp("@tooltip", tooltip);
ret->addProp("@params", params);
ret->setProp("@menu", menuname);
root.addPropTree("DynamicFolder", ret);
}
return ret;
}
示例4: initPtree
void CEspConfig::initPtree(const char *location, bool isDali)
{
IPropertyTree* cfg = createPTreeFromXMLFile(location, ipt_caseInsensitive);
if (cfg)
{
cfg->addProp("@config", location);
m_envpt.setown(cfg);
}
}
示例5: addInstance
void SWProcess::addInstance(IPropertyTree *computerNode, IPropertyTree *parent, IPropertyTree *attrs, const char* instanceXMLTagName)
{
IPropertyTree *instanceNode = NULL;
StringBuffer xpath;
if (m_singleInstanceList.find(m_name.str()) != NotFound)
{
xpath.clear().appendf("%s[1]", instanceXMLTagName);
instanceNode = parent->queryPropTree(xpath.str());
}
else
{
instanceNode = findInstance(parent, computerNode);
}
if (!instanceNode)
{
// create instance
instanceNode = createPTree(instanceXMLTagName);
instanceNode->addProp("@computer", computerNode->queryProp(XML_ATTR_NAME));
// get unique name
StringBuffer sbName;
if (String(instanceXMLTagName).indexOf("Master") > 0)
sbName.append("m");
else
sbName.append("s");
instanceNode->addProp(XML_ATTR_NAME, getUniqueName(parent, sbName, instanceXMLTagName, ""));
instanceNode->addProp(m_ipAttribute.str(), computerNode->queryProp(XML_ATTR_NETADDRESS));
parent->addPropTree(instanceXMLTagName, instanceNode);
}
StringArray excludeList;
excludeList.append("ip");
excludeList.append("ipfile");
if (attrs)
updateNode(instanceNode, attrs, &excludeList);
checkInstanceAttributes(instanceNode, parent);
}
示例6: addTask
//---------------------------------------------------------------------------
// addTask
//---------------------------------------------------------------------------
IPropertyTree* addTask(IDeployTask& task)
{
// Get or add Component node
IPropertyTree* compNode = addComponent(task.getCompName());
assertex(compNode);
// Get Tasks node
IPropertyTree* tasksNode = compNode->queryPropTree("Tasks");
assertex(tasksNode);
// Add new task
IPropertyTree* node = createPTree("Task");
node->addProp("@action", task.getCaption());
node->addProp("@source", task.getFileSpec(DT_SOURCE));
node->addProp("@target", task.getFileSpec(DT_TARGET));
CDateTime modifiedTime;
Owned<IFile> pTargetFile = createIFile(task.getFileSpec(DT_TARGET));
if (pTargetFile->getTime(NULL, &modifiedTime, NULL))
{
StringBuffer timestamp;
modifiedTime.getString(timestamp);
offset_t filesize = pTargetFile->size();
node->addProp("@date", timestamp.str());
node->addPropInt64("@size", filesize);
}
if (task.getErrorCode())
{
node->addProp("@error", task.getErrorString());
compNode->setProp("@error", "true");
}
return tasksNode->addPropTree("Task", node);
}
示例7: 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);
}
示例8: parseArgs
bool CEnvGen::parseArgs(int argc, char** argv)
{
int i = 1;
//m_params = createPTree("Env");
m_params.setown(createPTree("Env"));
IPropertyTree * config = createPTree("Config");
m_params->addPropTree("Config", config);
while (i < argc)
{
if (stricmp(argv[i], "-help") == 0 || stricmp(argv[i], "-?") == 0)
{
usage();
return false;
}
else if (stricmp(argv[i], "-mode") == 0)
{
i++;
config->setProp("@mode", argv[i++]);
}
else if ((stricmp(argv[i], "-env") == 0) || (stricmp(argv[i], "-env-out") == 0))
{
i++;
config->addProp("@env-out", argv[i++]);
}
else if (stricmp(argv[i], "-env-in") == 0)
{
i++;
config->addProp("@env-in", argv[i++]);
}
else if (stricmp(argv[i], "-ip") == 0)
{
i++;
config->addProp("@ip-list", argv[i++]);
}
else if (stricmp(argv[i], "-ipfile") == 0)
{
i++;
config->addProp("@ip-file", argv[i++]);
}
else if (stricmp(argv[i], "-supportnodes") == 0)
{
i++;
config->addProp("@support-nodes", argv[i++]);
}
else if (stricmp(argv[i], "-espnodes") == 0)
{
i++;
config->addProp("@esp-nodes", argv[i++]);
}
else if (stricmp(argv[i], "-roxienodes") == 0)
{
i++;
config->addProp("@roxie-nodes", argv[i++]);
}
else if (stricmp(argv[i], "-thornodes") == 0)
{
i++;
config->addProp("@thor-nodes", argv[i++]);
}
else if (stricmp(argv[i], "-slavespernode") == 0)
{
i++;
config->addProp("@slaves-per-node", argv[i++]);
}
else if (stricmp(argv[i], "-thorchannelsperslave") == 0)
{
i++;
config->addProp("@thor-channels-per-slave", argv[i++]);
}
else if (stricmp(argv[i], "-roxiechannelsperslave") == 0)
{
i++;
config->addProp("@roxie-channels-per-slave", argv[i++]);
}
else if (stricmp(argv[i], "-roxieondemand") == 0)
{
i++;
if (!strcmp(argv[i++], "0"))
config->addProp("@roxie-on-demand", "false");
}
else if (stricmp(argv[i], "-o") == 0)
{
i++;
StringArray sbarr;
sbarr.appendList(argv[i++], "=");
if (sbarr.length() != 2)
continue;
if (strstr(sbarr.item(1), "[NAME]") && (strstr(sbarr.item(1), "[INST]") || strstr(sbarr.item(1), "[COMPONENT]")))
{
StringBuffer sb;
sb.clear().appendf("sw:dirs:[email protected]%s=%s",sbarr.item(0), sbarr.item(1));
createUpdateTask("modify", config, sb.str());
}
else
{
fprintf(stderr, "Error: Directory Override must contain [NAME] and either [INST] or [COMPONENT]\n");
return false;
}
//.........这里部分代码省略.........
示例9: createUpdateTask
void CEnvGen::createUpdateTask(const char* action, IPropertyTree * config, const char* param)
{
if (!param || !(*param)) return;
if (m_showInputOnly)
{
printf("Input as one line format: -%s %s\n", (m_actionAbbrMap.at(action)).c_str(), param);
}
StringArray items;
items.appendList(param, ":");
if (items.ordinality() < 2)
{
throw MakeStringException(CfgEnvErrorCode::InvalidParams,
"Incorrect input format. At least two item expected: category:component.\n See usage for deail.");
}
IPropertyTree * updateTree = createPTree("Task");
config->addPropTree("Task", updateTree);
updateTree->addProp("@operation", action);
updateTree->addProp("@category", (m_envCategoryMap.at(items.item(0))).c_str());
//have key and attributes
StringArray compAndAttrs;
compAndAttrs.appendList(items.item(1), "@");
StringArray compAndTarget;
compAndTarget.appendList(compAndAttrs[0], "%");
if (!stricmp(action, "remove") && compAndTarget.ordinality() > 1 )
{
if (*(compAndTarget.item(1))) updateTree->addProp("@target", compAndTarget.item(1));
}
StringArray compAndKey;
compAndKey.appendList(compAndTarget.item(0), "#");
updateTree->addProp("@component", compAndKey.item(0));
if (compAndKey.ordinality() > 1)
{
StringArray keyAndClone;
keyAndClone.appendList(compAndKey.item(1), ATTR_V_SEP);
updateTree->addProp("@key", keyAndClone.item(0));
if (keyAndClone.ordinality() > 1)
updateTree->addProp("@clone", keyAndClone.item(1));
}
if (compAndAttrs.ordinality() > 1)
{
addUpdateAttributesFromString(updateTree, compAndAttrs.item(1));
return;
}
if (items.ordinality() == 2)
return;
int index = 2;
// selector
StringArray selectorAndAttrs;
selectorAndAttrs.appendList(items.item(index), "@");
StringArray selectorParts;
selectorParts.appendList(selectorAndAttrs.item(0), "/");
StringBuffer sbSelector;
for ( unsigned i = 0; i < selectorParts.ordinality()-1 ; i++)
{
if (!sbSelector.isEmpty())
sbSelector.append("/");
sbSelector.append(selectorParts.item(i));
}
StringArray selectorAndKey;
selectorAndKey.appendList(selectorParts.item(selectorParts.ordinality()-1), "#");
if (!sbSelector.isEmpty())
sbSelector.append("/");
sbSelector.append(selectorAndKey.item(0));
sbSelector.replace('#', '@');
updateTree->addProp("@selector", sbSelector.str());
if (selectorAndKey.ordinality() > 1)
updateTree->addProp("@selector-key", selectorAndKey.item(1));
if (selectorAndAttrs.ordinality() > 1)
{
addUpdateAttributesFromString(updateTree, selectorAndAttrs.item(1));
}
index++;
if (items.ordinality() == index) return;
// children nodes
IPropertyTree *children = updateTree->addPropTree("Children", createPTree("Children"));
for ( unsigned i = index; i < items.ordinality() ; i++)
{
IPropertyTree *child = children->addPropTree("Child", createPTree("Child"));
StringArray nameAndAttrs;
nameAndAttrs.appendList(items.item(i), "@");
//.........这里部分代码省略.........
示例10: addBinding
void SWEspProcess::addBinding(IPropertyTree *parent, IPropertyTree * attrs)
{
StringBuffer xpath;
xpath.clear().append("Attribute[@name='name']/@value");
const char * bindingName = attrs->queryProp(xpath);
if (!bindingName || !(*bindingName))
throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss esp binding name in adding binding");
xpath.clear().append("Attribute[@name='service']/@value");
const char * serviceName = attrs->queryProp(xpath);
if (!serviceName || !(*serviceName))
throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss esp service name in adding binding");
IPropertyTree * envTree = m_envHelper->getEnvTree();
xpath.clear().appendf(XML_TAG_SOFTWARE "/" XML_TAG_ESPSERVICE "[@name=\"%s\"]", serviceName);
IPropertyTree * pEspService = envTree->queryPropTree(xpath.str());
if (!pEspService)
{
const char* task="<Task category=\"Software\" component=\"esdl\" key=\"dynamicesdl\" operation=\"add\"/>";
Owned<IPropertyTree> taskPT = createPTreeFromXMLString(task);
((SWEspService*)m_envHelper->getEnvSWComp("DynamicESDL"))->add(taskPT);
pEspService = envTree->queryPropTree(xpath.str());
assert(pEspService);
// throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Can't find EspService with name %s.", serviceName);
}
IPropertyTree *pBinding = createPTree(XML_TAG_ESPBINDING);
if (attrs)
updateNode(pBinding, attrs, NULL);
// check attributes
if (!(pBinding->queryProp(XML_ATTR_PROTOCOL)))
pBinding->addProp(XML_ATTR_PROTOCOL, "http");
const char* protocol = pBinding->queryProp(XML_ATTR_PROTOCOL);
if (!stricmp(protocol, "https"))
xpath.clear().append("Properties/@defaultSecurePort");
else
xpath.clear().append("Properties/@defaultPort");
const char* defaultPort = pEspService->queryProp(xpath.str());
const char* port = pBinding->queryProp(XML_ATTR_PORT);
if (!port || !(*port))
{
pBinding->addProp(XML_ATTR_PORT, defaultPort);
}
const char* defaultForPort = pBinding->queryProp("@defaultForPort");
if (!stricmp(defaultPort, pBinding->queryProp(XML_ATTR_PORT)))
{
if (!defaultForPort || !(*defaultForPort) || !defaultForPort)
pBinding->setProp("@defaultForPort", "true");
}
else
{
if (!defaultForPort || !(*defaultForPort) || defaultForPort)
pBinding->setProp("@defaultForPort", "true");
}
if (!(pBinding->queryProp("@defaultServiceVersion")))
pBinding->addProp("@defaultServiceVersion", "");
if (!(pBinding->queryProp("@resourcesBasedn")))
pBinding->addProp("@resourcesBasedn", pEspService->queryProp("Properties/@defaultResourcesBasedn"));
if (!(pBinding->queryProp(XML_ATTR_TYPE)))
pBinding->addProp(XML_ATTR_TYPE, "");
if (!(pBinding->queryProp("@workunitsBasedn")))
pBinding->addProp("@workunitsBasedn", "ou=workunits,ou=ecl");
if (!(pBinding->queryProp("@wsdlServiceAddress")))
pBinding->addProp("@wsdlServiceAddress", "");
// Add AuthenticateFeature
Owned<IPropertyTreeIterator> afIter = pEspService->getElements("Properties/AuthenticateFeature");
ForEach (*afIter)
{
pBinding->addPropTree("AuthenticateFeature", m_envHelper->clonePTree(&afIter->query()));
}
// Add Authenticate
Owned<IPropertyTreeIterator> authIter = pEspService->getElements("Properties/Authenticate");
ForEach (*authIter)
{
pBinding->addPropTree("Authenticate", m_envHelper->clonePTree(&authIter->query()));
}
parent->addPropTree(XML_TAG_ESPBINDING, pBinding);
}
示例11: createPTreeForXslt
IPropertyTree* CFileSpraySoapBindingEx::createPTreeForXslt(const char* method, const char* dfuwuid)
{
Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
Owned<IConstEnvironment> m_constEnv = factory->openEnvironment();
Owned<IPropertyTree> pEnvRoot = &m_constEnv->getPTree();
IPropertyTree* pEnvSoftware = pEnvRoot->queryPropTree("Software");
Owned<IPropertyTree> pRoot = createPTreeFromXMLString("<Environment/>");
IPropertyTree* pSoftware = pRoot->addPropTree("Software", createPTree("Software"));
if (pEnvSoftware)
{
StringBuffer dfuwuidSourcePartIP, wuxml;
if(dfuwuid && *dfuwuid)
{
Owned<IDFUWorkUnitFactory> dfuwu_factory = getDFUWorkUnitFactory();
Owned<IConstDFUWorkUnit> dfuwu = dfuwu_factory->openWorkUnit(dfuwuid, false);
if(dfuwu)
{
dfuwu->toXML(wuxml);
Owned<IPropertyTree> wu = createPTreeFromXMLString(wuxml.str());
if (wu)
{
const char* ip = wu->queryProp("Source/Part/@node");
if (ip && *ip)
dfuwuidSourcePartIP.append(ip);
}
}
}
Owned<IPropertyTreeIterator> it = pEnvSoftware->getElements("DropZone");
ForEach(*it)
{
IPropertyTree* pDropZone = pSoftware->addPropTree("DropZone", &it->get());
//get IP Address of the computer associated with this drop zone
const char* pszComputer = it->query().queryProp("@computer");
if (!strcmp(pszComputer, "."))
pszComputer = "localhost";
StringBuffer xpath;
xpath.appendf("Hardware/Computer[@name='%s']/@netAddress", pszComputer);
StringBuffer sNetAddr;
const char* pszNetAddr = pEnvRoot->queryProp(xpath.str());
if (strcmp(pszNetAddr, "."))
{
sNetAddr.append(pszNetAddr);
}
else
{
StringBuffer ipStr;
IpAddress ipaddr = queryHostIP();
ipaddr.getIpText(ipStr);
if (ipStr.length() > 0)
{
#ifdef MACHINE_IP
sNetAddr.append(MACHINE_IP);
#else
sNetAddr.append(ipStr.str());
#endif
}
}
pDropZone->addProp("@netAddress", sNetAddr.str());
if ((dfuwuidSourcePartIP.length() > 0) && (sNetAddr.length() > 0))
{
IpAddress ip1(dfuwuidSourcePartIP.str()), ip2(sNetAddr.str());
if (ip1.ipequals(ip2))
pDropZone->addProp("@sourceNode", "1");
}
Owned<IConstMachineInfo> machine;
if (strcmp(pszNetAddr, "."))
machine.setown(m_constEnv->getMachineByAddress(sNetAddr.str()));
else
{
machine.setown(m_constEnv->getMachineByAddress(pszNetAddr));
if (!machine)
machine.setown(m_constEnv->getMachineByAddress(sNetAddr.str()));
}
if (machine)
{
//int os = machine->getOS();
StringBuffer dir;
pDropZone->getProp("@directory", dir);
if (machine->getOS() == MachineOsLinux || machine->getOS() == MachineOsSolaris)
{
dir.replace('\\', '/');//replace all '\\' by '/'
pDropZone->setProp("@linux", "true");
}
else
{
dir.replace('/', '\\');
dir.replace('$', ':');
}
pDropZone->setProp("@directory", dir);
}
}
//.........这里部分代码省略.........