1 | /* |
2 | * This file is part of the syndication library |
3 | * |
4 | * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org> |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | * |
21 | */ |
22 | |
23 | #ifndef SYNDICATION_ENCLOSURE_H |
24 | #define SYNDICATION_ENCLOSURE_H |
25 | |
26 | #include "ksyndication_export.h" |
27 | |
28 | #include <boost/shared_ptr.hpp> |
29 | |
30 | #include <QtCore/QString> |
31 | |
32 | namespace Syndication { |
33 | |
34 | class Enclosure; |
35 | //@cond PRIVATE |
36 | typedef boost::shared_ptr<Enclosure> EnclosurePtr; |
37 | //@endcond |
38 | |
39 | /** |
40 | * An enclosure describes a (media) file available on the net. |
41 | * |
42 | * Most of the time, enclosures are used for "podcasts", i.e. audio |
43 | * files announced and distributed via syndication. |
44 | * |
45 | * @author Frank Osterfeld |
46 | */ |
47 | class SYNDICATION_EXPORT Enclosure |
48 | { |
49 | public: |
50 | |
51 | /** |
52 | * destructor |
53 | */ |
54 | virtual ~Enclosure(); |
55 | |
56 | /** |
57 | * returns whether this enclosure is a null object. |
58 | */ |
59 | virtual bool isNull() const = 0; |
60 | |
61 | /** |
62 | * The URL of the linked resource (required). |
63 | */ |
64 | virtual QString url() const = 0; |
65 | |
66 | /** |
67 | * title of the enclosure. This is a human-readable description of the |
68 | * linked file. If available, the title should be used in user interfaces |
69 | * instead of the URL. If no title is set (e.g., RSS2 enclosures don't |
70 | * have titles), use url() as fallback. |
71 | * |
72 | * @return title describing the enclosure, or a null string if not |
73 | * specified. |
74 | */ |
75 | virtual QString title() const = 0; |
76 | |
77 | /** |
78 | * mimetype of the enclosure. |
79 | * TODO: link mimetype specs |
80 | * |
81 | * Examples are @c "audio/mpeg" for MP3, or @c "application/pdf" for |
82 | * PDF. |
83 | * |
84 | * @return the mimetype of the file, or a null string if not |
85 | * specified |
86 | */ |
87 | virtual QString type() const = 0; |
88 | |
89 | /** |
90 | * returns the length of the linked file in bytes |
91 | * |
92 | * @return the length of the file in bytes, 0 if not specified |
93 | */ |
94 | virtual uint length() const = 0; |
95 | |
96 | |
97 | /** |
98 | * for audio/video files, the duration of the file in seconds |
99 | * |
100 | * @return the duration of the file in seconds, or 0 if not specified |
101 | */ |
102 | virtual uint duration() const = 0; |
103 | |
104 | /** |
105 | * description of this enclosure for debugging purposes |
106 | * |
107 | * @return debug string |
108 | */ |
109 | virtual QString debugInfo() const; |
110 | }; |
111 | |
112 | } // namespace Syndication |
113 | |
114 | #endif // SYNDICATION_ENCLOSURE_H |
115 | |