]> Git trees. - libqmvoc.git/commitdiff
lesson class initial checkin
authorJeremy Paul Whiting <jpwhiting@kde.org>
Thu, 16 Aug 2007 11:01:28 +0000 (11:01 +0000)
committerJeremy Paul Whiting <jpwhiting@kde.org>
Thu, 16 Aug 2007 11:01:28 +0000 (11:01 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=700744

keduvocdocument/keduvoclesson.cpp [new file with mode: 0644]
keduvocdocument/keduvoclesson.h [new file with mode: 0644]

diff --git a/keduvocdocument/keduvoclesson.cpp b/keduvocdocument/keduvoclesson.cpp
new file mode 100644 (file)
index 0000000..bb579fb
--- /dev/null
@@ -0,0 +1,79 @@
+/***************************************************************************
+              manage lessons
+    -----------------------------------------------------------------------
+
+    begin        : August 11, 2007
+
+    copyright    : (C) 2007 Jeremy Whiting <jeremywhiting@scitools.com>
+
+    -----------------------------------------------------------------------
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "keduvoclesson.h"
+
+#include <QSet>
+
+/** private class to store information about a lesson */
+class KEduVocLesson::Private
+{
+       public:
+               QSet<int> m_entries;
+               QString m_description;
+};
+
+KEduVocLesson::KEduVocLesson()
+: d(new Private)
+{
+}
+
+KEduVocLesson::KEduVocLesson(const KEduVocLesson &other)
+: d(new Private)
+{
+       d->m_entries = other.d->m_entries;
+       d->m_description = other.d->m_description;
+}
+
+KEduVocLesson::~KEduVocLesson()
+{
+       delete d;
+}
+
+KEduVocLesson& KEduVocLesson::operator=(const KEduVocLesson &other)
+{
+  d->m_entries = other.d->m_entries;
+  d->m_description = other.d->m_description;
+}
+
+void KEduVocLesson::setDescription(const QString &description)
+{
+       d->m_description = description;
+}
+
+QString KEduVocLesson::description()
+{
+       return d->m_description;
+}
+
+QList<int> KEduVocLesson::entries()
+{
+       return d->m_entries.toList();
+}
+
+void KEduVocLesson::addEntry(int entryid)
+{
+       d->m_entries.insert(entryid);
+}
+
+void KEduVocLesson::removeEntry(int entryid)
+{
+       d->m_entries.remove(entryid);
+}
diff --git a/keduvocdocument/keduvoclesson.h b/keduvocdocument/keduvoclesson.h
new file mode 100644 (file)
index 0000000..c173f6c
--- /dev/null
@@ -0,0 +1,71 @@
+/***************************************************************************
+              manage lessons
+    -----------------------------------------------------------------------
+
+    begin        : August 11, 2007
+
+    copyright    : (C) 2007 Jeremy Whiting <jeremywhiting@scitools.com>
+
+    -----------------------------------------------------------------------
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef KEDUVOCLESSON_H
+#define KEDUVOCLESSON_H
+
+#include "libkeduvocdocument_export.h"
+
+#include <QList>
+#include <QString>
+
+/** class to store information about a lesson */
+class KEDUVOCDOCUMENT_EXPORT KEduVocLesson
+{
+       public:
+               /** default constructor */
+               explicit KEduVocLesson();
+               
+               /** copy constructor for d-pointer safe copying */
+               KEduVocLesson(const KEduVocLesson &other);
+               
+               /** destructor */
+               ~KEduVocLesson();
+               
+    /** assignment operator */
+    KEduVocLesson& operator=(const KEduVocLesson&);
+    
+               /** set the lesson description
+                * @param description text to set for the description 
+                */
+               void setDescription(const QString &description);
+               
+               /** get the lesson description */
+               QString description();
+               
+               /** get a list of all entries in the lesson */
+               QList<int> entries();
+               
+               /** add an entry to the lesson
+                * @param entryid id of the entry to add
+                */
+               void addEntry(int entryid);
+               
+               /** remove an entry from the lesson
+                * @param entryid id of the entry to remove
+                */
+               void removeEntry(int entryid);
+               
+       private:
+               class Private;
+               Private * const d;
+};
+
+#endif