本文整理汇总了C++中IPropertyTree::getPropBin方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::getPropBin方法的具体用法?C++ IPropertyTree::getPropBin怎么用?C++ IPropertyTree::getPropBin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::getPropBin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}