LibKEduVocDocument

keduvoctranslation.h
1/*
2 * Vocabulary Expression Translation for KDE Edu
3 * SPDX-FileCopyrightText: 2007-2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KEDUVOCTRANSLATION_H
8#define KEDUVOCTRANSLATION_H
9
10#include "keduvocconjugation.h"
11#include "keduvocdocument_export.h"
12#include "keduvoctext.h"
13#include <QMap>
14#include <QString>
15#include <QUrl>
17class KEduVocWordType;
20
21/**
22 @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
23*/
24class KEDUVOCDOCUMENT_EXPORT KEduVocTranslation : public KEduVocText
25{
26public:
27 enum Related {
28 Synonym,
29 Antonym,
30 FalseFriend,
31 };
32
33 /**
34 * Default constructor for an empty translation.
35 */
37
38 /**
39 * Constructor
40 * @param entry
41 * @param translation is used as translation
42 */
43 KEduVocTranslation(KEduVocExpression *entry, const QString &translation);
44
45 /** copy constructor for d-pointer safety */
47
48 /**
49 * Destructor
50 */
52
53 KEduVocExpression *entry();
54
55 /** Sets the pronunciation of this expression
56 * @param expression pronunciation of this index
57 */
58 void setPronunciation(const QString &expression);
59
60 /** Returns the pronunciation of this expression
61 * @return pronunciation or "" if none available
62 */
63 QString pronunciation() const;
64
65 /** Returns comments of this expression
66 * @return comment or "" if no comment available
67 */
68 QString comment() const;
69
70 /** Sets comment of this expression
71 * @param expr comment of this index
72 */
73 void setComment(const QString &expr);
74
75 /** Sets example this expression
76 * @param expression example of this index
77 */
78 void setExample(const QString &expression);
79
80 /** Returns example of this expression
81 * @return example or "" if no string available
82 */
83 QString example() const;
84
85 /** Sets paraphrase of this expression
86 * @param expression paraphrase of this index
87 */
88 void setParaphrase(const QString &expression);
89
90 /** Returns paraphrase of this expression
91 * @return paraphrase or "" if no string available
92 */
93 QString paraphrase() const;
94
95 /** Sets antonym this expression
96 * @param expression antonym of this index
97 */
98 void setAntonym(const QString &expression);
99
100 /** Returns antonym of this expression
101 * @return antonym or "" if no string available
102 */
104
105 /**
106 * Sets an irregular plural form.
107 * @param plural plural of the word
108 */
109 void setIrregularPlural(const QString &plural);
110
111 /**
112 * Gets an irregular plural form.
113 * @return plural of the word
114 */
116
117 /** Returns the word type of this expression, you will get a 0 pointer
118 * if wordtype is not set for the translation
119 *
120 * @return type or "" if no type available
121 */
122 KEduVocWordType *wordType() const;
123
124 /** Sets the word type of this expression
125 * @param wordType type of this expression ("" = none)
126 */
127 void setWordType(KEduVocWordType *wordType);
128
129 /** Returns the leitner box of this translation
130 * @return the box
131 */
132 KEduVocLeitnerBox *leitnerBox() const;
133
134 /** Sets the leitner box of this translation
135 * @param leitnerBox the box
136 */
137 void setLeitnerBox(KEduVocLeitnerBox *leitnerBox);
138
139 /**
140 * This method is deprecated, please use @see getConjugation() @see setConjugation()
141 * Returns a conjugation if available
142 * @param tense tense of the requested conjugation
143 * @return the conjugation
144 */
145 KEDUVOCDOCUMENT_DEPRECATED KEduVocConjugation &conjugation(const QString &tense);
146
147 /**
148 * Returns a conjugation if available
149 * @param tense tense of the requested conjugation
150 * @return the conjugation
151 */
152 KEduVocConjugation getConjugation(const QString &tense) const;
153
154 /** adds conjugations or replaces them, if they exist.
155 * @param tense tense
156 * @param conjugation conjugation
157 */
158 void setConjugation(const QString &tense, const KEduVocConjugation &conjugation);
159
160 /**
161 * Returns a pointer to the declension object of this translation.
162 * Returns 0 if no declension object exists!
163 * @return the declension
164 */
165 KEduVocDeclension *declension();
166
167 /**
168 * Set a new declension for a translation
169 * @param declension
170 */
171 void setDeclension(KEduVocDeclension *declension);
172
173 /**
174 * Bad, only used for tense entry page, will be deleted later. Deprecated.
175 * @param conjugations
176 */
177 void setConjugations(const QMap<QString, KEduVocConjugation> &conjugations);
178
179 QStringList conjugationTenses() const;
180
181 /**
182 * Bad, only compatibility. Deprecated.
183 * @return
184 */
185 KEDUVOCDOCUMENT_DEPRECATED QMap<QString, KEduVocConjugation> conjugations() const;
186
187 /**
188 * Comparison forms of adjectives/adverbs.
189 */
190 KEDUVOCDOCUMENT_DEPRECATED QString comparative() const;
191 KEDUVOCDOCUMENT_DEPRECATED void setComparative(const QString &comparative);
192 // TODO rename to comparative and remove the deprecated function
193 KEduVocText comparativeForm() const;
194 void setComparativeForm(const KEduVocText &comparative);
195
196 KEDUVOCDOCUMENT_DEPRECATED QString superlative() const;
197 KEDUVOCDOCUMENT_DEPRECATED void setSuperlative(const QString &superlative);
198 KEduVocText superlativeForm() const;
199 void setSuperlativeForm(const KEduVocText &superlative);
200
201 KEduVocText article() const;
202 void setArticle(const KEduVocText &article);
203
204 /**
205 * This method is deprecated, please use @see getMultipleChoice() @see setMultipleChoice()
206 * Returns multiple choice if available
207 */
208 KEDUVOCDOCUMENT_DEPRECATED QStringList &multipleChoice();
209
210 /**
211 * Returns multiple choice if available
212 * @return list of multiple choice answers
213 */
214 QStringList getMultipleChoice() const;
215
216 /** Sets multiple choice
217 * @param choices multiple choice block
218 */
219 void setMultipleChoice(const QStringList &choices);
220
221 /** Get the sound url for this translation if it exists */
222 QUrl soundUrl();
223
224 /** Set the sound url for this translation
225 * @param url url of the sound file */
226 void setSoundUrl(const QUrl &url);
227
228 /** Get the image url for this translation if it exists */
229 QUrl imageUrl();
230
231 /** Set the image url for this translation
232 * @param url url of the image
233 */
234 void setImageUrl(const QUrl &url);
235
236 /**
237 * Add a false friend
238 * @param falseFriend false friend of this index
239 */
240 void addFalseFriend(KEduVocTranslation *falseFriend);
241
242 /**
243 * Remove a false friend
244 * @param falseFriend false friend of this index
245 */
246 void removeFalseFriend(KEduVocTranslation *falseFriend);
247
248 /**
249 * Returns false friends of this expression
250 * @return list of false friends
251 */
252 QList<KEduVocTranslation *> falseFriends() const;
253
254 /**
255 * Add a synonym
256 * @param synonym
257 */
258 void addSynonym(KEduVocTranslation *synonym);
259
260 /**
261 * Remove a synonym
262 * @param synonym
263 */
264 void removeSynonym(KEduVocTranslation *synonym);
265
266 /**
267 * Returns synonyms of this expression
268 * @return synonyms
269 */
270 QList<KEduVocTranslation *> synonyms() const;
271
272 /**
273 * Add a antonym
274 * @param antonym
275 */
276 void addAntonym(KEduVocTranslation *antonym);
277
278 /**
279 * Remove a antonym
280 * @param antonym
281 */
282 void removeAntonym(KEduVocTranslation *antonym);
283
284 /**
285 * Returns antonyms of this expression
286 * @return antonyms
287 */
288 QList<KEduVocTranslation *> antonyms() const;
289
290 /**
291 * Equal operator to assign a translation to another one.
292 * @param translation translation to be copied
293 * @return reference to the new translation
294 */
296
297 /**
298 * Compare two translations, including word type etc.
299 * @param translation
300 * @return true if equal
301 */
302 bool operator==(const KEduVocTranslation &translation) const;
303
304 void fromKVTML2(QDomElement &parent);
305 void toKVTML2(QDomElement &parent);
306
307private:
308 class KEduVocTranslationPrivate;
309 KEduVocTranslationPrivate *const d;
310
311 // for the copy constructor
312 void setEntry(KEduVocExpression *entry);
313 friend class KEduVocExpression;
314};
315
316#endif
The conjugation of a verb.
A declension contains all forms that a NOUN possibly can have.
This class contains one vocabulary expression as an original with one or more translations.
Leitner Boxes are an alternative grading system.
A text in vocabulary documents.
Definition keduvoctext.h:50
bool operator==(const KEduVocText &other) const
Compare two sets of grades.
KEduVocText & operator=(const KEduVocText &other)
Equal operator to copy grades.
void setIrregularPlural(const QString &plural)
Sets an irregular plural form.
void setAntonym(const QString &expression)
Sets antonym this expression.
QString antonym() const
Returns antonym of this expression.
QString irregularPlural() const
Gets an irregular plural form.
class to store translation word types
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.