From c2223fb67c0c16541d2fab0a8b06f95e22ee2368 Mon Sep 17 00:00:00 2001 From: Jeremy Paul Whiting Date: Thu, 16 Aug 2007 11:01:28 +0000 Subject: [PATCH] lesson class initial checkin svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=700744 --- keduvocdocument/keduvoclesson.cpp | 79 +++++++++++++++++++++++++++++++ keduvocdocument/keduvoclesson.h | 71 +++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 keduvocdocument/keduvoclesson.cpp create mode 100644 keduvocdocument/keduvoclesson.h diff --git a/keduvocdocument/keduvoclesson.cpp b/keduvocdocument/keduvoclesson.cpp new file mode 100644 index 0000000..bb579fb --- /dev/null +++ b/keduvocdocument/keduvoclesson.cpp @@ -0,0 +1,79 @@ +/*************************************************************************** + manage lessons + ----------------------------------------------------------------------- + + begin : August 11, 2007 + + copyright : (C) 2007 Jeremy Whiting + + ----------------------------------------------------------------------- + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 + +/** private class to store information about a lesson */ +class KEduVocLesson::Private +{ + public: + QSet 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 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 index 0000000..c173f6c --- /dev/null +++ b/keduvocdocument/keduvoclesson.h @@ -0,0 +1,71 @@ +/*************************************************************************** + manage lessons + ----------------------------------------------------------------------- + + begin : August 11, 2007 + + copyright : (C) 2007 Jeremy Whiting + + ----------------------------------------------------------------------- + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 +#include + +/** 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 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 -- 2.47.3