akregator/src/librss

textinput.cpp
1 /*
2  * textinput.cpp
3  *
4  * Copyright (c) 2001, 2002, 2003 Frerich Raabe <raabe@kde.org>
5  *
6  * This program is distributed in the hope that it will be useful, but WITHOUT
7  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8  * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
9  * accompanying file 'COPYING'.
10  */
11 #include "textinput.h"
12 #include "tools_p.h"
13 
14 #include <kurl.h>
15 
16 #include <tqdom.h>
17 
18 using namespace RSS;
19 
20 struct TextInput::Private : public Shared
21 {
22  TQString title;
23  TQString description;
24  TQString name;
25  KURL link;
26 };
27 
28 TextInput::TextInput() : d(new Private)
29 {
30 }
31 
32 TextInput::TextInput(const TextInput &other) : d(0)
33 {
34  *this = other;
35 }
36 
37 TextInput::TextInput(const TQDomNode &node) : d(new Private)
38 {
39  TQString elemText;
40 
41  if (!(elemText = extractNode(node, TQString::fromLatin1("title"))).isNull())
42  d->title = elemText;
43  if (!(elemText = extractNode(node, TQString::fromLatin1("description"))).isNull())
44  d->description = elemText;
45  if (!(elemText = extractNode(node, TQString::fromLatin1("name"))))
46  d->name = elemText;
47  if (!(elemText = extractNode(node, TQString::fromLatin1("link"))).isNull())
48  d->link = elemText;
49 }
50 
52 {
53  if (d->deref())
54  delete d;
55 }
56 
57 TQString TextInput::title() const
58 {
59  return d->title;
60 }
61 
62 TQString TextInput::description() const
63 {
64  return d->description;
65 }
66 
67 TQString TextInput::name() const
68 {
69  return d->name;
70 }
71 
72 const KURL &TextInput::link() const
73 {
74  return d->link;
75 }
76 
78 {
79  if (this != &other) {
80  other.d->ref();
81  if (d && d->deref())
82  delete d;
83  d = other.d;
84  }
85  return *this;
86 }
87 
88 bool TextInput::operator==(const TextInput &other) const
89 {
90  return d->title == other.title() &&
91  d->description == other.description() &&
92  d->name == other.name() &&
93  d->link == other.link();
94 }
Represents a text input facility as stored in a RSS file for the purpose of allowing users to submit ...
Definition: textinput.h:31
TQString title() const
RSS 0.90 and upwards.
Definition: textinput.cpp:57
TQString name() const
RSS 0.90 and upwards.
Definition: textinput.cpp:67
TextInput()
Default constructor.
Definition: textinput.cpp:28
TextInput & operator=(const TextInput &other)
Assignment operator.
Definition: textinput.cpp:77
bool operator==(const TextInput &other) const
Compares two text inputs.
Definition: textinput.cpp:88
TQString description() const
RSS 0.90 and upwards.
Definition: textinput.cpp:62
virtual ~TextInput()
Destructor.
Definition: textinput.cpp:51
const KURL & link() const
RSS 0.90 and upwards.
Definition: textinput.cpp:72