-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexam.h
More file actions
142 lines (112 loc) · 5.05 KB
/
exam.h
File metadata and controls
142 lines (112 loc) · 5.05 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/***************************************************************************
* Copyright (C) 2003-2007 by Oliver Saal *
* osaal@gmx.de *
* http://www.oliver-saal.de/software/afutrainer/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef EXAM_H
#define EXAM_H
#include <qstring.h>
#include <qlist.h>
#include <qdom.h>
#include <qdatetime.h>
#include <qstringlist.h>
class CQuestion;
class CExamPart
{
public:
CExamPart() { clear(); }
~CExamPart() {}
void clear();
inline int questionCount() const { return m_iQuestionCount; }
inline void setQuestionCount(int i) { m_iQuestionCount = i; }
inline QString group() const { return m_strGroup; }
inline void setGroup(const QString& str) { m_strGroup = str; }
inline QString regexp() const { return m_strRegExp; }
inline void setRegExp(const QString& str) { m_strRegExp = str; }
bool load (QDomElement elem);
void save (QDomElement& parent, QDomDocument& doc) const;
QList<CQuestion*> createQuestionPool(const QList<CQuestion*>& listAllQuestions) const;
protected:
int m_iQuestionCount;
QString m_strGroup;
QString m_strRegExp;
};
class CExam
{
public:
CExam() { clear(); }
~CExam() {}
//! Zurücksetzen aller Werte
/*! Es werden alle Daten der Prüfung gelöscht. */
void clear();
//! ID abfragen
inline QString id() const { return m_strId; }
//! ID setzen
inline void setId(const QString& strId) { m_strId = strId; }
inline QString name() const { return m_strName; }
inline QString comment() const { return m_strComment; }
unsigned duration() const { return m_uDuration; }
unsigned maxErrorPoints() const { return m_uMaxErrorPoints; }
unsigned questionCount() const;
bool load (QDomElement elem);
void save (QDomElement& parent, QDomDocument& doc) const;
QList<CQuestion*> createQuestionPool(const QList<CQuestion*>& listAllQuestions) const;
protected:
QString m_strId; //< ID der Prüfung
QString m_strName; //< Name / Bezeichnung
QString m_strComment; //< Kommentar / Hinweis
unsigned m_uDuration; //< Prüfungsdauer in min
unsigned m_uMaxErrorPoints; //< Max. Anzahl an erlaubten Fehlerpunkten, um die Prüfung zu bestehen
QList<CExamPart> m_listParts; //< Abschnitte, aus denen sich die Prüfung zusammensetzt.
};
class CExamStat
{
public:
CExamStat() { clear(); }
CExamStat(const CExam& exam);
~CExamStat() {}
//! Zurücksetzen aller Werte
/*! Es werden alle Daten dieser Prüfungsstatistik gelöscht. */
void clear();
bool load (QDomElement elem);
void save (QDomElement& parent, QDomDocument& doc) const;
//! ID abfragen
inline QString id() const { return m_strId; }
//! ID setzen
inline void setId(const QString& strId) { m_strId = strId; }
inline void setSecs(const unsigned uSecs) { m_uSecs = uSecs; }
void setQuestions(const QList<CQuestion*>& listQuestion, const QList<unsigned>& listAnswerMask);
void setResult (const unsigned uCorrect, const unsigned uWrong, const unsigned uErrorPoints, const bool bPassed);
inline unsigned duration() const { return m_uSecs; }
inline bool passed() const { return m_bPassed; }
inline unsigned correctAnswers() const { return m_uCorrect; }
inline unsigned wrongAnswers() const { return m_uWrong; }
inline unsigned errorPoints() const { return m_uErrorPoints; }
QDateTime datetime() const { return m_dt; }
protected:
QString m_strId; //< ID der Prüfung
QDateTime m_dt; //< Datum/Uhrzeit
unsigned m_uSecs; //< Benötigte Zeit in sec
QStringList m_strlQuestionId; //< IDs der Fragen
QList<unsigned> m_listAnswer; //< Antworten
unsigned m_uCorrect; //< Anzahl d. richtigen Fragen
unsigned m_uWrong; //< Anzahl d. falschen Fragen
unsigned m_uErrorPoints; //< Fehlerpunkte
bool m_bPassed; //< Bestanden Ja/Nein
};
#endif