KNewStuff
feed.cpp
Go to the documentation of this file.00001 /* 00002 This file is part of KNewStuff2. 00003 Copyright (c) 2007 Josef Spillner <spillner@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #include "feed.h" 00020 00021 #include <kdebug.h> 00022 00023 using namespace KNS; 00024 00025 struct KNS::FeedPrivate { 00026 KTranslatable mName; 00027 KTranslatable mDescription; 00028 KUrl mFeed; 00029 Entry::List mEntries; 00030 }; 00031 00032 Feed::Feed() 00033 : d(new FeedPrivate) 00034 { 00035 } 00036 00037 Feed::~Feed() 00038 { 00039 delete d; 00040 } 00041 00042 void Feed::setName(const KTranslatable& name) 00043 { 00044 d->mName = name; 00045 } 00046 00047 KTranslatable Feed::name() const 00048 { 00049 return d->mName; 00050 } 00051 00052 void Feed::setDescription(const KTranslatable &description) 00053 { 00054 d->mDescription = description; 00055 } 00056 00057 KTranslatable Feed::description() const 00058 { 00059 return d->mDescription; 00060 } 00061 00062 void Feed::setFeedUrl(const KUrl& feedurl) 00063 { 00064 d->mFeed = feedurl; 00065 } 00066 00067 KUrl Feed::feedUrl() const 00068 { 00069 return d->mFeed; 00070 } 00071 00072 void Feed::addEntry(Entry *entry) 00073 { 00074 //kDebug() << "adding entry: " << entry->name().representation() << " to feed: " << this; 00075 d->mEntries.append(entry); 00076 } 00077 00078 void Feed::removeEntry(Entry * entry) 00079 { 00080 //kDebug() << "removing entry: " << entry->name().representation() << " from feed: " << this; 00081 d->mEntries.removeAll(entry); 00082 } 00083 00084 Entry::List Feed::entries() const 00085 { 00086 return d->mEntries; 00087 } 00088