-
Notifications
You must be signed in to change notification settings - Fork 0
/
testswriter.h
61 lines (50 loc) · 1.48 KB
/
testswriter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef TESTSWRITER_H
#define TESTSWRITER_H
#include <QString>
#include <QVector>
#include <fstream>
class TestsWriter
{
public:
class Question
{
public:
enum AnswerType
{
NONE,
SINGLE_CHOICE,
MULTIPLE_CHOICE,
STRING_ANSWER
};
Question();
Question(const QString &question,
const QVector<QString> &filenames,
const AnswerType &answerType,
const QVector<QString> &answers,
const QVector<size_t> &correctAnswerIndicies);
QString getQuestionText() const;
QVector<QString> getFilenames() const;
AnswerType getAnswerType() const;
QVector<QString> getAnswers() const;
QVector<size_t> getCorrectAnswerIndicies() const;
void setReadable(bool flag);
bool readable() const;
private:
QString _question;
QVector<QString> _filenames;
AnswerType _answerType;
QVector<QString> _answers;
QVector<size_t> _correctAnswerIndicies;
bool _isReadable;
};
void setQuestionsCount(size_t count);
bool addQuestion(const Question &question, size_t index);
bool getQuestion(Question &question, size_t index) const;
QVector<size_t> getIncompleteQuestionIndicies() const;
void saveTest(std::ofstream &file);
void resetTest();
private:
size_t _questionsCount = 0;
QVector<Question> _questions;
};
#endif // TESTSWRITER_H