akregator/src/librss

textinput.cpp

00001 /*
00002  * textinput.cpp
00003  *
00004  * Copyright (c) 2001, 2002, 2003 Frerich Raabe <raabe@kde.org>
00005  *
00006  * This program is distributed in the hope that it will be useful, but WITHOUT
00007  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00008  * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
00009  * accompanying file 'COPYING'.
00010  */
00011 #include "textinput.h"
00012 #include "tools_p.h"
00013 
00014 #include <kurl.h>
00015 
00016 #include <qdom.h>
00017 
00018 using namespace RSS;
00019 
00020 struct TextInput::Private : public Shared
00021 {
00022     QString title;
00023     QString description;
00024     QString name;
00025     KURL link;
00026 };
00027 
00028 TextInput::TextInput() : d(new Private)
00029 {
00030 }
00031 
00032 TextInput::TextInput(const TextInput &other) : d(0)
00033 {
00034     *this = other;
00035 }
00036 
00037 TextInput::TextInput(const QDomNode &node) : d(new Private)
00038 {
00039     QString elemText;
00040 
00041     if (!(elemText = extractNode(node, QString::fromLatin1("title"))).isNull())
00042         d->title = elemText;
00043     if (!(elemText = extractNode(node, QString::fromLatin1("description"))).isNull())
00044         d->description = elemText;
00045     if (!(elemText = extractNode(node, QString::fromLatin1("name"))))
00046         d->name = elemText;
00047     if (!(elemText = extractNode(node, QString::fromLatin1("link"))).isNull())
00048         d->link = elemText;
00049 }
00050 
00051 TextInput::~TextInput()
00052 {
00053     if (d->deref())
00054         delete d;
00055 }
00056 
00057 QString TextInput::title() const
00058 {
00059     return d->title;
00060 }
00061 
00062 QString TextInput::description() const
00063 {
00064     return d->description;
00065 }
00066 
00067 QString TextInput::name() const
00068 {
00069     return d->name;
00070 }
00071 
00072 const KURL &TextInput::link() const
00073 {
00074     return d->link;
00075 }
00076 
00077 TextInput &TextInput::operator=(const TextInput &other)
00078 {
00079     if (this != &other) {
00080         other.d->ref();
00081         if (d && d->deref())
00082             delete d;
00083         d = other.d;
00084     }
00085     return *this;
00086 }
00087 
00088 bool TextInput::operator==(const TextInput &other) const
00089 {
00090     return d->title == other.title() &&
00091            d->description == other.description() &&
00092            d->name == other.name() &&
00093            d->link == other.link();
00094 }
00095 
00096 // vim:noet:ts=4
KDE Home | KDE Accessibility Home | Description of Access Keys