LibKEduVocDocument

keduvocexpression.h
1/*
2 * Vocabulary Expression for KDE Edu
3 * SPDX-FileCopyrightText: 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
4 * SPDX-FileCopyrightText: 2005-2007 Peter Hedlund <peter.hedlund@kdemail.net>
5 * SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8#ifndef KEDUVOCEXPRESSION_H
9#define KEDUVOCEXPRESSION_H
10
11#include "keduvocdocument_export.h"
12
13#include <QDateTime>
14
15#include "keduvocarticle.h"
16#include "keduvoclesson.h"
17#include "keduvocmultiplechoice.h"
18#include "keduvoctranslation.h"
19
20class KEduVocLesson;
21
22/**
23 This class contains one vocabulary expression as an original with one or more
24 translations
25 */
26class KEDUVOCDOCUMENT_EXPORT KEduVocExpression
27{
28public:
29 /** default constructor for an empty vocabulary expression
30 */
31 explicit KEduVocExpression();
32
33 /** Constructor for a vocabulary expression with one translation
34 *
35 * @param expression translation
36 */
37 explicit KEduVocExpression(const QString &expression);
38
39 /** Constructor for a vocabulary expression with an original and one or more translations
40 *
41 * @param translations translations
42 */
43 explicit KEduVocExpression(const QStringList &translations);
44
46
48
49 /** return the lesson
50 */
51 KEduVocLesson *lesson() const;
52
53 /** reset all grades of the entry
54 * @param index identifier (language)
55 */
56 void resetGrades(int index);
57
58 /** returns flag if entry is activated for queries
59 */
60 bool isActive() const;
61
62 /** set entry active (enabled for queries)
63 */
64 void setActive(bool flag = true);
65
66 /**
67 * Add a translation to this expression
68 * @param index number of translation = the identifier
69 * @param expression the translation
70 */
71 void setTranslation(int index, const QString &expression);
72
73 /** removes a translation
74 *
75 * @param index number of translation 1..x
76 */
77 void removeTranslation(int index);
78
79 /**
80 * Get a pointer to the translation
81 * @param index of the language identifier
82 * @return the translation
83 */
85 KEduVocTranslation *translation(int index) const;
86
87 QList<int> translationIndices() const;
88
89 KEduVocExpression &operator=(const KEduVocExpression &expression);
90 bool operator==(const KEduVocExpression &expression) const;
91
92private:
93 class KEduVocExpressionPrivate;
94 KEduVocExpressionPrivate *const d;
95
96 /** only called by lesson to add itself to the lesson list
97 */
98 void setLesson(KEduVocLesson *l);
99
100 friend class KEduVocLesson;
101};
102
103#endif // KEduVocExpression_H
void resetGrades(int index)
reset all grades of the entry
void setTranslation(int index, const QString &expression)
Add a translation to this expression.
KEduVocExpression()
default constructor for an empty vocabulary expression
KEduVocLesson * lesson() const
return the lesson
bool isActive() const
returns flag if entry is activated for queries
void setActive(bool flag=true)
set entry active (enabled for queries)
void removeTranslation(int index)
removes a translation
KEduVocTranslation * translation(int index)
Get a pointer to the translation.
class to store information about a lesson
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:20 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.