24 #include "constants.h"
29 #include "atomtools.h"
31 #include <specificitemvisitor.h>
34 #include <QtXml/QDomElement>
35 #include <QtCore/QList>
36 #include <QtCore/QString>
38 namespace Syndication {
51 QList<QDomElement> a =
53 QLatin1String(
"author"));
56 QList<QDomElement>::ConstIterator it = a.constBegin();
57 QList<QDomElement>::ConstIterator end = a.constEnd();
60 for ( ; it != end; ++it)
70 QList<QDomElement> a =
72 QLatin1String(
"contributor"));
75 QList<QDomElement>::ConstIterator it = a.constBegin();
76 QList<QDomElement>::ConstIterator end = a.constEnd();
79 for ( ; it != end; ++it)
89 QList<QDomElement> a =
91 QLatin1String(
"category"));
94 QList<QDomElement>::ConstIterator it = a.constBegin();
95 QList<QDomElement>::ConstIterator end = a.constEnd();
98 for ( ; it != end; ++it)
109 QLatin1String(
"id"));
115 QList<QDomElement> a =
117 QLatin1String(
"link"));
120 QList<QDomElement>::ConstIterator it = a.constBegin();
121 QList<QDomElement>::ConstIterator end = a.constEnd();
124 for ( ; it != end; ++it)
126 list.append(
Link(*it));
140 QLatin1String(
"source")));
146 QLatin1String(
"published"));
147 return parseDate(pub, ISODate);
153 QLatin1String(
"updated"));
154 return parseDate(upd, ISODate);
170 QLatin1String(
"content")));
176 QList<ElementType> handled;
177 handled.append(ElementType(QLatin1String(
"author"),
atom1Namespace()));
178 handled.append(ElementType(QLatin1String(
"contributor"),
atom1Namespace()));
179 handled.append(ElementType(QLatin1String(
"category"),
atom1Namespace()));
180 handled.append(ElementType(QLatin1String(
"id"),
atom1Namespace()));
181 handled.append(ElementType(QLatin1String(
"link"),
atom1Namespace()));
182 handled.append(ElementType(QLatin1String(
"rights"),
atom1Namespace()));
183 handled.append(ElementType(QLatin1String(
"source"),
atom1Namespace()));
184 handled.append(ElementType(QLatin1String(
"published"),
atom1Namespace()));
185 handled.append(ElementType(QLatin1String(
"updated"),
atom1Namespace()));
186 handled.append(ElementType(QLatin1String(
"summary"),
atom1Namespace()));
187 handled.append(ElementType(QLatin1String(
"title"),
atom1Namespace()));
188 handled.append(ElementType(QLatin1String(
"content"),
atom1Namespace()));
190 QList<QDomElement> notHandled;
192 QDomNodeList children = element().childNodes();
193 for (
int i = 0; i < children.size(); ++i)
195 QDomElement el = children.at(i).toElement();
197 && !handled.contains(ElementType(el.localName(), el.namespaceURI())))
199 notHandled.append(el);
209 info += QLatin1String(
"### Entry: ###################\n");
210 if (!
title().isEmpty())
211 info += QLatin1String(
"title: #") +
title() + QLatin1String(
"#\n");
213 info += QLatin1String(
"summary: #") +
summary() + QLatin1String(
"#\n");
215 info += QLatin1String(
"id: #") +
id() + QLatin1String(
"#\n");
220 info += QLatin1String(
"rights: #") +
rights() + QLatin1String(
"#\n");
223 QString dupdated = dateTimeToString(
updated());
224 if (!dupdated.isNull())
225 info += QLatin1String(
"updated: #") + dupdated + QLatin1String(
"#\n");
227 QString dpublished = dateTimeToString(
published());
228 if (!dpublished.isNull())
229 info += QLatin1String(
"published: #") + dpublished + QLatin1String(
"#\n");
231 QList<Link> dlinks =
links();
232 QList<Link>::ConstIterator endlinks = dlinks.constEnd();
233 for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it)
234 info += (*it).debugInfo();
237 QList<Category>::ConstIterator endcats = dcats.constEnd();
238 for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it)
239 info += (*it).debugInfo();
241 info += QLatin1String(
"### Authors: ###################\n");
243 QList<Person> dauthors =
authors();
244 QList<Person>::ConstIterator endauthors = dauthors.constEnd();
245 for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it)
246 info += (*it).debugInfo();
248 info += QLatin1String(
"### Contributors: ###################\n");
251 QList<Person>::ConstIterator endcontri = dcontri.constEnd();
252 for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it)
253 info += (*it).debugInfo();
258 info += QLatin1String(
"### Entry end ################\n");
265 return visitor->visitAtomEntry(
this);
QString summary() const
a short summary, abstract or excerpt of an entry.
bool accept(SpecificItemVisitor *visitor)
Used by visitors for double dispatch.
A category for categorizing items or whole feeds.
QList< Link > links() const
links pointing to associated web sites and other resources.
The content element either contains or links the content of an entry.
A link, pointing to webpages, media files on the web ("podcast"), related content, etc.
QString id() const
ID of the article.
time_t updated() const
The datetime of the last modification of this entry (required).
QString rights() const
copyright information (optional)
QString atom1Namespace()
namespace used by Atom 1.0 elements
Content content() const
content of the entry (optional) See Content for details
QList< Category > categories() const
a list of categories this entry is filed to (optional)
QString debugInfo() const
returns a description of the content object for debugging purposes
Entry()
creates a null entry object
QList< Person > authors() const
list of persons who are authors of this entry.
QString extractAtomText(const Syndication::ElementWrapper &parent, const QString &tagname)
extracts the content of an atomTextConstruct.
If an entry was copied from another feed, this class contains a description of the source feed...
QList< Person > contributors() const
list of persons contributing to this entry (optional)
time_t published() const
The datetime of the publication of this entry (optional).
describes a person, with name and optional URI and e-mail address.
QString debugInfo() const
description of this source object for debugging purposes
QString debugInfo() const
returns a description of this entry for debugging purposes
QList< QDomElement > unhandledElements() const
returns all child elements of this entry not covered by this class.
Source source() const
source description of the content (optional)
QString title() const
title of the entry (required).