Warning, file /education/libkeduvocdocument/keduvocdocument/keduvocexpression.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Vocabulary Expression for KDE Edu
0003  * SPDX-FileCopyrightText: 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
0004  * SPDX-FileCopyrightText: 2005-2007 Peter Hedlund <peter.hedlund@kdemail.net>
0005  * SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 #ifndef KEDUVOCEXPRESSION_H
0009 #define KEDUVOCEXPRESSION_H
0010 
0011 #include "keduvocdocument_export.h"
0012 
0013 #include <QDateTime>
0014 
0015 #include "keduvoclesson.h"
0016 #include "keduvocarticle.h"
0017 #include "keduvocmultiplechoice.h"
0018 #include "keduvoctranslation.h"
0019 
0020 class KEduVocLesson;
0021 
0022 /**
0023   This class contains one vocabulary expression as an original with one or more
0024   translations
0025   */
0026 class KEDUVOCDOCUMENT_EXPORT KEduVocExpression
0027 {
0028 public:
0029 
0030     /** default constructor for an empty vocabulary expression
0031      */
0032     explicit KEduVocExpression();
0033 
0034     /** Constructor for a vocabulary expression with one translation
0035      *
0036      * @param expression       translation
0037      */
0038     explicit KEduVocExpression( const QString & expression );
0039 
0040     /** Constructor for a vocabulary expression with an original and one or more translations
0041      *
0042      * @param translations      translations
0043      */
0044     explicit KEduVocExpression( const QStringList & translations );
0045 
0046     KEduVocExpression(const KEduVocExpression& other);
0047 
0048     ~KEduVocExpression();
0049 
0050     /** return the lesson
0051      */
0052     KEduVocLesson * lesson() const;
0053 
0054 
0055     /** reset all grades of the entry
0056      * @param index     identifier (language)
0057      */
0058     void resetGrades( int index );
0059 
0060     /** returns flag if entry is activated for queries
0061      */
0062     bool isActive() const;
0063 
0064     /** set entry active (enabled for queries)
0065      */
0066     void setActive( bool flag = true );
0067 
0068     int sizeHint() const;
0069     void setSizeHint( int sizeHint );
0070 
0071     /**
0072      * Add a translation to this expression
0073      * @param index            number of translation = the identifier
0074      * @param expression       the translation
0075      */
0076     void setTranslation( int index, const QString &expression );
0077 
0078     /** removes a translation
0079      *
0080      * @param index            number of translation 1..x
0081      */
0082     void removeTranslation( int index );
0083 
0084     /**
0085      * Get a pointer to the translation
0086      * @param index of the language identifier
0087      * @return the translation
0088      */
0089     KEduVocTranslation* translation( int index );
0090     KEduVocTranslation* translation( int index ) const;
0091 
0092     QList<int> translationIndices() const;
0093 
0094     KEduVocExpression& operator= ( const KEduVocExpression &expression );
0095     bool operator== ( const KEduVocExpression &expression ) const;
0096 
0097 private:
0098     class KEduVocExpressionPrivate;
0099     KEduVocExpressionPrivate* const d;
0100 
0101     /** only called by lesson to add itself to the lesson list
0102      */
0103     void setLesson( KEduVocLesson * l );
0104 
0105     friend class KEduVocLesson;
0106 };
0107 
0108 #endif // KEduVocExpression_H