Syndication

enclosure.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 "enclosure.h"
9
10namespace Syndication
11{
15
17{
18 QString info = QLatin1String("# Enclosure begin #################\n");
19
20 const QString durl = url();
21
22 if (!durl.isNull()) {
23 info += QLatin1String("url: #") + durl + QLatin1String("#\n");
24 }
25
26 const QString dtitle = title();
27
28 if (!dtitle.isNull()) {
29 info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
30 }
31
32 const QString dtype = type();
33
34 if (!dtype.isNull()) {
35 info += QLatin1String("type: #") + dtype + QLatin1String("#\n");
36 }
37
38 const int dlength = length();
39
40 if (dlength != 0) {
41 info += QLatin1String("length: #") + QString::number(dlength) + QLatin1String("#\n");
42 }
43
44 uint dduration = duration();
45
46 if (dduration != 0) {
47 int hours = dduration / 3600;
48 int minutes = (dduration - hours * 3600) / 60;
49 int seconds = dduration - hours * 3600 - minutes * 60;
50 info += QStringLiteral("duration: #%1 (%2:%3:%4)#\n").arg(dduration).arg(hours).arg(minutes).arg(seconds);
51 }
52
53 info += QLatin1String("# Enclosure end ###################\n");
54
55 return info;
56}
57
58} // namespace Syndication
virtual ~Enclosure()
destructor
Definition enclosure.cpp:12
virtual QString debugInfo() const
description of this enclosure for debugging purposes
Definition enclosure.cpp:16
virtual QString type() const =0
mimetype of the enclosure.
virtual uint length() const =0
returns the length of the linked file in bytes
virtual QString url() const =0
The URL of the linked resource (required).
virtual QString title() const =0
title of the enclosure.
virtual uint duration() const =0
for audio/video files, the duration of the file in seconds
QString arg(Args &&... args) const const
bool isNull() const const
QString number(double n, char format, int precision)
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.