1/*
2 This file is part of the kholidays library.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (c) 2004 Allen Winter <winter@kde.org>
6 Copyright (c) 2008 David Jarvie <djarvie@kde.org>
7 Copyright 2010 John Layt <john@layt.net>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to the
21 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23*/
24
25#ifndef KHOLIDAYS_HOLIDAY_H
26#define KHOLIDAYS_HOLIDAY_H
27
28#include "kholidays_export.h"
29
30#include <QtCore/QList>
31#include <QtCore/QSharedDataPointer>
32
33class QDate;
34class QString;
35
36namespace KHolidays {
37
38class HolidayPrivate;
39class HolidayRegion;
40
41class KHOLIDAYS_EXPORT Holiday
42{
43 friend class HolidayRegion;
44 friend class HolidayParserDriverPlan;
45 friend class HolidayParserDriverPlanOld;
46
47 public:
48 /**
49 * A list of holiday descriptions.
50 */
51 typedef QList<Holiday> List;
52
53 /**
54 * Describes the date type of the holiday.
55 */
56 enum DayType {
57 Workday, ///< The holiday is a workday
58 NonWorkday ///< The holiday is a real holiday
59 };
60
61 /**
62 * Describes how to return Multiday holidays
63 */
64 enum MultidayMode {
65 MultidayHolidaysAsMultipleEvents, ///< Return Holiday instance for each day with duration = 1
66 MultidayHolidaysAsSingleEvents ///< Return a single Holiday instance with duration set
67 };
68
69 /**
70 * Creates an empty holiday.
71 */
72 Holiday();
73
74 /**
75 * Creates a holiday from an @p other holiday.
76 */
77 Holiday( const Holiday &other );
78
79 /**
80 * Destroys the holiday object.
81 */
82 ~Holiday();
83
84 /**
85 *
86 */
87 Holiday &operator=( const Holiday &other );
88
89 /**
90 *
91 */
92 bool operator<( const Holiday &rhs ) const;
93
94 /**
95 *
96 */
97 bool operator>( const Holiday &rhs ) const;
98
99 /**
100 * Returns the observed date of the holiday.
101 */
102 QDate date() const;
103
104 /**
105 * @since 4.6
106 *
107 * Returns the observed start date of the holiday.
108 */
109 QDate observedStartDate() const;
110
111 /**
112 * @since 4.6
113 *
114 * Returns the observed end date of the holiday.
115 */
116 QDate observedEndDate() const;
117
118 /**
119 * @since 4.6
120 *
121 * Returns the duration of the holiday in days.
122 */
123 int duration() const;
124
125 /**
126 * Returns the long description of the holiday.
127 */
128 QString text() const;
129
130 /**
131 * Returns the short description of the holiday.
132 */
133 QString shortText() const;
134
135 /**
136 * Returns the day type of the holiday.
137 */
138 DayType dayType() const;
139
140 private:
141 QSharedDataPointer<HolidayPrivate> d;
142};
143
144}
145
146#endif // KHOLIDAYS_HOLIDAY_H
147