KHolidays

holiday.h
1/*
2 This file is part of the kholidays library.
3
4 SPDX-FileCopyrightText: 2001 Cornelius Schumacher <schumacher@kde.org>
5 SPDX-FileCopyrightText: 2004 Allen Winter <winter@kde.org>
6 SPDX-FileCopyrightText: 2008 David Jarvie <djarvie@kde.org>
7 SPDX-FileCopyrightText: 2010 John Layt <john@layt.net>
8
9 SPDX-License-Identifier: LGPL-2.0-or-later
10*/
11
12#ifndef KHOLIDAYS_HOLIDAY_H
13#define KHOLIDAYS_HOLIDAY_H
14
15#include "kholidays_export.h"
16
17#include <QList>
18#include <QSharedDataPointer>
19
20class QDate;
21class QString;
22
23namespace KHolidays
24{
25class HolidayPrivate;
26class HolidayRegion;
27
28/** Represents a holiday event. */
29class KHOLIDAYS_EXPORT Holiday
30{
31 friend class HolidayRegion;
32 friend class HolidayParserDriver;
33 friend class HolidayParserDriverPlan;
34 friend class HolidayParserDriverPlanOld;
35
36public:
37 /**
38 * A list of holiday descriptions.
39 */
41
42 /**
43 * Describes the date type of the holiday.
44 * If any of the holidays on a date are non-workdays types, then the entire day is non-working.
45 */
46 enum DayType {
47 Workday, ///< The holiday is a workday
48 NonWorkday, ///< The holiday is a real holiday
49 };
50
51 /**
52 * Creates an empty holiday.
53 */
54 Holiday();
55
56 /**
57 * Creates a holiday from an @p other holiday.
58 */
59 Holiday(const Holiday &other);
60
61 /**
62 * Destroys the holiday object.
63 */
64 ~Holiday();
65
66 /**
67 *
68 */
69 Holiday &operator=(const Holiday &other);
70
71 /**
72 *
73 */
74 bool operator<(const Holiday &rhs) const;
75
76 /**
77 *
78 */
79 bool operator>(const Holiday &rhs) const;
80
81 /**
82 * @since 4.6
83 *
84 * Returns the observed start date of the holiday.
85 */
86 QDate observedStartDate() const;
87
88 /**
89 * @since 4.6
90 *
91 * Returns the observed end date of the holiday.
92 */
93 QDate observedEndDate() const;
94
95 /**
96 * @since 4.6
97 *
98 * Returns the duration of the holiday in days.
99 */
100 int duration() const;
101
102 /**
103 * @since 5.0
104 *
105 * Returns the name of the Holiday.
106 *
107 * @return the name of the Holiday
108 */
109 QString name() const;
110
111 /**
112 * @since 5.0
113 *
114 * Returns the description of the Holiday if available
115 *
116 * @return the description of the Holiday
117 */
118 QString description() const;
119
120 /**
121 * Returns the day type of the holiday.
122 */
123 DayType dayType() const;
124
125 /**
126 * @since 5.8
127 *
128 * Returns a QStringList of categories for the Holiday.
129 * If the Holiday has no categories then an empty list is returned.
130 */
131 QStringList categoryList() const;
132
133private:
135};
136
137}
138
139Q_DECLARE_TYPEINFO(KHolidays::Holiday, Q_RELOCATABLE_TYPE);
140
141#endif // KHOLIDAYS_HOLIDAY_H
Represents a holiday region.
Represents a holiday event.
Definition holiday.h:30
QList< Holiday > List
A list of holiday descriptions.
Definition holiday.h:40
DayType
Describes the date type of the holiday.
Definition holiday.h:46
@ NonWorkday
The holiday is a real holiday.
Definition holiday.h:48
@ Workday
The holiday is a workday.
Definition holiday.h:47
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.