本文整理汇总了C++中Owned::first方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::first方法的具体用法?C++ Owned::first怎么用?C++ Owned::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_attr
void CRpcMessage::add_attr(const char * path, const char * name, const char * value, IProperties & attrs)
{
if ((path && *path) || (name && *name))
{
CSoapValue *par=m_params.get();
if(path)
par = par->get_value(path);
if (name)
par = par->get_value(name);
if (par)
{
Owned<IPropertyIterator> piter = attrs.getIterator();
for (piter->first(); piter->isValid(); piter->next())
{
const char *propkey = piter->getPropKey();
par->add_attribute(propkey, attrs.queryProp(propkey));
}
}
}
else
{
Owned<IPropertyIterator> piter = attrs.getIterator();
for (piter->first(); piter->isValid(); piter->next())
{
const char *propkey = piter->getPropKey();
add_attribute(propkey, attrs.queryProp(propkey));
}
}
}
示例2: xsltTransform
void CFileSpraySoapBindingEx::xsltTransform(const char* xml, const char* sheet, IProperties *params, StringBuffer& ret)
{
StringBuffer xsl;
if (!checkFileExists(sheet))
throw MakeStringException(ECLWATCH_FILE_NOT_EXIST, "Cannot open stylesheet %s",sheet);
Owned<IXslProcessor> proc = getXslProcessor();
Owned<IXslTransform> trans = proc->createXslTransform();
trans->setXmlSource(xml, strlen(xml));
trans->loadXslFromFile(sheet);
if (params)
{
Owned<IPropertyIterator> it = params->getIterator();
for (it->first(); it->isValid(); it->next())
{
const char *key = it->getPropKey();
//set parameter in the XSL transform skipping over the @ prefix, if any
const char* paramName = *key == '@' ? key+1 : key;
trans->setParameter(paramName, StringBuffer().append('\'').append(params->queryProp(key)).append('\'').str());
}
}
trans->transform(ret);
}
示例3: copy
void CLdapSecResource::copy(ISecResource* from)
{
if(!from)
return;
CLdapSecResource* ldapfrom = dynamic_cast<CLdapSecResource*>(from);
if(!ldapfrom)
return;
m_access = ldapfrom->m_access;
setDescription(ldapfrom->m_description.str());
if(m_parameters.get())
{
m_parameters.clear();
}
if(!ldapfrom->m_parameters.get())
return;
Owned<IPropertyIterator> Itr = ldapfrom->m_parameters->getIterator();
Itr->first();
while(Itr->isValid())
{
addParameter(Itr->getPropKey(), ldapfrom->m_parameters->queryProp(Itr->getPropKey()));
Itr->next();
}
return;
}
示例4: copyTo
virtual void copyTo(ISecUser& destination)
{
destination.setAuthenticateStatus(getAuthenticateStatus());
destination.setName(getName());
destination.setFullName(getFullName());
destination.setFirstName(getFirstName());
destination.setLastName(getLastName());
destination.setRealm(getRealm());
destination.setFqdn(getFqdn());
destination.setPeer(getPeer());
destination.credentials().setPassword(credentials().getPassword());
CDateTime tmpTime;
destination.setPasswordExpiration(getPasswordExpiration(tmpTime));
destination.setStatus(getStatus());
if(m_parameters.get()==NULL)
return;
CriticalBlock b(crit);
Owned<IPropertyIterator> Itr = m_parameters->getIterator();
Itr->first();
while(Itr->isValid())
{
destination.setProperty(Itr->getPropKey(),m_parameters->queryProp(Itr->getPropKey()));
Itr->next();
}
//addToken is not currently implemented....
// DBGLOG("Copied name %s to %s",getName(),destination.getName());
}
示例5: loadEnvironment
// Load mergedEnvironment from local XML node
void CPackageNode::loadEnvironment()
{
mergedEnvironment.setown(createProperties(true));
Owned<IPropertyTreeIterator> envIterator = node->getElements("Environment");
ForEach(*envIterator)
{
IPropertyTree &env = envIterator->query();
const char *id = env.queryProp("@id");
const char *val = env.queryProp("@value");
if (!val)
val = env.queryProp("@val"); // Historically we used val here - not sure why... other parts of package file used value
if (id && val)
mergedEnvironment->setProp(id, val);
else
{
StringBuffer s;
toXML(&env, s);
throw MakeStringException(PACKAGE_MISSING_ID, "PACKAGE_ERROR: Environment element missing id or value: %s", s.str());
}
}
Owned<IAttributeIterator> attrs = node->getAttributes();
for(attrs->first(); attrs->isValid(); attrs->next())
{
StringBuffer s("control:");
s.append(attrs->queryName()+1); // queryName() has a leading @, hence the +1
mergedEnvironment->setProp(s.str(), attrs->queryValue());
}
}
示例6: 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;
}
示例7: checkCacheValid
void RemoteXmlEclRepository::checkCacheValid()
{
ConcreteEclRepository::checkCacheValid();
DBGLOG("check cache");
Owned<IPropertyTree> repository = getModules(cachestamp);
if(!repository)
{
DBGLOG("getModules returned null");
//process error
return;
}
Owned<IPropertyTreeIterator> it = repository->getElements("./Module");
bool somethingChanged = false;
for (it->first(); it->isValid(); it->next())
{
IPropertyTree & cur = it->query();
Owned<IHqlRemoteScope> rScope = createModule(&cur);
timestamp_t timestamp = (timestamp_t)cur.getPropInt64("@timestamp");
if (timestamp > cachestamp)
cachestamp = timestamp;
somethingChanged = true;
}
if(somethingChanged)
rootScope->invalidateParsed();
}
示例8: 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;
}
示例9: cleanupSchedulerList
void cleanupSchedulerList(IPropertyTree * schedule)
{
Owned<IRemoteConnection> conn = querySDS().connect("/Schedulers", myProcessSession(), RTM_LOCK_WRITE, connectionTimeout);
if(!conn) return;
Owned<IPropertyTree> root(conn->queryRoot()->getBranch("."));
Owned<IPropertyTreeIterator> iter = root->getElements("*");
for(iter->first(); iter->isValid(); iter->next())
if(!schedule->hasProp(iter->query().queryName()))
iter->query().setProp("@remove", "yes");
bool more;
do more = root->removeProp("*[@remove=\"yes\"]"); while(more);
}
示例10: updateDaliEnv
bool updateDaliEnv(IPropertyTree *env, bool forceGroupUpdate, const char *daliIp)
{
Owned<IPropertyTreeIterator> dalis = env->getElements("Software/DaliServerProcess/Instance");
if (!dalis||!dalis->first()) {
fprintf(stderr,"Could not find DaliServerProcess\n");
return false;
}
SocketEndpoint daliep;
loop {
const char *ps = dalis->get().queryProp("@port");
unsigned port = ps?atoi(ps):0;
if (!port)
port = DALI_SERVER_PORT;
daliep.set(dalis->get().queryProp("@netAddress"),port);
if (daliIp && *daliIp) {
SocketEndpoint testep;
testep.set(daliIp,DALI_SERVER_PORT);
if (testep.equals(daliep))
break;
daliep.set(NULL,0);
}
if (!dalis->next())
break;
if (!daliep.isNull()) {
fprintf(stderr,"Ambiguous DaliServerProcess instance\n");
return false;
}
}
if (daliep.isNull()) {
fprintf(stderr,"Could not find DaliServerProcess instance\n");
return false;
}
SocketEndpointArray epa;
epa.append(daliep);
Owned<IGroup> group = createIGroup(epa);
bool ret = true;
initClientProcess(group, DCR_Util);
StringBuffer response;
if (querySDS().updateEnvironment(env, forceGroupUpdate, response))
{
StringBuffer tmp;
PROGLOG("Environment and node groups updated in dali at %s",daliep.getUrlStr(tmp).str());
}
else
ret = false;
if (response.length())
WARNLOG("%s", response.str());
closedownClientProcess();
return ret;
}
示例11: 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();
}
}
示例12: recursiveCleanup
void recursiveCleanup(IPropertyTree * tree, unsigned level)
{
Owned<IPropertyTreeIterator> iter = tree->getElements("*");
for(iter->first(); iter->isValid(); iter->next())
{
if(level)
recursiveCleanup(&iter->query(), level-1);
if(!iter->query().hasChildren())
iter->query().setProp("@remove", "yes");
}
bool more;
do more = tree->removeProp("*[@remove=\"yes\"]"); while(more);
}
示例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: initCfgDefValues
void MessageGenerator::initCfgDefValues(const char* method)
{
if (m_cfg.get())
{
m_cfgDefValues.clear();
// Common
Owned<IPropertyTreeIterator> fs = m_cfg->getElements("Common/Field");
for (fs->first(); fs->isValid(); fs->next())
{
IPropertyTree& f = fs->query();
m_cfgDefValues[f.queryProp("@name")] = f.queryProp("@value");
}
// Service specific
fs.setown(m_cfg->getElements(VStringBuffer("Services/Service[@name='%s']/Field",method)));
for (fs->first(); fs->isValid(); fs->next())
{
IPropertyTree& f = fs->query();
m_cfgDefValues[f.queryProp("@name")] = f.queryProp("@value");
}
}
}