本文整理汇总了C++中QXmlSimpleReader::parseContinue方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlSimpleReader::parseContinue方法的具体用法?C++ QXmlSimpleReader::parseContinue怎么用?C++ QXmlSimpleReader::parseContinue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlSimpleReader
的用法示例。
在下文中一共展示了QXmlSimpleReader::parseContinue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
/* virtual */
void XMLerLoadFileThread::run ()
{
QFile xml( fileName() );
if ( !xml.exists() ) {
emit error ( tr("File %1 does not exists.").arg( fileName() ) );
return;
}
/* QMap<QString, QString> info = getInformationFromFile(); */
QXmlSimpleReader reader;
XMLerInputSource *source = new XMLerInputSource ( &xml );
/* connect source to slots in model */
connect ( source, SIGNAL(beginRead(qint64)), this, SLOT(on_beginProgress(qint64)) );
connect ( source, SIGNAL(readProgress(qint64)), this, SLOT(on_progress(qint64)) );
connect ( source, SIGNAL(endRead()), this, SLOT(on_endProgress()) );
reader.setContentHandler ( handler );
reader.setErrorHandler ( handler );
bool parseResult = reader.parse ( source, true );
/* FIXME: this is partial read */
if ( parseResult ) {
bool partResult = parseResult;
while ( partResult )
partResult = reader.parseContinue();
}
if ( !parseResult ) {
checkExceptionInHandler();
on_endProgress();
return;
}
/* set addition data (information) in document */
if ( handler->document() )
handler->document()->setFileName( fileName() );
/* CLEANIT
if ( !info.isEmpty() ) {
if ( info.contains ( "encoding" ) )
handler->document()->setCodec ( info.value ( "encoding" ) );
if ( info.contains ( "version" ) )
handler->document()->setVersion ( info.value ( "version" ) );
}*/
emit done ( handler->document() );
checkExceptionInHandler ();
/* clean */
disconnect ( source, SIGNAL(beginRead(qint64)) );
disconnect ( source, SIGNAL(readProgress(qint64)) );
disconnect ( source, SIGNAL(endRead()) );
delete source;
}
示例2: handler
RideFile *QuarqFileReader::openRideFile(QFile &file, QStringList &errors, QList<RideFile*>*) const
{
(void) errors;
RideFile *rideFile = new RideFile();
rideFile->setDeviceType("Quarq Qollector");
rideFile->setFileFormat("Quarq ANT+ Files (qla)");
rideFile->setRecIntSecs(1.0);
QuarqParser handler(rideFile);
QProcess *antProcess = getInterpreterProcess( installed_path );
assert(antProcess);
QXmlInputSource source (antProcess);
QXmlSimpleReader reader;
reader.setContentHandler (&handler);
// this could done be a loop to "save memory."
file.open(QIODevice::ReadOnly);
antProcess->write(file.readAll());
antProcess->closeWriteChannel();
antProcess->waitForFinished(-1);
assert(QProcess::NormalExit == antProcess->exitStatus());
assert(0 == antProcess->exitCode());
reader.parse(source);
reader.parseContinue();
QRegExp rideTime("^.*/(\\d\\d\\d\\d)_(\\d\\d)_(\\d\\d)_"
"(\\d\\d)_(\\d\\d)_(\\d\\d)\\.qla$");
if (rideTime.indexIn(file.fileName()) >= 0) {
QDateTime datetime(QDate(rideTime.cap(1).toInt(),
rideTime.cap(2).toInt(),
rideTime.cap(3).toInt()),
QTime(rideTime.cap(4).toInt(),
rideTime.cap(5).toInt(),
rideTime.cap(6).toInt()));
rideFile->setStartTime(datetime);
}
delete antProcess;
return rideFile;
}