本文整理汇总了C++中IPropertyTree::hasProp方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::hasProp方法的具体用法?C++ IPropertyTree::hasProp怎么用?C++ IPropertyTree::hasProp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::hasProp方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computerUpdated
void SWProcess::computerUpdated(IPropertyTree *computerNode, const char* oldName,
const char* oldIp, const char* instanceXMLTagName)
{
IPropertyTree *software = m_envHelper->getEnvTree()->queryPropTree("Software");
Owned<IPropertyTreeIterator> compIter = software->getElements(m_processName);
const char *instance = (instanceXMLTagName)? instanceXMLTagName: m_instanceElemName.str();
synchronized block(mutex);
ForEach (*compIter)
{
IPropertyTree *comp = &compIter->query();
Owned<IPropertyTreeIterator> instanceIter = comp->getElements(instance);
ForEach (*instanceIter)
{
IPropertyTree *instance = &instanceIter->query();
if (instance->hasProp(XML_ATTR_NAME) && !stricmp(instance->queryProp(XML_ATTR_NAME), oldName))
{
if (stricmp(computerNode->queryProp(XML_ATTR_NAME), instance->queryProp(XML_ATTR_NAME)))
instance->setProp(XML_ATTR_NAME, computerNode->queryProp(XML_ATTR_NAME));
if (instance->hasProp(m_ipAttribute.str()) && stricmp(computerNode->queryProp(XML_ATTR_NETADDRESS), instance->queryProp(m_ipAttribute.str())))
instance->setProp(m_ipAttribute.str(), computerNode->queryProp(XML_ATTR_NETADDRESS));
if (instance->hasProp("@computer") && stricmp(computerNode->queryProp(XML_ATTR_NAME), instance->queryProp("@computer")))
instance->setProp("@computer", computerNode->queryProp(XML_ATTR_NAME));
}
else if (instance->hasProp(m_ipAttribute.str()) && !stricmp(instance->queryProp(m_ipAttribute.str()), oldIp))
{
instance->setProp(m_ipAttribute.str(), computerNode->queryProp(XML_ATTR_NETADDRESS));
}
}
}
}
示例2: readAllLogFilters
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);
}
}
示例3: 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>");
}
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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);
}
}
示例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: deletePkgInfo
bool deletePkgInfo(const char *name, const char *target, const char *process, bool globalScope)
{
Owned<IRemoteConnection> pkgSetsConn = querySDS().connect("/PackageSets/", myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT);
if (!pkgSetsConn)
throw MakeStringException(PKG_NONE_DEFINED, "No package sets defined");
IPropertyTree* packageSets = pkgSetsConn->queryRoot();
StringBuffer pkgSetId;
buildPkgSetId(pkgSetId, process);
VStringBuffer pkgSet_xpath("PackageSet[@id='%s']", pkgSetId.str());
IPropertyTree *pkgSetRegistry = packageSets->queryPropTree(pkgSet_xpath.str());
if (!pkgSetRegistry)
throw MakeStringException(PKG_TARGET_NOT_DEFINED, "No package sets defined for %s", process);
StringBuffer lcTarget(target);
target = lcTarget.toLowerCase().str();
StringBuffer lcName(name);
name = lcName.toLowerCase().str();
Owned<IPropertyTree> mapEntry;
StringBuffer xpath;
if (!globalScope)
{
xpath.appendf("PackageMap[@id='%s::%s'][@querySet='%s']", target, name, target);
mapEntry.setown(pkgSetRegistry->getPropTree(xpath.str()));
}
if (!mapEntry)
{
xpath.clear().appendf("PackageMap[@id='%s'][@querySet='%s']", name, target);
mapEntry.setown(pkgSetRegistry->getPropTree(xpath.str()));
if (!mapEntry)
throw MakeStringException(PKG_DELETE_NOT_FOUND, "Unable to delete %s - information not found", lcName.str());
}
StringAttr pmid(mapEntry->queryProp("@id"));
pkgSetRegistry->removeTree(mapEntry);
xpath.clear().appendf("PackageSet/PackageMap[@id='%s']", pmid.get());
if (!packageSets->hasProp(xpath))
{
Owned<IRemoteConnection> pkgMapsConn = querySDS().connect("/PackageMaps/", myProcessSession(), RTM_LOCK_WRITE, SDS_LOCK_TIMEOUT);
if (!pkgMapsConn)
throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to retrieve PackageMaps information from dali [/PackageMaps]");
IPropertyTree *pkgMaps = pkgMapsConn->queryRoot();
if (!pkgMaps)
throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to retrieve PackageMaps information from dali [/PackageMaps]");
IPropertyTree *mapTree = pkgMaps->queryPropTree(xpath.clear().appendf("PackageMap[@id='%s']", pmid.get()).str());
if (mapTree)
pkgMaps->removeTree(mapTree);
}
return true;
}
示例9: computerDeleted
void SWProcess::computerDeleted(const char* ipAddress, const char* computerName, const char *instanceXMLTagName)
{
IPropertyTree * software = m_envHelper->getEnvTree()->queryPropTree(XML_TAG_SOFTWARE);
Owned<IPropertyTreeIterator> compIter = software->getElements(m_processName);
const char *instance = (instanceXMLTagName)? instanceXMLTagName: m_instanceElemName.str();
synchronized block(mutex);
ForEach (*compIter)
{
IPropertyTree * comp = &compIter->query();
Owned<IPropertyTreeIterator> instanceIter = comp->getElements(instance);
ForEach (*instanceIter)
{
IPropertyTree * instance = &instanceIter->query();
if ((instance->hasProp(m_ipAttribute.str()) && stricmp(instance->queryProp(m_ipAttribute.str()), ipAddress)) ||
(instance->hasProp("@computer") && stricmp(instance->queryProp("@computer"), computerName)))
comp->removeTree(instance);
}
}
}
示例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: 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;
}
示例12: MakeStringException
CEclDirectSoapBindingEx::CEclDirectSoapBindingEx(IPropertyTree* cfg, const char *binding, const char *process):CEclDirectSoapBinding(cfg, binding, process)
{
StringBuffer xpath;
xpath.appendf("Software/EspProcess[@name='%s']", process);
IPropertyTree *procTree = cfg->queryPropTree(xpath.str());
if (!procTree)
throw MakeStringException(-1, "EclDirect Configuration Error: unable to find process");
xpath.set("EspBinding[@name='").append(binding).append("']/@port");
int port = procTree->getPropInt(xpath.str());
if (port)
{
xpath.set("EspBinding[@type='ws_workunitsSoapBinding'][@port='").append(port).append("']");
redirect = procTree->hasProp(xpath.str());
}
SCMStringBuffer s;
Owned<IStringIterator> it = getTargetClusters(NULL, NULL);
ForEach(*it)
clusters.append(it->str(s).str());
supportRepository = false;
}
示例13: cloneComponent
IPropertyTree * SWProcess::addComponent(IPropertyTree *params)
{
const char* clone = params->queryProp("@clone");
if (clone)
{
return SWComponentBase::cloneComponent(params);
}
IPropertyTree * pCompTree = SWComponentBase::addComponent(params);
if (pCompTree->hasProp("@daliServers") && !strcmp(pCompTree->queryProp("@daliServers"), ""))
{
IPropertyTree * envTree = m_envHelper->getEnvTree();
StringBuffer xpath;
xpath.clear().appendf(XML_TAG_SOFTWARE "/DaliServerProcess/@name");
const char *daliName = envTree->queryProp(xpath.str());
if (daliName)
{
pCompTree->setProp("@daliServers", daliName);
}
}
removeInstancesFromComponent(pCompTree);
return pCompTree;
}
示例14: parseArgs
//.........这里部分代码省略.........
{
i++;
addUpdateTaskFromFile(argv[i++]);
}
else if (stricmp(argv[i], "-add-content")== 0)
{
i++;
m_arrContentXPaths.append(*new StringBufferItem (argv[i++]));
const char* fileName = argv[i++];
StringBufferItem * sbi = new StringBufferItem() ;
sbi->loadFile(fileName);
m_arrContents.append(*sbi);
if ((String(fileName).toLowerCase())->endsWith(".json"))
m_arrContentFormats.append(*new StringBufferItem("json"));
else
m_arrContentFormats.append(*new StringBufferItem("xml"));
}
else if (stricmp(argv[i], "-show-input-only") == 0)
{
i++;
m_showInputOnly = true;
m_displayFormat = XML_Format;
}
else if (stricmp(argv[i], "-show-input-json-only") == 0)
{
i++;
m_showInputOnly = true;
m_displayFormat = JSON_Format;
}
else if (stricmp(argv[i], "-help-update-1") == 0)
{
usage_update_input_format_1();
return false;
}
else if (stricmp(argv[i], "-help-update-2") == 0)
{
usage_update_input_format_2();
return false;
}
else if (stricmp(argv[i], "-help-update-3") == 0)
{
usage_update_input_format_3();
return false;
}
else if (stricmp(argv[i], "-help-update-3-json") == 0)
{
usage_update_input_format_3_json();
return false;
}
else if (stricmp(argv[i], "-cloud") == 0)
{
i++;
cloudConfiguration(config, argv[i++]);
}
else
{
fprintf(stderr, "\nUnknown option %s\n", argv[i]);
usage();
return false;
}
}
// Check input parameters
if (!config->queryProp("@env-out"))
{
fprintf(stderr, "\nMissing -env-out\n");
usage();
return false;
}
if (!config->queryProp("@mode"))
{
if (config->queryProp("@env-in"))
config->addProp("@mode", "update");
else
config->addProp("@mode", "create");
}
if (!stricmp(config->queryProp("@mode"), "update") &&
!config->queryProp("@env-in"))
{
fprintf(stderr, "\nMissing input enviroment.xml (-env-in) in update mode\n");
return false;
}
if (!stricmp(config->queryProp("@mode"), "create") &&
!config->hasProp("@ip-list") && !config->hasProp("@ip-file"))
{
config->setProp("@support-nodes", "0");
config->setProp("@roxie-nodes", "0");
config->setProp("@thor-nodes", "0");
config->setProp("@esp-nodes", "0");
}
m_iConfigEnv = ConfigEnvFactory::getIConfigEnv(config);
return true;
}