work save

This commit is contained in:
Roy Qu 2022-12-16 14:41:24 +08:00
parent 261c0b4cea
commit f4ca71803f
2 changed files with 13 additions and 3 deletions

View File

@ -2,7 +2,7 @@
#include <QFile>
#include <QXmlStreamReader>
#
#include <QXmlStreamWriter>
QList<POJProblem> importFreeProblemSet(const QString &filename)
{
@ -14,7 +14,6 @@ QList<POJProblem> importFreeProblemSet(const QString &filename)
xml.setDevice(&file);
POJProblem currentProblem;
POJProblemCase currentCase;
QString currentText;
QString currentEleName;
while(!xml.atEnd()) {
xml.readNext();
@ -94,3 +93,14 @@ QList<POJProblem> importFreeProblemSet(const QString &filename)
}
return problems;
}
void exportFreeProblemSet(const QList<POJProblem> &problems, const QString &filename)
{
QFile file(filename);
if (!file.open(QFile::WriteOnly|QFile::Truncate))
return;
QXmlStreamWriter writer(&file);
writer.setAutoFormatting(true);
writer.writeStartDocument();
writer.writeEndDocument();
}

View File

@ -4,6 +4,6 @@
#include "ojproblemset.h"
QList<POJProblem> importFreeProblemSet(const QString& filename);
//void exportFreeProblemSet(const QList<POJProblem>& problems);
void exportFreeProblemSet(const QList<POJProblem>& problems, const QString& filename);
#endif // FREEPROJECTSETFORMAT_H