/* This file is part of the syndication library SPDX-FileCopyrightText: 2006 Frank Osterfeld SPDX-License-Identifier: LGPL-2.0-or-later */ #include "feedrss2impl.h" #include "categoryrss2impl.h" #include "imagerss2impl.h" #include "itemrss2impl.h" #include #include #include #include #include #include #include namespace Syndication { FeedRSS2Impl::FeedRSS2Impl(Syndication::RSS2::DocumentPtr doc) : m_doc(doc) { } Syndication::SpecificDocumentPtr FeedRSS2Impl::specificDocument() const { return m_doc; } QList FeedRSS2Impl::items() const { const QList entries = m_doc->items(); QList items; items.reserve(entries.count()); std::transform(entries.cbegin(), entries.cend(), std::back_inserter(items), [](const Syndication::RSS2::Item &entry) { return ItemRSS2ImplPtr(new ItemRSS2Impl(entry)); }); return items; } QList FeedRSS2Impl::categories() const { const QList entries = m_doc->categories(); QList categories; categories.reserve(entries.count()); std::transform(entries.cbegin(), entries.cend(), std::back_inserter(categories), [](const Syndication::RSS2::Category &entry) { return CategoryRSS2ImplPtr(new CategoryRSS2Impl(entry)); }); return categories; } QString FeedRSS2Impl::title() const { return m_doc->title(); } QString FeedRSS2Impl::link() const { return m_doc->link(); } QString FeedRSS2Impl::description() const { return m_doc->description(); } QList FeedRSS2Impl::authors() const { return QList(); } QString FeedRSS2Impl::language() const { return m_doc->language(); } QString FeedRSS2Impl::copyright() const { return m_doc->copyright(); } ImagePtr FeedRSS2Impl::image() const { ImageRSS2ImplPtr ptr(new ImageRSS2Impl(m_doc->image())); return ptr; } QMultiMap FeedRSS2Impl::additionalProperties() const { QMultiMap ret; const auto unhandledElements = m_doc->unhandledElements(); for (const QDomElement &i : unhandledElements) { ret.insert(i.namespaceURI() + i.localName(), i); } return ret; } ImagePtr FeedRSS2Impl::icon() const { ImageRSS2ImplPtr ptr(new ImageRSS2Impl({})); return ptr; } } // namespace Syndication