本文整理汇总了C++中QDomNamedNodeMap::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNamedNodeMap::isEmpty方法的具体用法?C++ QDomNamedNodeMap::isEmpty怎么用?C++ QDomNamedNodeMap::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomNamedNodeMap
的用法示例。
在下文中一共展示了QDomNamedNodeMap::isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isEmpty
bool QDomNamedNodeMapProto:: isEmpty() const
{
QDomNamedNodeMap *item = qscriptvalue_cast<QDomNamedNodeMap*>(thisObject());
if (item)
return item->isEmpty();
return false;
}
示例2: createMultiFrameSprite
bool DefinitionParser::createMultiFrameSprite (QDomNode& frame, const Content::Class clazz)
{
QDomNode parent = frame.parentNode();
QDomNamedNodeMap attributes = parent.attributes();
const QString childName = clazz == Content::MOVIECLIP ? ::NODE_FRAME : ::NODE_OBJECT;
const QString className = attributes.namedItem(ATTR_CLASS).nodeValue();
const QString basePath = attributes.namedItem(ATTR_PATH).nodeValue();
const QString absBasePath = _targetDir.absoluteFilePath(basePath);
struct SpriteAsset* sprite = NULL;
if (!QFile::exists(absBasePath)) {
info("base path \'" + absBasePath + "\' does not exist");
return false;
}
while (!frame.isNull()) {
QDomElement e = frame.toElement();
QDomNamedNodeMap attr = frame.attributes();
checkAttributes(frame);
frame = frame.nextSibling();
if (e.isNull()) {
continue;
}
const QString tn = e.tagName();
if (tn != childName) {
warnInvalidTag(tn, frame.parentNode().nodeName());
continue;
}
const QString relpath = attr.namedItem(ATTR_PATH).nodeValue();
if (attr.isEmpty() || relpath.isEmpty()) {
warnMissingAttr(ATTR_PATH, tn);
continue;
}
const QString path = _targetDir.absoluteFilePath(basePath + relpath);
if (!checkPathExists(path)) {
continue;
}
struct AssetBit asset;
asset.name = attr.namedItem(ATTR_NAME).nodeValue();
asset.path = _tempDir.relativeFilePath(path);
copyAttributes(&asset, attr);
if (!sprite) {
sprite = new SpriteAsset();
}
sprite->assets.push_back(asset);
}
if (sprite) {
sprite->clazz = clazz;
sprite->name = className;
copyAttributes(sprite, attributes);
_assets[className] = sprite;
}
return true;
}
示例3: parseAssetNodes
void DefinitionParser::parseAssetNodes (QDomNode& node, const Content::Class clazz)
{
bool sprite = false;
QString nodeName;
switch (clazz) {
case Content::MOVIECLIP:
nodeName = NODE_MOVIECLIP;
sprite = true;
break;
case Content::SPRITE:
sprite = true;
nodeName = NODE_SPRITE;
break;
case Content::BITMAPDATA:
nodeName = NODE_BITMAP;
break;
case Content::SOUND:
nodeName = NODE_SOUND;
break;
case Content::BYTEARRAY:
nodeName = NODE_BINARY;
break;
default:
error("invalid class type " + QString::number(clazz));
return;
}
while (!node.isNull()) {
QDomElement elem = node.toElement();
QDomNode parseNode = node;
QDomNamedNodeMap attributes = node.attributes();
QDomNode frame = node.firstChild();
checkAttributes(node);
node = node.nextSibling();
if (elem.isNull()) {
continue;
}
const QString tag = elem.tagName();
if (nodeName != tag) {
warnInvalidTag(tag, parseNode.parentNode().nodeName());
continue;
}
if (attributes.isEmpty() || attributes.namedItem(ATTR_CLASS).nodeValue().isEmpty()) {
warnMissingAttr(ATTR_CLASS, tag);
continue;
}
if (frame.isNull() || !sprite) {
createSingleFrameAsset(parseNode, clazz, nodeName);
} else {
createMultiFrameSprite(frame, clazz);
}
}
}
示例4: loadElement
bool CAnm2DXml::load(const QDomDocument &xml)
{
if ( xml.doctype().name() != kAnmXML_ID_Anm2D ) {
return false ;
}
QDomElement root = xml.documentElement() ;
if ( root.isNull() ) {
return false ;
}
if ( root.nodeName() != kAnmXML_ID_Root ) {
return false ;
}
QDomNamedNodeMap nodeMap = root.attributes() ;
if ( nodeMap.isEmpty() ) {
return false ;
}
if ( nodeMap.namedItem(kAnmXML_Attr_Version).isNull() ) {
return false ;
}
int version = nodeMap.namedItem(kAnmXML_Attr_Version).toAttr().value().toInt() ;
if ( version != kAnmXML_Version ) {
return false ;
}
if ( nodeMap.namedItem(kAnmXML_Attr_ObjNum).isNull() ) {
return false ;
}
if ( nodeMap.namedItem(kAnmXML_Attr_ImageNum).isNull() ) {
return false ;
}
int objNum = nodeMap.namedItem(kAnmXML_Attr_ObjNum).toAttr().value().toInt() ;
int imageNum = nodeMap.namedItem(kAnmXML_Attr_ImageNum).toAttr().value().toInt() ;
QDomNode n = root.firstChild() ;
return loadElement(n, objNum, imageNum) ;
}