本文整理汇总了C++中IPropertyTree::getElements方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::getElements方法的具体用法?C++ IPropertyTree::getElements怎么用?C++ IPropertyTree::getElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::getElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: addInstances
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);
}
}
}
}
示例3: LINK
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;
}
示例4: IsArray
bool CLogThread::IsArray(IPropertyTree& tree)
{
// If the node have more than one children, and all have the same name,
// then it is an array.
StringBuffer name, temp;
Owned<IPropertyTreeIterator> itr = tree.getElements("*");
int count = 0;
for (itr->first(); itr->isValid(); itr->next())
{
if (count==0)
itr->query().getName(name);
else
{
itr->query().getName(temp);
if (stricmp(name,temp)!=0)
return false;
temp.clear();
}
count++;
}
//Loophole in code above if there is only 1 item in the array
if(count==1)
{
if (name!=NULL && stricmp(name,"Item")==0)
return true;
}
return count>1;
}
示例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: appendManifestSchemas
void appendManifestSchemas(IPropertyTree &manifest, ILoadedDllEntry &loadedDll)
{
assertex(!finalized);
Owned<IPropertyTreeIterator> iter = manifest.getElements("Resource[@type='RESULT_XSD']");
ForEach(*iter)
appendSchemaResource(iter->query(), loadedDll);
}
示例7: modify
void SWDirectories::modify(IPropertyTree *params)
{
synchronized block(mutex);
IPropertyTree * envTree = m_envHelper->getEnvTree();
IPropertyTree * pAttrsTree = params->queryPropTree("Attributes");
//Todo: if name attribute given in @selector
//const char* selector = params->queryProp("@selector");
const char* selectorKey = params->queryProp("@selector-key");
if (selectorKey)
{
const char* dirPath = pAttrsTree->queryProp("Attribute[1]/@value");
setCategoryAttributes(envTree, selectorKey, dirPath);
}
else
{
Owned<IPropertyTreeIterator> attrsIter = pAttrsTree->getElements("Attribute");
ForEach(*attrsIter)
{
IPropertyTree* pAttrTree = &attrsIter->query();
const char* dirName = pAttrTree->queryProp("@name");
const char* dirPath = pAttrTree->queryProp("@value");
setCategoryAttributes(envTree, dirName, dirPath);
}
}
//query id
}
示例8: 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);
}
}
}
示例9: addLogInfo
void CLogThread::addLogInfo(IArrayOf<IEspLogInfo>& valueArray,IPropertyTree& logInfo)
{
StringBuffer dataStr,nameStr,valueStr;
Owned<IPropertyTreeIterator> itr = logInfo.getElements("*");
itr->first();
while(itr->isValid())
{
IPropertyTree &node = itr->query();
const char* name = node.queryName();
if (getTreeFlattening()==true && node.hasChildren() == true)
{
if(IsArray(node)==true)
{
FlattenArray(valueArray,node,nameStr);
}
else
{
FlattenTree(valueArray,node,nameStr);
}
// logElement.setName(node.queryName());
// dataStr.clear();
/*toXML(&node,dataStr);
//DOM temporary work about for the lack of XML decoding in esp arrays
StringBuffer encodedData;
JBASE64_Encode(dataStr.str(), dataStr.length() , encodedData);
logElement.setData(encodedData.str());
*/
}
else if (getTreeFlattening()==false && node.hasChildren() == true)
{
IClientLogInfo& logElement = addLogInfoElement(valueArray);
logElement.setName(node.queryName());
dataStr.clear();
toXML(&node,dataStr);
//DOM temporary work about for the lack of XML decoding in esp arrays
StringBuffer encodedData;
JBASE64_Encode(dataStr.str(), dataStr.length() , encodedData);
logElement.setData(encodedData.str());
}
else if (node.queryProp("") != 0 && ( strcmp(node.queryProp(""),"0") != 0 ))
{
IClientLogInfo& logElement = addLogInfoElement(valueArray);
logElement.setName(node.queryName());
logElement.setValue(node.queryProp(""));
}
itr->next();
}
}
示例10: appendClusterEndpoints
static void appendClusterEndpoints(IPropertyTree& cluster,SocketEndpointArray &eps)
{
SocketEndpoint ep;
Owned<IPropertyTree> master = cluster.getPropTree("ThorMasterProcess");
if (master)
appendNodeEndpoint(*master,eps);
Owned<IPropertyTreeIterator> nodes= cluster.getElements("ThorSlaveProcess");
if (nodes&&nodes->first()) {
do {
appendNodeEndpoint(nodes->query(),eps);
} while (nodes->next());
}
}
示例11: recursiveCheckEmptyScope
static bool recursiveCheckEmptyScope(IPropertyTree &ct)
{
Owned<IPropertyTreeIterator> iter = ct.getElements("*");
ForEach(*iter) {
IPropertyTree &item = iter->query();
const char *n = item.queryName();
if (!n||(strcmp(n,queryDfsXmlBranchName(DXB_Scope))!=0))
return false;
if (!recursiveCheckEmptyScope(item))
return false;
}
return true;
}
示例12: checkInstanceAttributes
void SWProcess::checkInstanceAttributes(IPropertyTree *instanceNode, IPropertyTree *parent)
{
assert(instanceNode);
if (portIsRequired() && !instanceNode->hasProp("@port"))
{
int port = getDefaultPort();
if (!port)
throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss port attribute in instance");
instanceNode->addPropInt("@port", port);
}
StringBuffer xpath;
xpath.clear().appendf("xs:element/xs:complexType/xs:sequence/xs:element[@name=\"%s\"]",m_instanceElemName.str());
IPropertyTree * instanceSchemaNode = m_pSchema->queryPropTree(xpath.str());
if (!instanceSchemaNode) return;
bool needDirProp = false;
Owned<IPropertyTreeIterator> attrIter = instanceSchemaNode->getElements("xs:complexType/xs:attribute");
ForEach(*attrIter)
{
IPropertyTree * attr = &attrIter->query();
const char *attrName = attr->queryProp("@name");
if (!stricmp(attrName, "directory"))
{
needDirProp = true;
continue;
}
const char *defaultValue = attr->queryProp("@default");
if (!defaultValue) continue;
xpath.clear().appendf("@%s", attrName);
if (instanceNode->hasProp(xpath.str())) continue;
const char *use = attr->queryProp("@use");
if (!use || !stricmp(use, "required") || !stricmp(use, "optional"))
{
StringBuffer sbDefaultValue;
sbDefaultValue.clear().append(defaultValue);
sbDefaultValue.replaceString("\\", "\\\\");
instanceNode->addProp(xpath.str(), sbDefaultValue.str());
}
}
if (needDirProp && !instanceNode->hasProp("@directory"))
{
const IProperties *props = m_envHelper->getEnvConfigOptions().getProperties();
StringBuffer sb;
sb.clear().appendf("%s/%s",
props->queryProp("runtime"), parent->queryProp(XML_ATTR_NAME));
instanceNode->addProp("@directory", sb.str());
}
}
示例13: deserializeLogInfo
void CLogThread::deserializeLogInfo(IArrayOf<IEspLogInfo>& valueArray,IPropertyTree& logInfo)
{
Owned<IPropertyTreeIterator> itr = logInfo.getElements("LogInfo");
itr->first();
while(itr->isValid())
{
IPropertyTree &node = itr->query();
IClientLogInfo& logElement = addLogInfoElement(valueArray);
logElement.setName(node.queryProp("Name"));
logElement.setValue(node.queryProp("Value"));
logElement.setData(node.queryProp("Data"));
itr->next();
}
}
示例14: init
void CBaseSecurityManager::init(const char *serviceName, IPropertyTree *config)
{
if(config == NULL)
return;
m_config.set(config);
m_permissionsCache.setCacheTimeout( 60 * config->getPropInt("@cacheTimeout", 5) );
m_dbserver.appendf("%s",config->queryProp("@serverName"));
m_dbuser.appendf("%s",config->queryProp("@systemUser"));
if(config->hasProp("@ConnectionPoolSize"))
m_poolsize = atoi(config->queryProp("@connectionPoolSize"));
else
m_poolsize = 2;
StringBuffer encodedPass,encryptedPass;
encodedPass.appendf("%s",config->queryProp("@systemPassword"));
decrypt(m_dbpassword, encodedPass.str());
m_dbpasswordEncoding = SecPwEnc_plain_text;
StringBuffer strPasswordEncoding;
const char* encodingType = config->queryProp("@encodePassword");
if(encodingType && strcmp(encodingType,"MD5") == 0)
m_dbpasswordEncoding=SecPwEnc_salt_md5;
else if (encodingType && strcmp(encodingType,"Rijndael") == 0)
m_dbpasswordEncoding=SecPwEnc_Rijndael;
else if (encodingType && strcmp(encodingType,"Accurint MD5") == 0)
m_dbpasswordEncoding = SecPwEnc_salt_accurint_md5;
if(m_dbserver.length() == 0 || m_dbuser.length() == 0)
throw MakeStringException(-1, "CBaseSecurityManager() - db server or user is missing");
IPropertyTree* pNonRestrictedIPTree = config->queryBranch("SafeIPList");
if(pNonRestrictedIPTree)
{
Owned<IPropertyTreeIterator> Itr = pNonRestrictedIPTree->getElements("ip");
for(Itr->first();Itr->isValid();Itr->next())
{
IPropertyTree& tree = Itr->query();
m_safeIPList[tree.queryProp("")]=true;
}
}
m_enableIPRoaming = config->getPropBool("@enableIPRoaming");
m_enableOTP = config->getPropBool("@enableOTP",false);
m_passwordExpirationWarningDays = config->getPropInt(".//@passwordExpirationWarningDays", 10); //Default to 10 days
}
示例15: getAllClusters
bool getAllClusters(SocketEndpointArray &eps)
{
Owned<IRemoteConnection> conn = querySDS().connect("/Environment/Software", myProcessSession(), RTM_LOCK_READ, SDS_CONNECT_TIMEOUT);
if (!conn)
return false;
IPropertyTree* root = conn->queryRoot();
Owned<IPropertyTreeIterator> clusters= root->getElements("ThorCluster");
if (clusters->first()) {
do {
IPropertyTree &cluster = clusters->query();
if (!getCluster(cluster.queryProp("@name"),eps))
ERRLOG("Cluster %s not found",cluster.queryProp("@name"));
} while (clusters->next());
}
return eps.ordinality()!=0;
}