Syndication

enclosure.cpp
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2006 Frank Osterfeld <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "enclosure.h"
9 
10 namespace Syndication
11 {
13 {
14 }
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 QString url() const =0
The URL of the linked resource (required).
bool isNull() const const
virtual QString type() const =0
mimetype of the enclosure.
QString number(int n, int base)
virtual QString debugInfo() const
description of this enclosure for debugging purposes
Definition: enclosure.cpp:16
virtual uint duration() const =0
for audio/video files, the duration of the file in seconds
virtual QString title() const =0
title of the enclosure.
virtual uint length() const =0
returns the length of the linked file in bytes
virtual ~Enclosure()
destructor
Definition: enclosure.cpp:12
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 03:58:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.