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


C++ QDomNode::attributes方法代码示例

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


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

示例1: QDomNamedNodeMap

QDomNamedNodeMap QDomNodeProto:: attributes() const
{
  QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
  if (item)
    return item->attributes();
  return QDomNamedNodeMap();
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: readVariables

void InternetServerPlatform::readVariables( QDomNode node )
{
	Logging::logInfo( this, "readVariables()" );

	if( node.isNull() )
		return;

	QDomNode variable = node.firstChild();
	while( false == variable.isNull() )
	{
		if( QDomNode::CommentNode != variable.nodeType() )
		{
			QString variableName = variable.nodeName();

			if( _variableList.contains(variableName) )
				continue;

			QString variableValue = variable.attributes().namedItem("value").nodeValue();

			replaceVariables( variableValue );

			_variableList.insert( variableName, variableValue );

			Logging::logInfo( this, QString("%1 = %2").arg(variableName).arg(variableValue) );

			variable = variable.nextSibling();
		}	
	}	
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: data

QVariant MetricDomModel::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();

    QStringList attributes;
    QDomNamedNodeMap attributeMap = node.attributes();

    switch (index.column()) {
        case 0:
            return node.nodeName();
        case 1:
        	if( !attributeMap.contains("Type") ) {
        		return QVariant();
        	}
        	return attributeMap.namedItem("Type").nodeValue();
        case 2:
        	if( !attributeMap.contains("Format") ) {
        		return QVariant();
        	}
        	return attributeMap.namedItem("Format").nodeValue();
        default:
            return QVariant();
    }
}
开发者ID:DMachuca,项目名称:SGEMS-UQ,代码行数:32,代码来源:metricdommodel.cpp

示例4: drawDetailHeader

//copyright : (C) 2002-2004 InfoSiAL S.L.
//email     : [email protected]
void MReportEngine::drawDetailHeader( MPageCollection * pages, int level ) {
  MReportSection * header = findDetailHeader( level );

  if ( header ) {
    QDomNode record = records.item( currRecord_ );

    if ( !header->mustBeDrawed( &record ) )
      return ;

    header->setPageNumber( currPage );

    header->setReportDate( currDate );

    if (( currY + header->getHeight() ) > currHeight )
      newPage( pages );

    QString value;

    QDomNamedNodeMap fields = record.attributes();

    for ( int i = 0; i < header->getFieldCount(); i++ ) {
      value = fields.namedItem( header->getFieldName( i ) ).nodeValue();
      header->setFieldData( i, value );
    }

    header->setCalcFieldData( 0, 0, &record );

    int sectionHeight = header->getHeight();
    header->draw( p, leftMargin, currY, sectionHeight );
    header->setLastPageIndex( pages->getCurrentIndex() );
    header->setOnPage(( QPicture * ) p->painter()->device() );
    currY += sectionHeight;
  }
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:36,代码来源:mreportengine.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:Fale,项目名称:qtmoko,代码行数:32,代码来源:dommodel.cpp

示例6: Generator

// the constructor
ComponentGenerator::ComponentGenerator(QDomNode &generatorNode):
    Generator(generatorNode),
    scope_(ComponentGenerator::INSTANCE),
    groups_() {

    QDomNamedNodeMap attributeMap = generatorNode.attributes();

    // get the spirit scope attribute
    QString scope = attributeMap.namedItem(QString("spirit:scope")).nodeValue();
    if (scope == QString("entity")) {
        scope_ = ComponentGenerator::ENTITY;
    }
    else {
        scope_ = ComponentGenerator::INSTANCE;
    }

    // go through all the child nodes of the component generator
    for (int i = 0; i < generatorNode.childNodes().count(); ++i) {
        QDomNode tempNode = generatorNode.childNodes().at(i);

        if (tempNode.nodeName() == QString("spirit:group")) {
            QString groupName = tempNode.childNodes().at(0).nodeValue();
            groupName = XmlUtils::removeWhiteSpace(groupName);
            groups_.append(groupName);
        }
    }
}
开发者ID:kammoh,项目名称:kactus2,代码行数:28,代码来源:componentgenerator.cpp

示例7: AbstractParameter

IntParameter::IntParameter(QDomNode node, QObject *parent)
  : AbstractParameter(parent),
    _node(node),
    _label(0),
    _slider(0),
    _spinBox(0)
{
  _name = node.attributes().namedItem( "name" ).nodeValue();
  QString min = node.attributes().namedItem( "min" ).nodeValue();
  QString max = node.attributes().namedItem( "max" ).nodeValue();
  QString def = node.attributes().namedItem( "default" ).nodeValue();
  QString value = node.toElement().attribute("savedValue",def);
  _min = min.toInt();
  _max = max.toInt();
  _default = def.toInt();
  _value = value.toInt();
}
开发者ID:hoojao,项目名称:gmic,代码行数:17,代码来源:IntParameter.cpp

示例8: if

void Parser3::ParseVideoFeed( QDomNode Node, VideoFeedPtr Info ) {
    QDomNode Child = Node.firstChild();

    while( !Child.isNull() )
    {
        QString NodeName = Child.nodeName();
        if( NodeName == "title" )
        {
            Info->Title = Child.namedItem("#text").nodeValue();
        }
        else if( NodeName == "link" && ( Child.attributes().namedItem("rel").nodeValue() == "next" ) )
        {
            Info->NextPageInFeed = QUrl( Child.attributes().namedItem("href").nodeValue() );
        }
        else if( NodeName == "author" )
        {
            Info->Author = Child.namedItem("name").namedItem("#text").nodeValue();
            Info->UrlAuthor = QUrl( Child.namedItem("uri").namedItem("#text").nodeValue() );
        }
        else if( NodeName == "openSearch:totalResults" )
        {
            Info->Size = Child.namedItem("#text").nodeValue().toInt();
        }
        else if( NodeName == "media:group" )
        {
            Info->Description = Child.namedItem("media:description").namedItem("#text").nodeValue();
            if( !Child.namedItem("media:thumbnail").isNull() )
            {/*If we allready has a thumbnail we don't want to erase it*/
                Info->UrlThumbnail = QUrl( Child.namedItem("media:thumbnail").namedItem("#text").nodeValue() );
            }
        }
        else if( NodeName == "entry" )
        {
            VideoInfo *Video = new VideoInfo;
            ParseVideoEntry(Child,Video);
            Info->Content.push_back( Video );
        }

        Child = Child.nextSibling();
    }

    Info->ParsedPages++;
    Info->FixInfo();
    return;
}
开发者ID:Visse,项目名称:QTYoutubeViewer,代码行数:45,代码来源:Parser3.cpp

示例9: QDomNode

QDomNode
vleSmDT::nodeOutPort(const QString& portName)
{
    QDomNode outNode =
            mDocSm->elementsByTagName("out").item(0);
    QDomNodeList outList =
        outNode.toElement().elementsByTagName("port");
    for (int i = 0; i< outList.length(); i++) {
        QDomNode out = outList.at(i);
        for (int j=0; j< out.attributes().size(); j++) {
            if ((out.attributes().item(j).nodeName() == "name") and
                    (out.attributes().item(j).nodeValue() == portName))  {
                return out;
            }
        }
    }
    return QDomNode() ;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例10:

QString
vleSmDT::getNamespace()
{
    QDomElement docElem = mDocSm->documentElement();

    QDomNode srcPluginNode =
        mDocSm->elementsByTagName("srcPlugin").item(0);
    return srcPluginNode.attributes().namedItem("namespace").nodeValue();
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例11: 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

示例12: Init

bool EpochModel::Init(QDomNode &node)
{
 if(!node.hasAttributes()) return false;
 QDomNamedNodeMap attr= node.attributes();
 QString indexString = (attr.namedItem("index")).nodeValue() ;
 qDebug("reading Model with index %i ",indexString.toInt());
        for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling())
              {
                if(n.nodeName() == QString("camera"))  cameraName = n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("texture")) textureName= n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("depth"))   depthName  = n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("count"))   countName  = n.attributes().namedItem("filename").nodeValue();
            }

  QString tmpName=textureName.left(textureName.length()-4);
  maskName = tmpName.append(".mask.png");
  return true;
}
开发者ID:Jerdak,项目名称:meshlab,代码行数:18,代码来源:epoch_io.cpp

示例13: readSockets

bool InternetServerPlatform::readSockets( QDomNode node )
{
	Logging::logInfo( this, "readSockets()" );

	if( node.isNull() )
		return false;

    QString applicationPath = QCoreApplication::applicationDirPath();
	
	QDomNode socket = IspComponents::Dom::getChildNodeByName( node, "socket" );
	while( false == socket.isNull() )
	{
		if( QDomNode::CommentNode != socket.nodeType() )
		{
			SocketSettings* socketSettings = new SocketSettings();

            // read the logfile read on
			socketSettings->_on = socket.attributes().namedItem( "on" ).nodeValue();

            // read the daemon
			socketSettings->_daemon	= socket.attributes().namedItem( "daemon" ).nodeValue();
		    socketSettings->_daemon = socketSettings->_daemon.startsWith("/")
                ? socketSettings->_daemon
                : QString( "%1/%2" ).arg( applicationPath ).arg( socketSettings->_daemon );

			// read the logfile
			QDomNode logFile = IspComponents::Dom::getChildNodeByName( socket, "logFile" );	
			socketSettings->_logFile = logFile.attributes().namedItem("value").nodeValue();
		    socketSettings->_logFile = socketSettings->_logFile.startsWith("/")
                ? socketSettings->_logFile
                : QString( "%1/%2" ).arg( applicationPath ).arg( socketSettings->_logFile );

			// read the block-from
			QDomNode blockFrom = IspComponents::Dom::getChildNodeByName( socket, "blockFrom" );
			readBlockFrom( blockFrom, socketSettings->_blockFrom );

			_socketSettingsList.append( socketSettings );
		}

		socket = socket.nextSibling();
	}

	return true;
}
开发者ID:,项目名称:,代码行数:44,代码来源:

示例14: CheckIsSubNodeFrom

QString XmlRelationCheckerCoreImpl::CheckIsSubNodeFrom(const QDomNode& nodeToCheck, XmlRelation* xmlRelation) const
{
    //Precondition: the passed node is an element

    //For debug
    //const QString& nodeName = nodeToCheck.nodeName();

    //List of the key of the referenced value
    QString key = "";

    //If the relation is a SUB_TAG relation, otherwise is not supported and always return false
    if(xmlRelation->GetRelationType() == SUB_TAG)
    {
        //For debug
        //QString subTagName = xmlRelation->GetSubTagNameOfTagFrom();

        //Check the tag name corresponds with the subtag from name
        if(nodeToCheck.nodeName() == xmlRelation->GetSubTagNameOfTagFrom())
        {
            //Now it has to search all the child node with the given tag name with the right attribute

            //Obtain the parent node
            const QDomNode& parentNode = nodeToCheck.parentNode();

            //If the node is the correct child of the right node from
            if(parentNode.isElement() && parentNode.nodeName() == xmlRelation->GetTagFromName())
            {
                //Check the presence of the right attribute

                const QDomNamedNodeMap& attributeNodesList = nodeToCheck.attributes();

                //For exit when the fist match is found
                bool attributeFound = false;

                //Flow the list searching the
                for(int i=0; i<attributeNodesList.size() && !attributeFound; ++i)
                {
                    const QDomAttr& attritubeNode = attributeNodesList.item(i).toAttr();
                    const QString& attributeName = attritubeNode.name();

                    //If the attribute match set to display the value
                    if( attributeName == xmlRelation->GetAttributeNameofTagFrom() )
                    {
                        //Attribute found exit the cycle
                        attributeFound = true;

                        //Add the key in the list
                        key = attritubeNode.value();
                    }
                }
            }
        }
    }

    return key;
}
开发者ID:Mauxx91,项目名称:XML-Editor,代码行数:56,代码来源:XmlRelationCheckerCoreImpl.cpp

示例15: 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);
		}
	}
}
开发者ID:hkunz,项目名称:createswf,代码行数:56,代码来源:DefinitionParser.cpp


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