File indexing completed on 2024-04-21 03:48:22
0001 /* 0002 * SPDX-FileCopyrightText: 2007 Jeremy Whiting <jpwhiting@kde.org> 0003 * SPDX-FileCopyrightText: 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KEDUVOCWORDTYPE_H 0008 #define KEDUVOCWORDTYPE_H 0009 0010 #include "keduvocdocument_export.h" 0011 0012 #include "keduvoccontainer.h" 0013 0014 #include "keduvocwordflags.h" 0015 0016 #include <QList> 0017 #include <QString> 0018 0019 class KEduVocExpression; 0020 class KEduVocTranslation; 0021 0022 /** class to store translation word types */ 0023 class KEDUVOCDOCUMENT_EXPORT KEduVocWordType : public KEduVocContainer 0024 { 0025 public: 0026 /** default constructor */ 0027 explicit KEduVocWordType(const QString &name, KEduVocWordType *parent = nullptr); 0028 0029 /** destructor */ 0030 ~KEduVocWordType() override; 0031 0032 /** assignment operator */ 0033 // KEduVocWordType& operator= ( const KEduVocWordType& ); 0034 0035 /** 0036 * Internally (different from the name) the class can have one of the preset word types. These are used to determine special properties (verbs have 0037 * conjugations available for example). 0038 * @param flags 0039 */ 0040 void setWordType(KEduVocWordFlags flags); 0041 0042 /** 0043 * Return the raw WordTypeFlags. Returns NoInformation if no flags are set. 0044 * @return WordTypeFlags 0045 */ 0046 KEduVocWordFlags wordType() const; 0047 0048 /** 0049 * Return a child class (or this class) that is of the specified type. Returns 0 if no class of that type is found. 0050 * @param flags 0051 * @return 0052 */ 0053 KEduVocWordType *childOfType(KEduVocWordFlags flags); 0054 0055 /** 0056 * The word type class does keep track of individual translations, because for one entry, the translations can have different word types (eg. genders of 0057 * nouns tend to be different in different languages). 0058 * @param row 0059 * @return 0060 */ 0061 KEduVocTranslation *translation(int row); 0062 0063 /** 0064 * get a list of all entries in the lesson 0065 * @param recursive include entries in sublessons 0066 * @return 0067 */ 0068 QList<KEduVocExpression *> entries(EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE; 0069 0070 KEduVocExpression *entry(int row, EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE; 0071 0072 /** get the number of entries in the lesson */ 0073 int entryCount(EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE; 0074 0075 private: 0076 class Private; 0077 Private *const d; 0078 0079 /** add an entry to the lesson 0080 * @param entryid id of the entry to add 0081 */ 0082 void addTranslation(KEduVocTranslation *translation); 0083 0084 /** remove an entry from the lesson 0085 * @param entryid id of the entry to remove 0086 */ 0087 void removeTranslation(KEduVocTranslation *translation); 0088 0089 friend class KEduVocTranslation; 0090 }; 0091 0092 #endif