Syndication

feedrss2impl.cpp
1/*
2 This file is part of the syndication library
3 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
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
21namespace Syndication
22{
23FeedRSS2Impl::FeedRSS2Impl(Syndication::RSS2::DocumentPtr doc)
24 : m_doc(doc)
25{
26}
27
28Syndication::SpecificDocumentPtr FeedRSS2Impl::specificDocument() const
29{
30 return m_doc;
31}
32
33QList<Syndication::ItemPtr> FeedRSS2Impl::items() const
34{
35 const QList<Syndication::RSS2::Item> entries = m_doc->items();
36
37 QList<ItemPtr> items;
38 items.reserve(entries.count());
39
40 std::transform(entries.cbegin(), entries.cend(), std::back_inserter(items), [](const Syndication::RSS2::Item &entry) {
41 return ItemRSS2ImplPtr(new ItemRSS2Impl(entry));
42 });
43
44 return items;
45}
46
47QList<Syndication::CategoryPtr> FeedRSS2Impl::categories() const
48{
49 const QList<Syndication::RSS2::Category> entries = m_doc->categories();
50
51 QList<CategoryPtr> categories;
52 categories.reserve(entries.count());
53
54 std::transform(entries.cbegin(), entries.cend(), std::back_inserter(categories), [](const Syndication::RSS2::Category &entry) {
55 return CategoryRSS2ImplPtr(new CategoryRSS2Impl(entry));
56 });
57
58 return categories;
59}
60
61QString FeedRSS2Impl::title() const
62{
63 return m_doc->title();
64}
65
66QString FeedRSS2Impl::link() const
67{
68 return m_doc->link();
69}
70
71QString FeedRSS2Impl::description() const
72{
73 return m_doc->description();
74}
75
76QList<PersonPtr> FeedRSS2Impl::authors() const
77{
78 return QList<PersonPtr>();
79}
80
81QString FeedRSS2Impl::language() const
82{
83 return m_doc->language();
84}
85
86QString FeedRSS2Impl::copyright() const
87{
88 return m_doc->copyright();
89}
90
91ImagePtr FeedRSS2Impl::image() const
92{
93 ImageRSS2ImplPtr ptr(new ImageRSS2Impl(m_doc->image()));
94 return ptr;
95}
96
97QMultiMap<QString, QDomElement> FeedRSS2Impl::additionalProperties() const
98{
100
101 const auto unhandledElements = m_doc->unhandledElements();
102 for (const QDomElement &i : unhandledElements) {
103 ret.insert(i.namespaceURI() + i.localName(), i);
104 }
105
106 return ret;
107}
108
109ImagePtr FeedRSS2Impl::icon() const
110{
111 ImageRSS2ImplPtr ptr(new ImageRSS2Impl({}));
112 return ptr;
113}
114
115} // namespace Syndication
A category which can be assigned to items or whole feeds.
const_iterator cbegin() const const
const_iterator cend() const const
qsizetype count() const const
void reserve(qsizetype size)
iterator insert(const Key &key, const T &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.