syndication/atom
24 #include "constants.h"
29 #include "atomtools.h"
31 #include <specificitemvisitor.h>
34 #include <QtXml/QDomElement>
35 #include <QtCore/QString>
37 namespace Syndication {
50 m_feedAuthors = feedAuthors;
55 QList<QDomElement> a =
57 QLatin1String(
"author"));
62 QList<QDomElement>::ConstIterator it = a.constBegin();
63 QList<QDomElement>::ConstIterator end = a.constEnd();
66 for ( ; it != end; ++it)
84 QList<QDomElement> a =
86 QLatin1String(
"contributor"));
89 QList<QDomElement>::ConstIterator it = a.constBegin();
90 QList<QDomElement>::ConstIterator end = a.constEnd();
93 for ( ; it != end; ++it)
103 QList<QDomElement> a =
105 QLatin1String(
"category"));
106 QList<Category> list;
108 QList<QDomElement>::ConstIterator it = a.constBegin();
109 QList<QDomElement>::ConstIterator end = a.constEnd();
112 for ( ; it != end; ++it)
123 QLatin1String(
"id"));
129 QList<QDomElement> a =
131 QLatin1String(
"link"));
134 QList<QDomElement>::ConstIterator it = a.constBegin();
135 QList<QDomElement>::ConstIterator end = a.constEnd();
138 for ( ; it != end; ++it)
140 list.append(
Link(*it));
154 QLatin1String(
"source")));
160 QLatin1String(
"published"));
161 return parseDate(pub, ISODate);
167 QLatin1String(
"updated"));
168 return parseDate(upd, ISODate);
184 QLatin1String(
"content")));
190 QList<ElementType> handled;
191 handled.append(ElementType(QLatin1String(
"author"),
atom1Namespace()));
192 handled.append(ElementType(QLatin1String(
"contributor"),
atom1Namespace()));
193 handled.append(ElementType(QLatin1String(
"category"),
atom1Namespace()));
194 handled.append(ElementType(QLatin1String(
"id"),
atom1Namespace()));
195 handled.append(ElementType(QLatin1String(
"link"),
atom1Namespace()));
196 handled.append(ElementType(QLatin1String(
"rights"),
atom1Namespace()));
197 handled.append(ElementType(QLatin1String(
"source"),
atom1Namespace()));
198 handled.append(ElementType(QLatin1String(
"published"),
atom1Namespace()));
199 handled.append(ElementType(QLatin1String(
"updated"),
atom1Namespace()));
200 handled.append(ElementType(QLatin1String(
"summary"),
atom1Namespace()));
201 handled.append(ElementType(QLatin1String(
"title"),
atom1Namespace()));
202 handled.append(ElementType(QLatin1String(
"content"),
atom1Namespace()));
204 QList<QDomElement> notHandled;
206 QDomNodeList children = element().childNodes();
207 for (
int i = 0; i < children.size(); ++i)
209 QDomElement el = children.at(i).toElement();
211 && !handled.contains(ElementType(el.localName(), el.namespaceURI())))
213 notHandled.append(el);
223 info += QLatin1String(
"### Entry: ###################\n");
224 if (!
title().isEmpty())
225 info += QLatin1String(
"title: #") +
title() + QLatin1String(
"#\n");
227 info += QLatin1String(
"summary: #") +
summary() + QLatin1String(
"#\n");
229 info += QLatin1String(
"id: #") +
id() + QLatin1String(
"#\n");
234 info += QLatin1String(
"rights: #") +
rights() + QLatin1String(
"#\n");
237 QString dupdated = dateTimeToString(
updated());
238 if (!dupdated.isNull())
239 info += QLatin1String(
"updated: #") + dupdated + QLatin1String(
"#\n");
241 QString dpublished = dateTimeToString(
published());
242 if (!dpublished.isNull())
243 info += QLatin1String(
"published: #") + dpublished + QLatin1String(
"#\n");
245 QList<Link> dlinks =
links();
246 QList<Link>::ConstIterator endlinks = dlinks.constEnd();
247 for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it)
248 info += (*it).debugInfo();
251 QList<Category>::ConstIterator endcats = dcats.constEnd();
252 for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it)
253 info += (*it).debugInfo();
255 info += QLatin1String(
"### Authors: ###################\n");
257 QList<Person> dauthors =
authors();
258 QList<Person>::ConstIterator endauthors = dauthors.constEnd();
259 for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it)
260 info += (*it).debugInfo();
262 info += QLatin1String(
"### Contributors: ###################\n");
265 QList<Person>::ConstIterator endcontri = dcontri.constEnd();
266 for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it)
267 info += (*it).debugInfo();
272 info += QLatin1String(
"### Entry end ################\n");
279 return visitor->visitAtomEntry(
this);
QString rights() const
copyright information (optional)
A category for categorizing items or whole feeds.
QString atom1Namespace()
namespace used by Atom 1.0 elements
QString title() const
title of the entry (required).
time_t published() const
The datetime of the publication of this entry (optional).
Content content() const
content of the entry (optional) See Content for details
The content element either contains or links the content of an entry.
QString debugInfo() const
returns a description of the content object for debugging purposes
QList< Category > categories() const
a list of categories this entry is filed to (optional)
QString debugInfo() const
returns a description of this entry for debugging purposes
QList< Person > authors() const
authors of the original content (optional)
QString extractAtomText(const Syndication::ElementWrapper &parent, const QString &tagname)
extracts the content of an atomTextConstruct.
QList< Person > authors() const
list of persons who are authors of this entry.
QList< QDomElement > unhandledElements() const
returns all child elements of this entry not covered by this class.
QString summary() const
a short summary, abstract or excerpt of an entry.
bool accept(SpecificItemVisitor *visitor)
Used by visitors for double dispatch.
Entry()
creates a null entry object
QList< Person > contributors() const
list of persons contributing to this entry (optional)
QList< Link > links() const
links pointing to associated web sites and other resources.
Source source() const
source description of the content (optional)
void setFeedAuthors(const QList< Person > &feedAuthors)
Sets the list of the containing feed's authors, which will be used as a fallback in authors() in case...
A link, pointing to webpages, media files on the web ("podcast"), related content,...
time_t updated() const
The datetime of the last modification of this entry (required).
describes a person, with name and optional URI and e-mail address.
QString id() const
ID of the article.
QString debugInfo() const
description of this source object for debugging purposes
If an entry was copied from another feed, this class contains a description of the source feed.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jan 29 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.