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


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

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


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

示例1: while

    QList<QSharedPointer<TransportDefinition> >
    TransportReader::parse(const QDomDocument &document)
    {
        QList<QSharedPointer<TransportDefinition> > result;

        QDomNode node = document.documentElement().firstChild();
        while (! node.isNull())
        {
            if (node.toElement().tagName() == "transportDefinitions")
            {
                QDomNode transportNode = node.toElement().firstChild();
                while(!transportNode.isNull())
                {
                    if (transportNode.toElement().tagName()
                        == "transportDefinition")
                    {
                        QSharedPointer<TransportDefinition> transport =
                            _parseTransport(transportNode.toElement());
                        if (! transport.isNull())
                            result << transport;
                    }

                    transportNode = transportNode.nextSiblingElement();
                }
            }

            node = node.nextSiblingElement();
        }
        return result;
    }
开发者ID:simio,项目名称:H.VHS,代码行数:30,代码来源:transportreader.cpp

示例2: while

    QList<QSharedPointer<FormatDefinition> >
    FormatReader::parse(const QDomDocument &document)
    {
        QList<QSharedPointer<FormatDefinition> > result;

        QDomNode node = document.documentElement().firstChild();
        while (! node.isNull())
        {
            if (node.toElement().tagName() == "formatDefinitions")
            {
                QDomNode formatNode = node.toElement().firstChild();
                while(!formatNode.isNull())
                {
                    if (formatNode.toElement().tagName() == "formatDefinition")
                    {
                        QSharedPointer<FormatDefinition> format =
                            _parseFormat(formatNode.toElement());
                        if (! format.isNull())
                            result << format;
                    }

                    formatNode = formatNode.nextSiblingElement();
                }
            }

            node = node.nextSiblingElement();
        }
        return result;
    }
开发者ID:simio,项目名称:H.VHS,代码行数:29,代码来源:formatreader.cpp

示例3: QDomElement

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

示例4: SearchGivenNodeFrom

bool XmlRelationCheckerCoreImpl::SearchGivenNodeFrom(QDomNode nodeToCheck, const QString& key, XmlRelation* xmlRelation) const
{
    if(!nodeToCheck.isNull())
    {
        if(nodeToCheck.isElement() && !nodeToCheck.isComment())
        {
            //For debug
            //const QString& nodeName = nodeToCheck.nodeName();

            //Controll if the node is a node to key
            QList<QString>* keyList = CheckIsNodeFrom(nodeToCheck, xmlRelation);

            bool found = false;

            for(int i=0; i < keyList->size() && !found; ++i)
            {
                if(key.compare(keyList->at(i), Qt::CaseInsensitive) == 0)
                {
                    found = true;
                }
            }

            delete keyList;

            //Check this is the wanted node to
            if(found || SearchGivenNodeFrom(nodeToCheck.firstChildElement(), key, xmlRelation))
            {
                return true;
            }
        }
        //Recursive call
        return SearchGivenNodeFrom(nodeToCheck.nextSiblingElement(), key, xmlRelation);
    }
    return false;
}
开发者ID:Mauxx91,项目名称:XML-Editor,代码行数:35,代码来源:XmlRelationCheckerCoreImpl.cpp

示例5: file

void
StationsPluginFactorySimple::loadCities(const QString & xml)
{
  QFile file(xml);
  QDomDocument doc;
  QDomNode city;

  if (!file.exists()) {
    qDebug() << "Skipping non-existent " << xml << "file";
    return ;
  }

  if (!file.open(QIODevice::ReadOnly)) {
    qWarning() << "Can't open" << file.fileName() << ": " << file.error();
    return ;
  }

  doc.setContent(&file);

  city = doc.firstChildElement("cities").firstChildElement("city");
  while (!city.isNull()) {
    loadCity(city);
    city = city.nextSiblingElement("city");
  }
}
开发者ID:iksaif,项目名称:lugdulov,代码行数:25,代码来源:stationspluginfactorysimple.cpp

示例6: parseElementFromChild

void QXmppRpcResponseIq::parseElementFromChild(const QDomElement &element)
{
    QDomElement queryElement = element.firstChildElement("query");
    QDomElement methodElement = queryElement.firstChildElement("methodResponse");

    const QDomElement contents = methodElement.firstChildElement();
    if( contents.tagName().toLower() == "params")
    {
        QDomNode param = contents.firstChildElement("param");
        while (!param.isNull())
        {
            QStringList errors;
            const QVariant value = QXmppRpcMarshaller::demarshall(param.firstChildElement("value"), errors);
            if (!errors.isEmpty())
                break;
            m_values << value;
            param = param.nextSiblingElement("param");
        }
    }
    else if( contents.tagName().toLower() == "fault")
    {
        QStringList errors;
        const QDomElement errElement = contents.firstChildElement("value");
        const QVariant error = QXmppRpcMarshaller::demarshall(errElement, errors);
        if (!errors.isEmpty())
            return;
        m_faultCode = error.toMap()["faultCode"].toInt();
        m_faultString = error.toMap()["faultString"].toString();
    }
}
开发者ID:Lerentis,项目名称:qxmpp,代码行数:30,代码来源:QXmppRpcIq.cpp

示例7: parseInstrName

static QString parseInstrName(const QString& name)
      {
      QString sName;
      QDomDocument dom;
      int line, column;
      QString err;
      if (!dom.setContent(name, false, &err, &line, &column)) {
            QString col, ln;
            col.setNum(column);
            ln.setNum(line);
            QString error = err + "\n at line " + ln + " column " + col;
            qDebug("error: %s\n", qPrintable(error));
            qDebug("   data:<%s>\n", qPrintable(name));
            return QString();
            }

      for (QDomNode e = dom.documentElement(); !e.isNull(); e = e.nextSiblingElement()) {
            for (QDomNode ee = e.firstChild(); !ee.isNull(); ee = ee.nextSibling()) {
                  QDomElement el = ee.toElement();
                  const QString& tag(el.tagName());
                  if (tag == "symbol") {
                        QString name = el.attribute(QString("name"));
                        if (name == "flat")
                              sName += "b";
                        else if (name == "sharp")
                              sName += "#";
                        }
                  QDomText t = ee.toText();
                  if (!t.isNull())
                        sName += t.data();
                  }
            }
      return sName;
      }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:34,代码来源:instrtemplate.cpp

示例8: if

bool UpdatesInfo::Private::parseCompatUpdateElement(const QDomElement & updateE)
{
    if( updateE.isNull() )
        return false;

    UpdateInfo info;
    info.type = CompatUpdate;

    for( QDomNode childNode = updateE.firstChild(); !childNode.isNull(); childNode = childNode.nextSiblingElement() )
    {
        const QDomElement childE = childNode.toElement();
        if( childE.isNull() )
            continue;

        if( childE.tagName() == QLatin1String( "ReleaseNotes" ) ) {
            info.data[childE.tagName()] = QUrl(childE.text());
        }
        else if( childE.tagName() == QLatin1String( "UpdateFile" ) )
        {
            UpdateFileInfo ufInfo;
            ufInfo.platformRegEx = childE.attribute(QLatin1String( "platform-regex" ), QLatin1String( ".*" ));
            ufInfo.compressedSize = childE.attribute( QLatin1String( "compressed-size" ) ).toLongLong();
            ufInfo.uncompressedSize = childE.attribute( QLatin1String( "uncompressed-size" ) ).toLongLong();
            ufInfo.arch = childE.attribute(QLatin1String( "Arch" ), QLatin1String( "i386" ));
            ufInfo.fileName = childE.text();
            info.updateFiles.append(ufInfo);
        }
        else {
            info.data[childE.tagName()] = childE.text();
        }
    }

    if (!info.data.contains( QLatin1String( "CompatLevel" ) ))
    {
        setInvalidContentError(tr("CompatUpdate element without CompatLevel"));
        return false;
    }
    
    if (!info.data.contains( QLatin1String( "ReleaseDate" ) ))
    {
        setInvalidContentError(tr("CompatUpdate element without ReleaseDate"));
        return false;
    }
    
    if (info.updateFiles.isEmpty())
    {
        setInvalidContentError(tr("CompatUpdate element without UpdateFile"));
        return false;
    }

    updateInfoList.append(info);
    return true;
}
开发者ID:KDAB,项目名称:KDTools,代码行数:53,代码来源:kdupdaterupdatesinfo.cpp

示例9: parseXml

bool OSParser::parseXml(QByteArray text) {
    qDebug("OSParser::parseXml: source: '%s'", text.constData());

    s_list.clear();

    bool ok = dom_document.setContent(text);
    qDebug("OSParser::parseXml: success: %d", ok);

    if (!ok) return false;

    QDomNode root = dom_document.documentElement();
    //qDebug("tagname: '%s'", root.toElement().tagName().toLatin1().constData());

    QString base_url = root.firstChildElement("base").text();
    //qDebug("base_url: '%s'", base_url.toLatin1().constData());

    QDomNode child = root.firstChildElement("results");
    if (!child.isNull()) {
        //qDebug("items: %s", child.toElement().attribute("items").toLatin1().constData());
        QDomNode subtitle = child.firstChildElement("subtitle");
        while (!subtitle.isNull()) {
            //qDebug("tagname: '%s'", subtitle.tagName().toLatin1().constData());
            qDebug("OSParser::parseXml: text: '%s'", subtitle.toElement().text().toLatin1().constData());

            OSSubtitle sub;

            sub.releasename = subtitle.firstChildElement("releasename").text();
            QString path = subtitle.firstChildElement("download").text();
            if (path.contains("http://")) {
                sub.link = subtitle.firstChildElement("download").text();
            } else {
                sub.link = base_url + subtitle.firstChildElement("download").text();
            }
            sub.detail = subtitle.firstChildElement("detail").text();
            sub.date = subtitle.firstChildElement("subadddate").text();
            sub.rating = subtitle.firstChildElement("subrating").text();
            sub.comments = subtitle.firstChildElement("subcomments").text();
            sub.movie = subtitle.firstChildElement("movie").text();
            sub.files = subtitle.firstChildElement("files").text();
            sub.format = subtitle.firstChildElement("format").text();
            sub.language = subtitle.firstChildElement("language").text();
            sub.iso639 = subtitle.firstChildElement("iso639").text();
            sub.user = subtitle.firstChildElement("user").text();

            s_list.append(sub);

            subtitle = subtitle.nextSiblingElement("subtitle");
        }
    }

    return true;
}
开发者ID:rdp,项目名称:smplayer-svn,代码行数:52,代码来源:osparser.cpp

示例10: stationsCreated

void
StationsPluginWien::handleInfos(const QByteArray & data)
{
  QDomDocument doc;
  QDomNode node;

  doc.setContent(data);
  node = doc.firstChildElement("stations").firstChildElement("station");

  while (!node.isNull()) {
    Station *station;
    QDomNamedNodeMap attrs = node.attributes();
    int id;
    bool ok;
    qreal lat, lng;

    id = node.firstChildElement("id").text().toInt(&ok);

    if (!ok)
      continue ;

    station = getOrCreateStation(id);

    station->setData(node.firstChildElement("internal_id").text().toInt());

    if (station->name().isEmpty())
      station->setName(node.firstChildElement("name").text());
    if (station->description().isEmpty())
      station->setDescription(node.firstChildElement("description").text());

    lng = node.firstChildElement("longitude").text().toDouble();
    lat = node.firstChildElement("latitude").text().toDouble();

    if (station->pos().isNull())
      station->setPos(QPointF(lat, lng));

    station->setBikes(node.firstChildElement("free_bikes").text().toInt());
    station->setFreeSlots(node.firstChildElement("free_boxes").text().toInt());
    station->setTotalSlots(node.firstChildElement("boxes").text().toInt());

    storeOrDropStation(station);

    node = node.nextSiblingElement("station");
  }

  emit stationsCreated(stations.values());
  emit stationsUpdated(stations.values());
}
开发者ID:iksaif,项目名称:lugdulov,代码行数:48,代码来源:wien.cpp

示例11: SearchGivenNodeTo

QString XmlRelationCheckerCoreImpl::SearchGivenNodeTo(QDomNode nodeToCheck, const QString& key, XmlRelation* xmlRelation,
                                                   const QString& parentNumberBase, int number) const
{
    if(!nodeToCheck.isNull())
    {
        if(nodeToCheck.isElement() && !nodeToCheck.isComment())
        {
            //Initialize the identifiersNumber string with the base number
            QString identifierNumber = parentNumberBase;

            //If it's not empty is because it's the first node and it needn't the dot seprator
            if(!parentNumberBase.isEmpty())
            {
                identifierNumber.append('.');
            }

            //Attach the number
            identifierNumber.append(QString::number(number));

            //Controll if the node is a node to key
            const QString& nodeToKey = CheckIsNodeTo(nodeToCheck, xmlRelation);

            //Check this is the wanted node to
            if(key.compare(nodeToKey, Qt::CaseInsensitive) == 0)
            {
                return identifierNumber;
            }
            //Check the son
            else
            {
                const QString& sonIdentifier = SearchGivenNodeTo(nodeToCheck.firstChildElement(), key, xmlRelation, identifierNumber, 1);

                //If the son is the node searched
                if( ! sonIdentifier.isEmpty())
                {
                    //return the child identifier number
                    return sonIdentifier;
                }
            }
        }
        //Recursive call on the sibling
        return SearchGivenNodeTo(nodeToCheck.nextSiblingElement(), key, xmlRelation, parentNumberBase, number+1);
    }
    return "";
}
开发者ID:Mauxx91,项目名称:XML-Editor,代码行数:45,代码来源:XmlRelationCheckerCoreImpl.cpp

示例12: getSearchSites

		void SongSearch::getSearchSites()
		{
			searchSites.clear();
			QFile file("searchsites.xml");

			if(file.open(QIODevice::ReadOnly))
			{
				QDomDocument doc("SearchSites");
				doc.setContent(&file);
				file.close();

				QDomElement docElement = doc.documentElement();

				QDomNode node = docElement.firstChildElement("Site");
				while(!node.isNull())
				{
					SearchSite site;
					site.songType = node.attributes().namedItem("Type").nodeValue();

					if(ui->anyTypeButton->isChecked() ||
					   (site.songType == "MIDI" && ui->midiButton->isChecked()) ||
					   (site.songType == "UltraStar" && ui->ultraStarButton->isChecked())
					   )
					{
						site.requestType = node.attributes().namedItem("Request").nodeValue() == "POST" ?
									HttpHandler::REQUEST_POST : HttpHandler::REQUEST_GET;
						site.baseUrl = node.attributes().namedItem("BaseUrl").nodeValue();
						site.searchUrl = node.attributes().namedItem("SearchUrl").nodeValue();
						site.searchForParamNames = node.attributes().namedItem("SearchForParamNames").nodeValue().split(';');
						site.searchForParamValues = node.attributes().namedItem("SearchForParamValues").nodeValue().split(';');
						site.queryParamName = node.attributes().namedItem("QueryParamName").nodeValue();
						site.regExp = node.attributes().namedItem("Regex").nodeValue();
						site.resultGroups = node.attributes().namedItem("Groups").nodeValue().split(';');
						site.additionalParams = node.attributes().namedItem("AdditionalParams").nodeValue().split(';');
						searchSites.append(site);
					}
					node = node.nextSiblingElement();
				}
			}
		}
开发者ID:singoutstrong,项目名称:singoutstrong-karaoke-player,代码行数:40,代码来源:songsearch.cpp

示例13: CheckAllRelation

void XmlRelationCheckerCoreImpl::CheckAllRelation(QDomNode nodeToCheck, QList<XmlRelationError*>* errorCollection,
                                                  const QString& absoluteFileName, const QString& parentNumberBase, int number) const
{
    if(!nodeToCheck.isNull())
    {
        if(nodeToCheck.isElement() && !nodeToCheck.isComment())
        {

            //Calcolate the hierarchical number
            QString completeIdentifiersNumber = parentNumberBase;
            //If it's not empty is because it's the first node and it needn't the dot seprator
            if(!parentNumberBase.isEmpty())
            {
                completeIdentifiersNumber.append('.');
            }
            //Attach the number
            completeIdentifiersNumber.append(QString::number(number));

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

            //For every xml relations
            for(int i=0; i < m_pXmlRelationCollection->Size(); ++i)
            {
                //Current analized xml relation
                XmlRelation* xmlRelation = new XmlRelation(*m_pXmlRelationCollection->GetRelationAt(i));

                //If the relation is a SUB_TAG relation
                if(xmlRelation->GetRelationType() == SUB_TAG)
                {

                    //It would be better if it's mantained a list of the finded tag to in order to avoid the research of
                    //the tag from of this tag
                    //It's not inplemented because even without thid optimization it's fast enough

                    //If the current tag is a node from for the current relation then check for the existence of the node to
                    //The current tag is a nofe from is the list of the key contained is at least 1
                    QList<QString>* keyFound = CheckIsNodeFrom(nodeToCheck, xmlRelation);
                    if(keyFound->size() > 0)
                    {
                        //For each key
                        for(int k=0; k < keyFound->size(); ++k)
                        {
                            bool referenceFound = false;

                            //Search in all the files the referenced node to
                            for(int j=0; j < m_xmlDocumentsList->size() && !referenceFound; ++j)
                            {
                                const QDomNode& rootNode = m_xmlDocumentsList->at(j)->GetQDomDocument()->firstChildElement();

                                //Search if this reference is valid
                                referenceFound = referenceFound || ! SearchGivenNodeTo(rootNode, keyFound->at(k), xmlRelation, "", 1).isEmpty();
                            }

                            //If the reference not exist add an error
                            if(!referenceFound)
                            {
                                XmlRelationError* xmlRelationError = new XmlRelationError(absoluteFileName, xmlRelation, completeIdentifiersNumber,
                                                                              keyFound->at(k), XML_RELATION_ERROR_TYPE_REFERENCED_NOT_FOUND);

                                //Add the error in the list
                                errorCollection->append(xmlRelationError);
                            }
                        }
                    }
                    delete keyFound;
                    //If the current tag is a node to for the current relation then check for the existence of the node to
                    const QString& tagToKey = CheckIsNodeTo(nodeToCheck, xmlRelation);
                    if(tagToKey != "") //then is a node to
                    {
                        bool referenceFound = false;

                        //Search in all the files the referencer node from
                        for(int j=0; j < m_xmlDocumentsList->size()  && !referenceFound; ++j)
                        {
                            const QDomNode& rootNode = m_xmlDocumentsList->at(j)->GetQDomDocument()->firstChildElement();

                            //Search if this reference is valid
                            referenceFound = referenceFound || SearchGivenNodeFrom(rootNode, tagToKey, xmlRelation);
                        }

                        //If the reference not exist add an error
                        if(!referenceFound)
                        {
                            XmlRelationError* xmlRelationError = new XmlRelationError(absoluteFileName, xmlRelation, completeIdentifiersNumber,
                                                                          tagToKey, XML_RELATION_ERROR_TYPE_REFERENCED_NEVER_REFERENCED);

                            //Add the error in the list
                            errorCollection->append(xmlRelationError);
                        }
                    }
                }
            }
            //Recursive call that ensure to explore all the document element
            CheckAllRelation(nodeToCheck.firstChildElement(), errorCollection, absoluteFileName, completeIdentifiersNumber, 1);
        }

        //Recursive call that ensure to explore all the document element
        CheckAllRelation(nodeToCheck.nextSiblingElement(), errorCollection, absoluteFileName, parentNumberBase, number+1);
    }
//.........这里部分代码省略.........
开发者ID:Mauxx91,项目名称:XML-Editor,代码行数:101,代码来源:XmlRelationCheckerCoreImpl.cpp

示例14: loadRasterList

bool FilterOutputOpticalFlowPlugin::loadRasterList( QString &mlpFilename,
                                                    QList<OOCRaster> &rasters )
{
    QFile qf(mlpFilename);
	QFileInfo qfInfo(mlpFilename);
	QDir tmpDir = QDir::current();		
	QDir::setCurrent(qfInfo.absoluteDir().absolutePath());
	if( !qf.open(QIODevice::ReadOnly ) )
		return false;

	QString project_path = qfInfo.absoluteFilePath();

	QDomDocument doc("MeshLabDocument");    //It represents the XML document
	if(!doc.setContent( &qf ))	
		return false;

	QDomElement root = doc.documentElement();

	QDomNode node;

	node = root.firstChild();

	//Devices
	while( !node.isNull() )
    {
		if(QString::compare(node.nodeName(),"RasterGroup")==0)
		{
			QDomNode raster; QString filen, label;
			raster = node.firstChild();
			while(!raster.isNull())
			{
                QString imgFile;
				QDomElement el = raster.firstChildElement("Plane");
				while(!el.isNull())
				{
					QString sem = el.attribute("semantic");
                    if( sem == "RGB" )
                    {
					    QString filen = el.attribute("fileName");
					    QFileInfo fi(filen);
                        imgFile = fi.absoluteFilePath();
                    }
					el = node.nextSiblingElement("Plane");
				}

                if( !imgFile.isNull() )
                {
				    QDomNode sh=raster.firstChild();
                    vcg::Shotf shot;
                    ReadShotFromQDomNode( shot, sh );
                    rasters.push_back( OOCRaster(imgFile,shot,rasters.size()) );
                }

				raster=raster.nextSibling();
			}
		}
		node = node.nextSibling();
	}

	QDir::setCurrent(tmpDir.absolutePath());
	qf.close();
	return true;
}
开发者ID:Jerdak,项目名称:meshlab,代码行数:63,代码来源:filter_output_optical_flow.cpp

示例15: loadPattern

Pattern* LocalFileMng::loadPattern( const QString& directory )
{

	InstrumentList* instrList = Hydrogen::get_instance()->getSong()->get_instrument_list();
	Pattern *pPattern = NULL;
	QString patternInfoFile = directory;

	QFile check( patternInfoFile );
	if (check.exists() == false) {
		ERRORLOG( QString("Load Pattern: Data file %1 not found." ).arg( patternInfoFile ) );
		return NULL;
	}


	QDomDocument doc  = LocalFileMng::openXmlDocument( patternInfoFile );
	QFile file( patternInfoFile );

	// root element
	QDomNode rootNode = doc.firstChildElement( "drumkit_pattern" );	// root element
	if (  rootNode.isNull() ) {
		ERRORLOG( "Error reading Pattern: Pattern_drumkit_infonode not found" );
		return NULL;
	}

	QDomNode patternNode = rootNode.firstChildElement( "pattern" );

	QString sName( LocalFileMng::readXmlString( patternNode,"pattern_name", "" ) );
	QString sInfo( LocalFileMng::readXmlString( patternNode,"info", "" ) );
	QString sCategory( LocalFileMng::readXmlString( patternNode,"category", "" ) );


	int nSize = -1;
	nSize = LocalFileMng::readXmlInt( patternNode, "size",nSize ,false,false );
	pPattern = new Pattern( sName, sInfo, sCategory, nSize );



	QDomNode pNoteListNode = patternNode.firstChildElement( "noteList" );
	if ( ! pNoteListNode.isNull() )
	{
		// new code  :)
		QDomNode noteNode = pNoteListNode.firstChildElement( "note" );
		while (  ! noteNode.isNull()  )
		{
			Note* pNote = NULL;
			unsigned nPosition = LocalFileMng::readXmlInt( noteNode, "position", 0 );
			float fLeadLag = LocalFileMng::readXmlFloat( noteNode, "leadlag", 0.0 , false , false);
			float fVelocity = LocalFileMng::readXmlFloat( noteNode, "velocity", 0.8f );
			float fPan_L = LocalFileMng::readXmlFloat( noteNode, "pan_L", 0.5 );
			float fPan_R = LocalFileMng::readXmlFloat( noteNode, "pan_R", 0.5 );
			int nLength = LocalFileMng::readXmlInt( noteNode, "length", -1, true );
			float nPitch = LocalFileMng::readXmlFloat( noteNode, "pitch", 0.0, false, false );
			QString sKey = LocalFileMng::readXmlString( noteNode, "key", "C0", false, false );
			QString nNoteOff = LocalFileMng::readXmlString( noteNode, "note_off", "false", false, false );
			int instrId = LocalFileMng::readXmlInt( noteNode, "instrument", 0, true );

			Instrument *instrRef = instrList->find( instrId );
			if ( !instrRef ) {
				ERRORLOG( QString( "Instrument with ID: '%1' not found. Note skipped." ).arg( instrId ) );
				noteNode = noteNode.nextSiblingElement( "note" );
				continue;
			}
			//assert( instrRef );
			bool noteoff = false;
			if ( nNoteOff == "true" )
				noteoff = true;

			pNote = new Note( instrRef, nPosition, fVelocity, fPan_L, fPan_R, nLength, nPitch);
			pNote->set_key_octave( sKey );
			pNote->set_lead_lag(fLeadLag);
			pNote->set_note_off( noteoff );
			pPattern->insert_note( pNote );
			noteNode = noteNode.nextSiblingElement( "note" );
		}
	}

	return pPattern;

}
开发者ID:ju1ius,项目名称:hydrogen,代码行数:79,代码来源:local_file_mgr.cpp


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