本文整理汇总了C++中Owned::getAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::getAttributes方法的具体用法?C++ Owned::getAttributes怎么用?C++ Owned::getAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::getAttributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addManifestFromArchive
void ResourceManager::addManifestFromArchive(IPropertyTree *archive)
{
if (!archive)
return;
if (finalized)
throwError1(HQLERR_ResourceAddAfterFinalManifest, "MANIFEST");
ensureManifestInfo();
Owned<IPropertyTreeIterator> manifests = archive->getElements("AdditionalFiles/Manifest");
ForEach(*manifests)
{
const char *xml = manifests->query().queryProp(NULL);
Owned<IPropertyTree> manifestSrc = createPTreeFromXMLString(xml);
Owned<IAttributeIterator> aiter = manifestSrc->getAttributes();
ForEach (*aiter)
manifest->setProp(aiter->queryName(), aiter->queryValue());
StringBuffer manifestDir;
if (manifestSrc->hasProp("@originalFilename"))
splitDirTail(manifestSrc->queryProp("@originalFilename"), manifestDir);
Owned<IPropertyTreeIterator> iter = manifestSrc->getElements("*");
ForEach(*iter)
{
IPropertyTree &item = iter->query();
if (streq(item.queryName(), "Resource") && item.hasProp("@filename"))
{
if (!item.hasProp("@type"))
item.setProp("@type", "UNKNOWN");
const char *filename;
if (item.hasProp("@originalFilename"))
filename = item.queryProp("@originalFilename");
else
filename = item.queryProp("@filename");
int id;
if (getDuplicateResourceId(item.queryProp("@type"), NULL, filename, id))
{
item.setPropInt("@id", (int)id);
manifest->addPropTree("Resource", LINK(&item));
}
else
{
VStringBuffer xpath("AdditionalFiles/Resource[@originalFilename=\"%s\"]", filename);
MemoryBuffer content;
archive->getPropBin(xpath.str(), content);
addCompress(item.queryProp("@type"), content.length(), content.toByteArray(), &item);
}
}
else
manifest->addPropTree(item.queryName(), LINK(&item));
}
}
}
示例2: addManifest
void ResourceManager::addManifest(const char *filename)
{
if (finalized)
throwError1(HQLERR_ResourceAddAfterFinalManifest, "MANIFEST");
Owned<IPropertyTree> manifestSrc = createPTreeFromXMLFile(filename);
StringBuffer dir;
splitDirTail(filename, dir);
ensureManifestInfo();
Owned<IAttributeIterator> aiter = manifestSrc->getAttributes();
ForEach (*aiter)
manifest->setProp(aiter->queryName(), aiter->queryValue());
Owned<IPropertyTreeIterator> iter = manifestSrc->getElements("*");
ForEach(*iter)
{
IPropertyTree &item = iter->query();
if (streq(item.queryName(), "Resource") && item.hasProp("@filename"))
{
if (!item.hasProp("@type"))
item.setProp("@type", "UNKNOWN");
const char *filename = item.queryProp("@filename");
int id;
if (getDuplicateResourceId(item.queryProp("@type"), filename, id))
{
item.setPropInt("@id", id);
manifest->addPropTree("Resource", LINK(&item));
}
else
{
StringBuffer fullpath;
if (!isAbsolutePath(filename))
fullpath.append(dir);
fullpath.append(filename);
MemoryBuffer content;
loadResource(fullpath.str(), content);
addCompress(item.queryProp("@type"), content.length(), content.toByteArray(), &item);
}
}
else
manifest->addPropTree(item.queryName(), LINK(&item));
}
}
示例3: addUpdateTaskFromFile
void CEnvGen::addUpdateTaskFromFile(const char * inFile)
{
Owned<IPropertyTree> inPTree;
if ((String(inFile).toLowerCase())->endsWith(".json"))
{
StringBuffer sbFile;
sbFile.loadFile(inFile);
inPTree.setown(createPTreeFromJSONString(sbFile.str()));
}
else
{
inPTree.setown(createPTreeFromXMLFile(inFile));
}
// add Config attributies to params
IPropertyTree *pCfg = m_params->queryPropTree("Config");
assert(pCfg);
Owned<IAttributeIterator> attrIter = inPTree->getAttributes();
ForEach(*attrIter)
{
const char* propName = attrIter->queryName();
if (!(*propName)) continue;
pCfg->setProp(propName, attrIter->queryValue());
}
// add Tasks to params
Owned<IPropertyTreeIterator> taskIter = inPTree->getElements("Task");
ForEach(*taskIter)
{
IPropertyTree* task = &taskIter->query();
StringBuffer sb;
toXML(task, sb);
pCfg->addPropTree("Task", createPTreeFromXMLString(sb.str()));
}
}
示例4: addManifestFile
void ResourceManager::addManifestFile(const char *filename)
{
Owned<IPropertyTree> manifestSrc = createPTreeFromXMLFile(filename);
StringBuffer dir;
splitDirTail(filename, dir);
ensureManifestInfo();
Owned<IAttributeIterator> aiter = manifestSrc->getAttributes();
ForEach (*aiter)
manifest->setProp(aiter->queryName(), aiter->queryValue());
Owned<IPropertyTreeIterator> iter = manifestSrc->getElements("*");
ForEach(*iter)
{
IPropertyTree &item = iter->query();
if (streq(item.queryName(), "Include") && item.hasProp("@filename"))
addManifestInclude(item, dir.str());
else if (streq(item.queryName(), "Resource") && item.hasProp("@filename"))
{
StringBuffer filepath;
StringBuffer respath;
makeAbsolutePath(item.queryProp("@filename"), dir.str(), filepath);
makePathUniversal(filepath.str(), respath);
item.setProp("@originalFilename", filepath.str());
item.setProp("@resourcePath", respath.str());
if (containsFileWildcard(filepath))
{
StringBuffer wildpath;
const char *tail = splitDirTail(filepath, wildpath);
expandManifestDirectory(manifestSrc, item, dir, wildpath, tail, item.getPropBool("@recursive"));
manifestSrc->removeTree(&item);
}
}
else
manifest->addPropTree(item.queryName(), LINK(&item));
}
Owned<IPropertyTreeIterator> resources = manifestSrc->getElements("Resource[@filename]");
ForEach(*resources)
{
IPropertyTree &item = resources->query();
if (!item.hasProp("@type"))
item.setProp("@type", "UNKNOWN");
int id;
if (getDuplicateResourceId(item.queryProp("@type"), item.queryProp("@resourcePath"), NULL, id))
{
item.setPropInt("@id", id);
manifest->addPropTree("Resource", LINK(&item));
}
else
{
MemoryBuffer content;
loadResource(item.queryProp("@originalFilename"), content);
addCompress(item.queryProp("@type"), content.length(), content.toByteArray(), &item);
}
}
}