本文整理汇总了C++中IPropertyTree::getProp方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::getProp方法的具体用法?C++ IPropertyTree::getProp怎么用?C++ IPropertyTree::getProp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::getProp方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeStringException
IAuthMap * CLocalSecurityManager::createAuthMap(IPropertyTree * authconfig)
{
CAuthMap* authmap = new CAuthMap(this);
IPropertyTreeIterator *loc_iter = NULL;
loc_iter = authconfig->getElements(".//Location");
if (loc_iter != NULL)
{
IPropertyTree *location = NULL;
loc_iter->first();
while(loc_iter->isValid())
{
location = &loc_iter->query();
if (location)
{
StringBuffer pathstr, rstr, required, description;
location->getProp("@path", pathstr);
location->getProp("@resource", rstr);
location->getProp("@required", required);
location->getProp("@description", description);
if(pathstr.length() == 0)
throw MakeStringException(-1, "path empty in Authenticate/Location");
if(rstr.length() == 0)
throw MakeStringException(-1, "resource empty in Authenticate/Location");
ISecResourceList* rlist = authmap->queryResourceList(pathstr.str());
if(rlist == NULL)
{
rlist = createResourceList("localsecurity");
authmap->add(pathstr.str(), rlist);
}
ISecResource* rs = rlist->addResource(rstr.str());
unsigned requiredaccess = str2perm(required.str());
rs->setRequiredAccessFlags(requiredaccess);
rs->setDescription(description.str());
}
loc_iter->next();
}
loc_iter->Release();
loc_iter = NULL;
}
return authmap;
}
示例2: _getValue
bool CXmlScope::_getValue(const char* x, StringBuffer &ret)
{
if (locals && locals->hasProp(x))
{
locals->getProp(x, ret);
return true;
}
return root->getProp(x,ret);
};
示例3: MakeStringException
IAuthMap * createAuthMap(IPropertyTree * authconfig)
{
CAuthMap* authmap = new CAuthMap(this);
Owned<IPropertyTreeIterator> loc_iter;
loc_iter.setown(authconfig->getElements(".//Location"));
if (loc_iter)
{
IPropertyTree *location = NULL;
loc_iter->first();
while(loc_iter->isValid())
{
location = &loc_iter->query();
if (location)
{
StringBuffer pathstr, rstr, required, description;
location->getProp("@path", pathstr);
location->getProp("@resource", rstr);
location->getProp("@required", required);
location->getProp("@description", description);
if(pathstr.length() == 0)
throw MakeStringException(-1, "path empty in Authenticate/Location");
if(rstr.length() == 0)
throw MakeStringException(-1, "resource empty in Authenticate/Location");
ISecResourceList* rlist = authmap->queryResourceList(pathstr.str());
if(rlist == NULL)
{
rlist = createResourceList("htpasswdsecurity");
authmap->add(pathstr.str(), rlist);
}
ISecResource* rs = rlist->addResource(rstr.str());
SecAccessFlags requiredaccess = str2perm(required.str());
rs->setRequiredAccessFlags(requiredaccess);
rs->setDescription(description.str());
rs->setAccessFlags(SecAccess_Full);//grant full access to authenticated users
}
loc_iter->next();
}
}
return authmap;
}
示例4: getValue
inline LPCSTR getValue() const
{
static StringBuffer buf;
if(isBinary())
buf.clear().append(binaryValue);
else
pTree->getProp(name, buf.clear());
return buf.toCharArray();
}
示例5: createFeatureMap
IAuthMap * createFeatureMap(IPropertyTree * authconfig)
{
CAuthMap* feature_authmap = new CAuthMap(this);
Owned<IPropertyTreeIterator> feature_iter;
feature_iter.setown(authconfig->getElements(".//Feature"));
ForEach(*feature_iter)
{
IPropertyTree *feature = NULL;
feature = &feature_iter->query();
if (feature)
{
StringBuffer pathstr, rstr, required, description;
feature->getProp("@path", pathstr);
feature->getProp("@resource", rstr);
feature->getProp("@required", required);
feature->getProp("@description", description);
ISecResourceList* rlist = feature_authmap->queryResourceList(pathstr.str());
if(rlist == NULL)
{
rlist = createResourceList(pathstr.str());
feature_authmap->add(pathstr.str(), rlist);
}
if (!rstr.isEmpty())
{
ISecResource* rs = rlist->addResource(rstr.str());
SecAccessFlags requiredaccess = str2perm(required.str());
rs->setRequiredAccessFlags(requiredaccess);
rs->setDescription(description.str());
rs->setAccessFlags(SecAccess_Full);//grant full access to authenticated users
}
}
}
return feature_authmap;
}
示例6: doStuff
void doStuff()
{
Owned<IRemoteConnection> conn = querySDS().connect("/Orbit", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_QUERY, DALI_TIMEOUT);
IPropertyTree *root = conn->queryRoot();
StringBuffer s;
if (root->getProp("TestBranch1",s)) {
printf("TestBranch1: read %s\n",s.str());
}
else {
// save as string
printf("TestBranch1: set (as string)\n",s.str());
root->setProp("TestBranch1",MyTestXML);
}
MemoryBuffer m;
if (root->getPropBin("TestBranch2",m)) {
m.append((byte)0); // add a NULL to returned data
const char *str = m.toByteArray();
printf("TestBranch2: read %s\n",str);
}
else {
// save as raw binary
printf("TestBranch2: set (as blob)\n",s.str());
root->setPropBin("TestBranch2",strlen(MyTestXML),MyTestXML); // include NULL
}
IPropertyTree *br3 = root->queryPropTree("TestBranch3");
if (br3) {
printf("read TestBranch3 as tree\n");
printf("Hello = %s\n",br3->queryProp("Hello"));
int n = br3->getPropInt("Bye/@num"); // update
printf("Bye num = %d\n",n);
br3->setPropInt("Bye/@num",n+1);
}
else {
// save as tree
printf("TestBranch3: set (as tree)\n",s.str());
br3 = createPTreeFromXMLString(MyTestXML); // parses and creates object tree
root->setPropTree("TestBranch3", br3);
}
}
示例7: loadBuiltIns
CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree* procpt, bool isDali)
{
hsami_=0;
serverstatus=NULL;
useDali=false;
if(inputs)
m_inputs.setown(inputs);
if(!envpt || !procpt)
return;
m_envpt.setown(envpt);
m_cfg.setown(procpt);
loadBuiltIns();
// load options
const char* level = m_cfg->queryProp("@logLevel");
m_options.logLevel = level ? atoi(level) : LogMin;
m_options.logReq = m_cfg->getPropBool("@logRequests", true);
m_options.logResp = m_cfg->getPropBool("@logResponses", false);
m_options.frameTitle.set(m_cfg->queryProp("@name"));
m_options.slowProcessingTime = m_cfg->getPropInt("@slowProcessingTime", 30) * 1000; //in msec
if (!m_cfg->getProp("@name", m_process))
{
ERRLOG("EspProcess name not found");
}
else
{
DBGLOG("ESP process name [%s]", m_process.str());
IPropertyTreeIterator *pt_iter = NULL;
StringBuffer daliservers;
if (m_cfg->getProp("@daliServers", daliservers))
initDali(daliservers.str());
#ifndef _DEBUG
startPerformanceMonitor(m_cfg->getPropInt("@perfReportDelay", 60)*1000);
#endif
//get the local computer name:
m_cfg->getProp("@computer", m_computer);
//get the local computer information:
StringBuffer xpath;
xpath.appendf("Hardware/Computer[@name=\"%s\"]", m_computer.str());
IPropertyTree *computer = m_envpt->queryPropTree(xpath.str());
if (computer)
{
StringBuffer address;
computer->getProp("@netAddress", address);
int port = m_cfg->getPropInt("@port", 1500);
if(strcmp(address.str(), ".") == 0)
{
GetHostName(address.clear());
}
m_address.set(address.str(), (unsigned short) port);
}
xpath.clear();
xpath.append("EspService");
pt_iter = m_cfg->getElements(xpath.str());
if (pt_iter!=NULL)
{
IPropertyTree *ptree = NULL;
pt_iter->first();
while(pt_iter->isValid())
{
ptree = &pt_iter->query();
if (ptree)
{
srv_cfg *svcfg = new srv_cfg;
ptree->getProp("@name", svcfg->name);
ptree->getProp("@type", svcfg->type);
ptree->getProp("@plugin", svcfg->plugin);
fixPlugin(svcfg->plugin);
map<string, srv_cfg*>::value_type en(svcfg->name.str(), svcfg);
m_services.insert(en);
}
pt_iter->next();
}
pt_iter->Release();
pt_iter=NULL;
}
xpath.clear();
xpath.append("EspProtocol");
pt_iter = m_cfg->getElements(xpath.str());
//.........这里部分代码省略.........
示例8: 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);
}
}
//.........这里部分代码省略.........