Syndication

feedrss2impl.cpp
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2006 Frank Osterfeld <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "feedrss2impl.h"
9 #include "categoryrss2impl.h"
10 #include "imagerss2impl.h"
11 #include "itemrss2impl.h"
12 #include <personimpl.h>
13 #include <rss2/category.h>
14 #include <rss2/item.h>
15 
16 #include <QDomElement>
17 #include <QList>
18 #include <QMultiMap>
19 #include <QString>
20 
21 namespace Syndication
22 {
23 FeedRSS2Impl::FeedRSS2Impl(Syndication::RSS2::DocumentPtr doc)
24  : m_doc(doc)
25 {
26 }
27 
28 Syndication::SpecificDocumentPtr FeedRSS2Impl::specificDocument() const
29 {
30  return m_doc;
31 }
32 
34 {
36  QList<Syndication::RSS2::Item> entries = m_doc->items();
39  items.reserve(entries.count());
40 
41  for (; it != end; ++it) {
42  ItemRSS2ImplPtr item(new ItemRSS2Impl(*it));
43  items.append(item);
44  }
45 
46  return items;
47 }
48 
50 {
52  QList<Syndication::RSS2::Category> entries = m_doc->categories();
55  categories.reserve(entries.count());
56 
57  for (; it != end; ++it) {
59  categories.append(item);
60  }
61 
62  return categories;
63 }
64 
66 {
67  return m_doc->title();
68 }
69 
71 {
72  return m_doc->link();
73 }
74 
76 {
77  return m_doc->description();
78 }
79 
81 {
82  return QList<PersonPtr>();
83 }
84 
86 {
87  return m_doc->language();
88 }
89 
91 {
92  return m_doc->copyright();
93 }
94 
96 {
97  ImageRSS2ImplPtr ptr(new ImageRSS2Impl(m_doc->image()));
98  return ptr;
99 }
100 
102 {
104 
105  const auto unhandledElements = m_doc->unhandledElements();
106  for (const QDomElement &i : unhandledElements) {
107  ret.insert(i.namespaceURI() + i.localName(), i);
108  }
109 
110  return ret;
111 }
112 
114 {
115  ImageRSS2ImplPtr ptr(new ImageRSS2Impl({}));
116  return ptr;
117 }
118 
119 } // namespace Syndication
QList< ItemPtr > items() const override
A list of items, in the order they were parsed from the feed source.
ImagePtr image() const override
returns an image associated with this item.
void reserve(int alloc)
Syndication::SpecificDocumentPtr specificDocument() const override
returns the format-specific document this abstraction wraps.
QList< ItemPtr > items() const override
A list of items, in the order they were parsed from the feed source.
Definition: feedrdfimpl.cpp:36
QString copyright() const override
returns copyright information about the feed
int count(const T &value) const const
void append(const T &value)
QList< CategoryPtr > categories() const override
returns a list of categories this feed is associated with.
Definition: feedrdfimpl.cpp:52
QMultiMap< QString, QDomElement > additionalProperties() const override
returns a list of feed metadata not covered by this class.
typename QMap< Key, T >::iterator insert(const Key &key, const T &value)
ImagePtr icon() const override
returns an icon associated with this item.
QString title() const override
The title of the feed.
QList< PersonPtr > authors() const override
returns a list of persons who created the feed content.
QList::const_iterator constEnd() const const
Definition: feed.h:20
QList::const_iterator constBegin() const const
QString description() const override
A description of the feed.
QString language() const override
The language used in the feed.
QString link() const override
returns a link pointing to a website associated with this channel.
QList< CategoryPtr > categories() const override
returns a list of categories this feed is associated with.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 22:54:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.