当前位置: 首页>>代码示例>>C++>>正文


C++ QDomNamedNodeMap::count方法代码示例

本文整理汇总了C++中QDomNamedNodeMap::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNamedNodeMap::count方法的具体用法?C++ QDomNamedNodeMap::count怎么用?C++ QDomNamedNodeMap::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDomNamedNodeMap的用法示例。


在下文中一共展示了QDomNamedNodeMap::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fillStrings

void WAccount::fillStrings(QString &text, QString &html, const QDomElement &element, const QString &prefix)
{
	QString key = prefix + QLatin1Char('%');
	if (key != QLatin1String("%%")) {
		text.replace(key, element.text());
		html.replace(key, element.text().toHtmlEscaped());
		qDebug() << key;
	}
	key.chop(1);

	QDomNamedNodeMap attributes = element.attributes();
	for (int i = 0; i < attributes.count(); ++i) {
		QDomNode attribute = attributes.item(i);
		QString attributeKey = key
				% QLatin1Char('/')
				% attribute.nodeName()
				% QLatin1Char('%');
		qDebug() << attributeKey;
		text.replace(attributeKey, attribute.nodeValue());
		html.replace(attributeKey, attribute.nodeValue().toHtmlEscaped());
	}

	if (!key.endsWith(QLatin1Char('%')))
		key += QLatin1Char('/');
	QDomNodeList elementChildren = element.childNodes();
	for (int i = 0; i < elementChildren.count(); ++i) {
		QDomNode node = elementChildren.at(i);
		if (node.isElement())
			fillStrings(text, html, node.toElement(), key + node.nodeName());
	}
}
开发者ID:CyberSys,项目名称:qutim,代码行数:31,代码来源:waccount.cpp

示例2: count

int QDomNamedNodeMapProto:: count()         const
{
  QDomNamedNodeMap *item = qscriptvalue_cast<QDomNamedNodeMap*>(thisObject());
  if (item)
    return item->count();
  return 0;
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:7,代码来源:qdomnamednodemapproto.cpp

示例3: XMLToVariables

void  XML::XMLToVariables(MOVector<Variable> & variables,QDomElement &element)
{
    variables.clear();

    QDomElement e;
    QDomNode n = element.firstChild();

    QString fieldName;
    int iField;

    while( !n.isNull() )
    {
        e = n.toElement();
        if( !e.isNull() && (e.tagName()=="Variable"))
        {
            Variable* newVar = new Variable();
            QDomNamedNodeMap attributes = e.attributes();
            for(int i=0;i<attributes.count();i++)
            {
                iField = newVar->getFieldIndex(attributes.item(i).toAttr().name());
                if(iField>-1)
                    newVar->setFieldValue(iField,QVariant(attributes.item(i).toAttr().value()));
            }
            variables.addItem(newVar);
        }
        n = n.nextSibling();
    }
}
开发者ID:OpenModelica,项目名称:OMOptim,代码行数:28,代码来源:XML.cpp

示例4: cleanMathml

void cleanMathml(QDomElement pElement)
{
    // Clean up the current element
    // Note: the idea is to remove all the attributes that are not in the
    //       MathML namespace. Indeed, if we were to leave them in then the XSL
    //       transformation would either do nothing or, worst, crash OpenCOR...

    static const QString MathmlNamespace = "http://www.w3.org/1998/Math/MathML";

    QDomNamedNodeMap attributes = pElement.attributes();
    QList<QDomNode> nonMathmlAttributes = QList<QDomNode>();

    for (int i = 0, iMax = attributes.count(); i < iMax; ++i) {
        QDomNode attribute = attributes.item(i);

        if (attribute.namespaceURI().compare(MathmlNamespace))
            nonMathmlAttributes << attribute;
    }

    foreach (QDomNode nonMathmlAttribute, nonMathmlAttributes)
        pElement.removeAttributeNode(nonMathmlAttribute.toAttr());

    // Go through the element's child elements, if any, and clean them up

    for (QDomElement childElement = pElement.firstChildElement();
         !childElement.isNull(); childElement = childElement.nextSiblingElement()) {
        cleanMathml(childElement);
    }
}
开发者ID:nickerso,项目名称:opencor,代码行数:29,代码来源:corecliutils.cpp

示例5: data

//! [3]
QVariant DomModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (role != Qt::DisplayRole)
        return QVariant();

    DomItem *item = static_cast<DomItem*>(index.internalPointer());

    QDomNode node = item->node();
//! [3] //! [4]
    QStringList attributes;
    QDomNamedNodeMap attributeMap = node.attributes();

    switch (index.column()) {
        case 0:
            return node.nodeName();
        case 1:
            for (int i = 0; i < attributeMap.count(); ++i) {
                QDomNode attribute = attributeMap.item(i);
                attributes << attribute.nodeName() + "=\""
                              +attribute.nodeValue() + "\"";
            }
            return attributes.join(" ");
        case 2:
            return node.nodeValue().split("\n").join(" ");
        default:
            return QVariant();
    }
}
开发者ID:RobertoMalatesta,项目名称:emscripten-qt,代码行数:32,代码来源:dommodel.cpp

示例6: getDrawerByName

BorderDrawerInterface * BorderDrawersLoader::getDrawerFromSvg(QDomElement & drawerElement)
{
    QMap<QString,QString> properties;
    QDomNamedNodeMap attributes = drawerElement.attributes();
    for (int j = attributes.count()-1; j >= 0; --j)
    {
        QDomAttr attr = attributes.item(j).toAttr();
        if (attr.isNull())
            continue;
        properties.insert(attr.name(), attr.value());
    }
    QString drawerName = properties.take("name");
    if (!instance()->registeredDrawers().contains(drawerName))
        return 0;
    BorderDrawerInterface * drawer = getDrawerByName(drawerName);
    const QMetaObject * meta = drawer->metaObject();
    int count = meta->propertyCount();
    for (int i = 0; i < count; ++i)
    {
        QMetaProperty p = meta->property(i);
        QString value = properties.take(p.name());
        if (value.isEmpty())
            continue;
        p.write(drawer, QVariant(QByteArray::fromBase64(value.toAscii())));
    }
    return drawer;
}
开发者ID:coder89,项目名称:PhotoLayoutsEditor,代码行数:27,代码来源:BorderDrawersLoader.cpp

示例7: elementToString

QString XmlProtocol::elementToString(const QDomElement &e, bool clip)
{
	if(elem.isNull())
		elem = elemDoc.importNode(docElement(), true).toElement();

	// Determine the appropriate 'fakeNS' to use
	QString ns;

	// first, check root namespace
	QString pre = e.prefix();
	if(pre.isNull())
		pre = "";
	if(pre == elem.prefix()) {
		ns = elem.namespaceURI();
	}
	else {
		// scan the root attributes for 'xmlns' (oh joyous hacks)
		QDomNamedNodeMap al = elem.attributes();
		int n;
		for(n = 0; n < al.count(); ++n) {
			QDomAttr a = al.item(n).toAttr();
			QString s = a.name();
			int x = s.indexOf(':');
			if(x != -1)
				s = s.mid(x+1);
			else
				s = "";
			if(pre == s) {
				ns = a.value();
				break;
			}
		}
		if(n >= al.count()) {
			// if we get here, then no appropriate ns was found.  use root then..
			ns = elem.namespaceURI();
		}
	}

	// build qName
	QString qn;
	if(!elem.prefix().isEmpty())
		qn = elem.prefix() + ':';
	qn += elem.localName();

	// make the string
	return sanitizeForStream(xmlToString(e, ns, qn, clip));
}
开发者ID:ExtensionHealthcare,项目名称:iris,代码行数:47,代码来源:xmlprotocol.cpp

示例8: data

QVariant XUPProjectModel::data( const QModelIndex& index, int role ) const
{
    if ( !index.isValid() ) {
        return QVariant();
    }
    
    XUPItem* item = static_cast<XUPItem*>( index.internalPointer() );

    switch ( role ) {
        case Qt::DecorationRole:
            return item->displayIcon();
        case Qt::DisplayRole:
            return item->displayText();
        case XUPProjectModel::TypeRole:
            return item->type();
        case Qt::ToolTipRole:
        {
            const QDomNode node = item->node();
            const QDomNamedNodeMap attributeMap = node.attributes();
            QStringList attributes;
            
            if ( item->type() == XUPItem::Project ) {
                attributes << QString( "Project: %1" ).arg( item->project()->fileName() );
            }
            
            for ( int i = 0; i < attributeMap.count(); i++ ) {
                const QDomNode attribute = attributeMap.item( i );
                const QString name = attribute.nodeName();
                const QString value = attribute.nodeValue();
                
                attributes << QString( "%1=\"%2\"" ).arg( name ).arg( value );
            }
            
            switch ( item->type() ) {
                case XUPItem::Value:
                    attributes << QString( "Value=\"%1\"" ).arg( item->content() );
                    break;
                case XUPItem::File:
                    attributes << QString( "File=\"%1\"" ).arg( item->content() );
                    break;
                case XUPItem::Path:
                    attributes << QString( "Path=\"%1\"" ).arg( item->content() );
                    break;
                default:
                    break;
            }
            
            return attributes.join( "\n" );
        }
        case Qt::SizeHintRole:
            return QSize( -1, 18 );
        default:
            break;
    }
    
    return QVariant();
}
开发者ID:pasnox,项目名称:monkeystudio2,代码行数:57,代码来源:XUPProjectModel.cpp

示例9: QString

QDebug operator<<(QDebug dbg, const QDomElement &el)
{
    QDomNamedNodeMap map = el.attributes();

    QString args;
    for (int i=0; i<map.count(); ++i)
        args += " " + map.item(i).nodeName() + "='" + map.item(i).nodeValue() + "'";

    dbg.nospace() << QString("<%1%2>%3</%1>").arg(el.tagName()).arg(args).arg(el.text());
    return dbg.space();
}
开发者ID:ActionLuzifer,项目名称:razor-qt,代码行数:11,代码来源:xmlhelper.cpp

示例10: readXmlAttributesByTagName

MStriantMap MusicAbstractXml::readXmlAttributesByTagName(const QString &tagName) const
{
    QDomNodeList nodelist = m_ddom->elementsByTagName(tagName);
    QDomNamedNodeMap nodes = nodelist.at(0).toElement().attributes();
    MStriantMap maps;
    for(int i=0; i<nodes.count(); ++i)
    {
        QDomAttr attr = nodes.item(i).toAttr();
        maps[attr.name()] = attr.value();
    }
    return maps;
}
开发者ID:DchunWang,项目名称:TTKMusicplayer,代码行数:12,代码来源:musicabstractxml.cpp

示例11: data

QVariant DomModel::data(const QModelIndex &index, int role) const
{
	if (!index.isValid())
		return QVariant();
	
	//role to get full xml path of index
	if(role == XPathRole)
	{
		QString wholeXmlPath;
		DomItem *item = static_cast<DomItem*>(index.internalPointer());
		if (item==NULL)
			qFatal("can't convert domitem from datamodel");
		
		for(;item->parent()!=NULL;item=item->parent())
		{
			wholeXmlPath=item->node().nodeName()+"/"+wholeXmlPath;
		}
		
		wholeXmlPath="/"+wholeXmlPath;
		return wholeXmlPath;
	}	
	else if (role == Qt::DisplayRole)
	{
		DomItem *item = static_cast<DomItem*>(index.internalPointer());
		
		QDomNode node = item->node();
		QStringList attributes;
		QDomNamedNodeMap attributeMap = node.attributes();
		
		switch (index.column())
		{
			//name
			case 0:
				return node.nodeName();
			//attributes
			case 1:
				for (int i = 0; i < attributeMap.count(); ++i)
				{
					QDomNode attribute = attributeMap.item(i);
					attributes << attribute.nodeName() + "=\""  +attribute.nodeValue() + "\"";
				}
				return attributes.join(" ");
			//value
			case 2:
				return node.nodeValue().split("\n").join(" ");
			default:
				return QVariant();
		}
	}
	else
		return QVariant();
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:52,代码来源:dommodel.cpp

示例12: elementString

QString ConfiguratorHelper::elementString(QDomElement &el) {
    QString str;
    str += "<"%el.tagName()%" ";

    QDomNamedNodeMap attrs = el.attributes();
    int count = attrs.count();
    for (int i = 0; i < count; ++i) {
        str += attrs.item(i).toAttr().name()%"=\""%attrs.item(i).toAttr().value()%"\" ";
    }
    str += "/>";

    return str;
}
开发者ID:Krzysztow,项目名称:proto-gateway,代码行数:13,代码来源:configuratorhelper.cpp

示例13:

/*!
  Set of search parameters.
 */
QHash<QString,QString> TasTargetObject::searchParameters() const
{
    QHash<QString,QString> params;
    QDomNamedNodeMap attributes = mElement.attributes();
    for(int i = 0 ; i < attributes.count(); i++){
        QDomNode node = attributes.item(i);
        //strip special attrs
        if(node.nodeName() != "objectName" && node.nodeName() != "className" && node.nodeName() != "tasId"){
            params.insert(node.nodeName(), node.nodeValue());
        }
    }
    return params;
}
开发者ID:jppiiroinen,项目名称:cutedriver-agent_qt,代码行数:16,代码来源:tasqtcommandmodel.cpp

示例14: cssGroup

/* debug all item incomming in tree 2 level */
QString cssGroup( const QDomElement e )
{
    QStringList cssitem;
    QDomNamedNodeMap alist = e.attributes();
    for (int i=0; i<alist.count(); i++) {
        QDomNode nod = alist.item(i);
        cssitem.append(QString("%1:%2").arg(nod.nodeName().toLower()).arg(nod.nodeValue()));
    }
    QDomNode child = e.firstChild();
    while ( !child.isNull() ) {
        if ( child.isElement() ) {
            QDomNamedNodeMap list = child.attributes();
            for (int x=0; x<list.count(); x++) {
                QDomNode nod = list.item(x);
                cssitem.append(QString("%1:%2").arg(nod.nodeName().toLower()).arg(nod.nodeValue()));
            }
        }
        child = child.nextSibling();
    }

    return cssitem.join(";");
}
开发者ID:webmaster4world,项目名称:manual-indexing,代码行数:23,代码来源:OOFormat.cpp

示例15: FilterAttribute

/* loop  to find attribute name xx */
QString UnionXml::FilterAttribute(QDomElement element, QString attribute) {
    QString base = "-1";
    QDomNamedNodeMap attlist = element.attributes();
    int bigint = attlist.count();
    if (bigint > 0) {
        for (int i = 0; i < bigint; i++) {
            QDomNode nod = attlist.item(i);
            if (nod.nodeName() == attribute) {
                base = QString(nod.nodeValue());
                return base;
            }
        }
    }
    return base;
}
开发者ID:FranciscoJavierPRamos,项目名称:wv2qt,代码行数:16,代码来源:fox_base.cpp


注:本文中的QDomNamedNodeMap::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。