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