From f4ca71803feb90847196b39b2edaf32030849991 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 16 Dec 2022 14:41:24 +0800 Subject: [PATCH] work save --- RedPandaIDE/problems/freeprojectsetformat.cpp | 14 ++++++++++++-- RedPandaIDE/problems/freeprojectsetformat.h | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/RedPandaIDE/problems/freeprojectsetformat.cpp b/RedPandaIDE/problems/freeprojectsetformat.cpp index e8e71012..4e79235b 100644 --- a/RedPandaIDE/problems/freeprojectsetformat.cpp +++ b/RedPandaIDE/problems/freeprojectsetformat.cpp @@ -2,7 +2,7 @@ #include #include -# +#include QList importFreeProblemSet(const QString &filename) { @@ -14,7 +14,6 @@ QList 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 importFreeProblemSet(const QString &filename) } return problems; } + +void exportFreeProblemSet(const QList &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(); +} diff --git a/RedPandaIDE/problems/freeprojectsetformat.h b/RedPandaIDE/problems/freeprojectsetformat.h index 8b635000..ffac0ed2 100644 --- a/RedPandaIDE/problems/freeprojectsetformat.h +++ b/RedPandaIDE/problems/freeprojectsetformat.h @@ -4,6 +4,6 @@ #include "ojproblemset.h" QList importFreeProblemSet(const QString& filename); -//void exportFreeProblemSet(const QList& problems); +void exportFreeProblemSet(const QList& problems, const QString& filename); #endif // FREEPROJECTSETFORMAT_H