LibKEduVocDocument

keduvoctext.h
1/*
2 * SPDX-FileCopyrightText: 2007-2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
6#ifndef KEDUVOCTEXT_H
7#define KEDUVOCTEXT_H
8
9#include "keduvocdocument_export.h"
10#include <QDateTime>
11
12#define KV_MAX_GRADE 7
13#define KV_MIN_GRADE 0
14
15#define KV_NORM_GRADE 0 // not practiced yet
16#define KV_NORM_TEXT I18N_NOOP("Not Practiced Yet")
17
18#define KV_LEV1_GRADE 1
19#define KV_LEV1_TEXT I18N_NOOP("Level 1")
20
21#define KV_LEV2_GRADE 2
22#define KV_LEV2_TEXT I18N_NOOP("Level 2")
23
24#define KV_LEV3_GRADE 3
25#define KV_LEV3_TEXT I18N_NOOP("Level 3")
26
27#define KV_LEV4_GRADE 4
28#define KV_LEV4_TEXT I18N_NOOP("Level 4")
29
30#define KV_LEV5_GRADE 5
31#define KV_LEV5_TEXT I18N_NOOP("Level 5")
32
33#define KV_LEV6_GRADE 6
34#define KV_LEV6_TEXT I18N_NOOP("Level 6")
35
36#define KV_LEV7_GRADE 7
37#define KV_LEV7_TEXT I18N_NOOP("Level 7")
38
39typedef unsigned short grade_t;
40typedef unsigned short count_t;
41
42class QDomElement;
43
44/**
45 * A text in vocabulary documents. Associated with it are grade and date information.
46 * This should be used instead of strings for all things that can be tested and thus get a grade.
47 @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
48*/
49class KEDUVOCDOCUMENT_EXPORT KEduVocText
50{
51public:
52 /** default constructor */
53 KEduVocText(const QString &text = QString());
54
55 /** copy constructor
56 * provides safe copy of d pointer
57 * @param other object to copy from
58 */
59 KEduVocText(const KEduVocText &other);
60
61 /** default destructor */
63
64 /**
65 * The translation as string (the word itself)
66 * @return the translation
67 */
68 QString text() const;
69
70 /**
71 * Sets the translation
72 * @param expr
73 */
74 void setText(const QString &expr);
75
76 /**
77 * Equal operator to copy grades.
78 * @param other grades copied
79 * @return reference to the new grades
80 */
81 KEduVocText &operator=(const KEduVocText &other);
82 /**
83 * Compare two sets of grades.
84 * @param other
85 * @return true if equal
86 */
87 bool operator==(const KEduVocText &other) const;
88
89 /** returns how often this entry has been practiced as int
90 * @returns total count
91 */
92 count_t practiceCount() const;
93
94 /** set how often this entry has been practiced as int
95 * @param count the new count
96 */
97 void setPracticeCount(count_t count);
98
99 /** returns bad query count as int
100 * @returns bad query count
101 */
102 count_t badCount() const;
103
104 /** set bad query count as int
105 * @param count the new count
106 */
107 void setBadCount(count_t count);
108
109 /** increment bad query count of given translation by 1 */
110 void incBadCount();
111
112 /** increment query count of given translation by 1 */
113 void incPracticeCount();
114
115 /**
116 * Clears grading and date information.
117 */
118 void resetGrades();
119
120 /** sets the pregrade
121 * @param grade number of knowledge: 0=known, x=numbers not knows
122 */
123 void setPreGrade(grade_t grade);
124
125 /** returns pregrade
126 */
127 grade_t preGrade() const;
128
129 /** sets the grade
130 * @param grade number of knowledge: 0=known, x=numbers not knows
131 */
132 void setGrade(grade_t grade);
133
134 /** returns grade as int
135 * @returns number of knowledge: 0=known, x=numbers not knows
136 */
137 grade_t grade() const;
138
139 /** increments grade */
140 void incGrade();
141
142 /** decrements grade */
143 void decGrade();
144
145 /** returns last practice date as int
146 */
147 QDateTime practiceDate() const;
148
149 /** Set last query date
150 * @param date the new date
151 */
152 void setPracticeDate(const QDateTime &date);
153
154 /** returns interval until next practice is due
155 */
156 quint32 interval() const;
157
158 /** Set interval until next practice is due.
159 * @param interval the new interval
160 */
161 void setInterval(quint32 interval);
162
163 /**
164 * If the string inside is empty this returns true.
165 * @return
166 */
167 bool isEmpty();
168
169 void fromKVTML2(QDomElement &parent);
170 void toKVTML2(QDomElement &parent);
171
172private:
173 class KEduVocTextPrivate;
174 KEduVocTextPrivate *const d;
175};
176
177#endif
A text in vocabulary documents.
Definition keduvoctext.h:50
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.