File indexing completed on 2024-04-14 03:46:39

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 KEDUVOCLESSON_H
0008 #define KEDUVOCLESSON_H
0009 
0010 #include "keduvocdocument_export.h"
0011 
0012 #include "keduvoccontainer.h"
0013 
0014 class KEduVocExpression;
0015 
0016 /** class to store information about a lesson */
0017 class KEDUVOCDOCUMENT_EXPORT KEduVocLesson : public KEduVocContainer
0018 {
0019 public:
0020     /** default constructor */
0021     explicit KEduVocLesson(const QString &name, KEduVocContainer *parent = nullptr);
0022 
0023     //     void appendChildLesson(KEduVocLesson *child);
0024 
0025     //     QList<KEduVocLesson *> childLessons();
0026     //     KEduVocLesson *childLesson(int row);
0027 
0028     //     int childLessonCount() const;
0029 
0030     //     int row() const;
0031     //     KEduVocLesson *parent();
0032 
0033     /** copy constructor for d-pointer safe copying */
0034     KEduVocLesson(const KEduVocLesson &other);
0035 
0036     /** destructor */
0037     ~KEduVocLesson() override;
0038 
0039     /** assignment operator */
0040     KEduVocLesson &operator=(const KEduVocLesson &);
0041 
0042     KEduVocExpression *entry(int row, EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE;
0043 
0044     /** get a list of all entries in the lesson */
0045     QList<KEduVocExpression *> entries(EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE;
0046 
0047     /** get the number of entries in the lesson */
0048     int entryCount(EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE;
0049 
0050     /** append an entry to the lesson
0051      * @param entry the id of the entry to add
0052      */
0053     void appendEntry(KEduVocExpression *entry);
0054 
0055     /**
0056      * insert an entry at a specific position
0057      * @param index
0058      * @param entry
0059      */
0060     void insertEntry(int index, KEduVocExpression *entry);
0061 
0062     /** remove an entry from the lesson
0063      * @param entry the id of the entry to remove
0064      */
0065     void removeEntry(KEduVocExpression *entry);
0066 
0067 private:
0068     friend class KEduVocDocument;
0069     // This constructor is used by KEduVocDocument when creating the top level lesson.
0070     explicit KEduVocLesson(const QString &name, KEduVocDocument *document);
0071 
0072 private:
0073     class Private;
0074     Private *const d;
0075 };
0076 
0077 #endif