Syndication

dublincore.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 "dublincore.h"
9#include "dublincorevocab.h"
10#include "property.h"
11#include "statement.h"
12
13#include <tools.h>
14
15#include <QList>
16#include <QString>
17
18namespace Syndication
19{
20namespace RDF
21{
23 : ResourceWrapper(resource)
24{
25}
26
30
32{
33 return resource()->property(DublinCoreVocab::self()->contributor())->asString();
34}
35
37{
38 QStringList res;
39 QList<StatementPtr> list = resource()->properties(DublinCoreVocab::self()->contributor());
42 for (; it != end; ++it) {
43 const QString str = (*it)->asString();
44 if (!str.isNull()) {
45 res.append(str);
46 }
47 }
48 return res;
49}
50
52{
53 return resource()->property(DublinCoreVocab::self()->coverage())->asString();
54}
55
57{
58 return resource()->property(DublinCoreVocab::self()->creator())->asString();
59}
60
62{
63 QStringList res;
64 QList<StatementPtr> list = resource()->properties(DublinCoreVocab::self()->creator());
67 for (; it != end; ++it) {
68 const QString str = (*it)->asString();
69 if (!str.isNull()) {
70 res.append(str);
71 }
72 }
73 return res;
74}
75
76time_t DublinCore::date() const
77{
78 QString str = resource()->property(DublinCoreVocab::self()->date())->asString();
79 return parseDate(str, ISODate);
80}
81
83{
84 return resource()->property(DublinCoreVocab::self()->description())->asString();
85}
86
88{
89 return resource()->property(DublinCoreVocab::self()->format())->asString();
90}
91
93{
94 return resource()->property(DublinCoreVocab::self()->identifier())->asString();
95}
96
98{
99 return resource()->property(DublinCoreVocab::self()->language())->asString();
100}
101
103{
104 return resource()->property(DublinCoreVocab::self()->publisher())->asString();
105}
106
108{
109 return resource()->property(DublinCoreVocab::self()->relation())->asString();
110}
111
113{
114 return resource()->property(DublinCoreVocab::self()->rights())->asString();
115}
116
118{
119 return resource()->property(DublinCoreVocab::self()->source())->asString();
120}
121
123{
124 return resource()->property(DublinCoreVocab::self()->subject())->asString();
125}
126
128{
129 QStringList res;
130 QList<StatementPtr> list = resource()->properties(DublinCoreVocab::self()->subject());
133 for (; it != end; ++it) {
134 QString str = (*it)->asString();
135 if (!str.isNull()) {
136 res.append(str);
137 }
138 }
139 return res;
140}
141
143{
144 return resource()->property(DublinCoreVocab::self()->title())->asString();
145}
146
148{
149 return resource()->property(DublinCoreVocab::self()->type())->asString();
150}
151
153{
154 QString info;
155 if (!contributor().isNull()) {
156 info += QStringLiteral("dc:contributor: #%1#\n").arg(contributor());
157 }
158 if (!coverage().isNull()) {
159 info += QStringLiteral("dc:coverage: #%1#\n").arg(coverage());
160 }
161 if (!creator().isNull()) {
162 info += QStringLiteral("dc:creator: #%1#\n").arg(creator());
163 }
164
165 const QString ddate = dateTimeToString(date());
166 if (!ddate.isNull()) {
167 info += QStringLiteral("dc:date: #%1#\n").arg(ddate);
168 }
169
170 if (!description().isNull()) {
171 info += QStringLiteral("dc:description: #%1#\n").arg(description());
172 }
173 if (!format().isNull()) {
174 info += QStringLiteral("dc:format: #%1#\n").arg(format());
175 }
176 if (!identifier().isNull()) {
177 info += QStringLiteral("dc:identifier: #%1#\n").arg(identifier());
178 }
179 if (!language().isNull()) {
180 info += QStringLiteral("dc:language: #%1#\n").arg(language());
181 }
182 if (!publisher().isNull()) {
183 info += QStringLiteral("dc:publisher: #%1#\n").arg(publisher());
184 }
185 if (!relation().isNull()) {
186 info += QStringLiteral("dc:relation: #%1#\n").arg(relation());
187 }
188 if (!rights().isNull()) {
189 info += QStringLiteral("dc:rights: #%1#\n").arg(rights());
190 }
191 if (!source().isNull()) {
192 info += QStringLiteral("dc:source: #%1#\n").arg(source());
193 }
194 if (!subject().isNull()) {
195 info += QStringLiteral("dc:subject: #%1#\n").arg(subject());
196 }
197 if (!title().isNull()) {
198 info += QStringLiteral("dc:title: #%1#\n").arg(title());
199 }
200 if (!type().isNull()) {
201 info += QStringLiteral("dc:type: #%1#\n").arg(type());
202 }
203 return info;
204}
205
206} // namespace RDF
207} // namespace Syndication
QString language() const
"A language of the intellectual content of the resource.
QString rights() const
"Information about rights held in and over the resource.
QString format() const
"The physical or digital manifestation of the resource.
QString relation() const
"A reference to a related resource.
QString subject() const
"The topic of the content of the resource.
QStringList contributors() const
like contributor(), but returns all dc:contributor properties, not only one.
QString publisher() const
"An entity responsible for making the resource available.
QString contributor() const
"An entity responsible for making contributions to the content of the resource.
QString debugInfo() const
returns a debug string describing the available DC metadata for debugging purposes
QString coverage() const
"The extent or scope of the content of the resource.
time_t date() const
"A date associated with an event in the life cycle of the resource.
QString description() const
"An account of the content of the resource.
QStringList creators() const
like creator(), but returns all dc:creator properties, not only one.
~DublinCore() override
virtual destructor
QString creator() const
"An entity primarily responsible for making the content of the resource.
QString source() const
A Reference to a resource from which the present resource is derived.
QString identifier() const
"An unambiguous reference to the resource within a given context.
QString type() const
"The nature or genre of the content of the resource.
QString title() const
A name given to the resource.
DublinCore(ResourcePtr resource)
creates a dublin core convenience wrapper for a resource
QStringList subjects() const
like subject(), but returns all dc:subject properties, not only one.
void append(QList< T > &&value)
const_iterator constBegin() const const
const_iterator constEnd() const const
QString arg(Args &&... args) const const
bool isNull() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:15 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.