/* This file is part of the syndication library SPDX-FileCopyrightText: 2006 Frank Osterfeld SPDX-License-Identifier: LGPL-2.0-or-later */ #include "feedrdfimpl.h" #include "imagerdfimpl.h" #include "itemrdfimpl.h" #include #include #include #include #include #include #include #include #include #include namespace Syndication { FeedRDFImpl::FeedRDFImpl(Syndication::RDF::DocumentPtr doc) : m_doc(doc) { } Syndication::SpecificDocumentPtr FeedRDFImpl::specificDocument() const { return m_doc; } QList FeedRDFImpl::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::RDF::Item &entry) { return ItemRDFImplPtr(new ItemRDFImpl(entry)); }); return items; } QList FeedRDFImpl::categories() const { // TODO: check if it makes sense to map dc:subject to categories return QList(); } QString FeedRDFImpl::title() const { return m_doc->title(); } QString FeedRDFImpl::link() const { return m_doc->link(); } QString FeedRDFImpl::description() const { return m_doc->description(); } QList FeedRDFImpl::authors() const { const QStringList people = m_doc->dc().creators() + m_doc->dc().contributors(); QList list; list.reserve(people.size()); for (const auto &person : people) { PersonPtr ptr = personFromString(person); if (!ptr->isNull()) { list.append(ptr); } } return list; } QString FeedRDFImpl::language() const { return m_doc->dc().language(); } QString FeedRDFImpl::copyright() const { return m_doc->dc().rights(); } ImagePtr FeedRDFImpl::image() const { ImageRDFImplPtr ptr(new ImageRDFImpl(m_doc->image())); return ptr; } ImagePtr FeedRDFImpl::icon() const { ImageRDFImplPtr ptr(new ImageRDFImpl({})); return ptr; } QMultiMap FeedRDFImpl::additionalProperties() const { return QMultiMap(); } } // namespace Syndication