Syndication

syndicationinfo.h
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#ifndef SYNDICATION_RDF_SYNDICATIONINFO_H
9#define SYNDICATION_RDF_SYNDICATIONINFO_H
10
11#include <syndication/rdf/resourcewrapper.h>
12
13#include <ctime>
14
15class QString;
16
17namespace Syndication
18{
19namespace RDF
20{
21/**
22 * Wrapper to access syndication information for a feed.
23 * The RSS 1.0 syndication module provides syndication hints to
24 * aggregators regarding how often it is updated.
25 *
26 * The specification can be found at
27 * http://web.resource.org/rss/1.0/modules/syndication/
28 *
29 * @author Frank Osterfeld
30 */
32{
33public:
34 /**
35 * update period enum as used by updatePeriod().
36 */
37 enum Period {
38 Hourly, /**< the feed is updated hourly */
39 Daily, /**< the feed is updated daily */
40 Weekly, /**< the feed is updated weekly */
41 Monthly, /**< the feed is updated monthly */
42 Yearly, /**< the feed is updated yearly */
43 };
44
45 /**
46 * creates a wrapper wrapping a null resource.
47 * isNull() will be true.
48 */
50
51 /**
52 * creates a wrapper from a resource
53 * @param resource the feed resource to read syndication
54 * information from
55 */
57
58 /**
59 * virtual destructor
60 */
61 ~SyndicationInfo() override;
62
63 /**
64 * Describes the period over which the channel format is updated.
65 * Acceptable values are: hourly, daily, weekly, monthly, yearly.
66 * If omitted, daily is assumed.
67 *
68 * @return update period, daily is default
69 */
70 Period updatePeriod() const;
71
72 /** Used to describe the frequency of updates in relation to the
73 * update period. A positive integer indicates how many times in
74 * that period the channel is updated. For example, an
75 * updatePeriod of daily, and an updateFrequency of 2 indicates
76 * the channel format is updated twice daily. If omitted a value
77 * of 1 is assumed.
78 *
79 * @return update frequency, default is 1
80 */
81 int updateFrequency() const;
82
83 /**
84 * Defines a base date to be used in concert with updatePeriod
85 * and updateFrequency to calculate the publishing schedule.
86 *
87 * @return the base date in seconds since epoch. Default value is
88 * 0 (epoch).
89 */
90 time_t updateBase() const;
91
92 /**
93 * description of the syndication information
94 * for debugging purposes
95 *
96 * @return debug string
97 */
98 QString debugInfo() const;
99
100protected:
101 /**
102 * returns Period value as string.
103 * @param period period enum to convert to a string
104 * @return the enum name in lower case, "daily", "hourly", etc.
105 */
106 static QString periodToString(Period period);
107
108 /**
109 * parses a Period value from a string.
110 *
111 * @param str a period string as defined in the syndication module
112 * @return the parsed period, Daily (the default) if the parsed
113 * string is empty or invalid
114 */
115 static Period stringToPeriod(const QString &str);
116};
117
118} // namespace RDF
119} // namespace Syndication
120
121#endif // SYNDICATION_RDF_SYNDICATIONINFO_H
A wrapper for RDF resources.
ResourcePtr resource() const
returns the wrapped resource.
Wrapper to access syndication information for a feed.
SyndicationInfo()
creates a wrapper wrapping a null resource.
int updateFrequency() const
Used to describe the frequency of updates in relation to the update period.
static Period stringToPeriod(const QString &str)
parses a Period value from a string.
Period
update period enum as used by updatePeriod().
@ Yearly
the feed is updated yearly
@ Daily
the feed is updated daily
@ Hourly
the feed is updated hourly
@ Weekly
the feed is updated weekly
@ Monthly
the feed is updated monthly
static QString periodToString(Period period)
returns Period value as string.
time_t updateBase() const
Defines a base date to be used in concert with updatePeriod and updateFrequency to calculate the publ...
Period updatePeriod() const
Describes the period over which the channel format is updated.
QString debugInfo() const
description of the syndication information for debugging purposes
~SyndicationInfo() override
virtual destructor
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.