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#include "holiday.h"
26#include "holiday_p.h"
27
28#include <KStandardDirs>
29
30#include <QtCore/QDateTime>
31#include <QtCore/QFile>
32#include <QtCore/QSharedData>
33
34using namespace KHolidays;
35
36Holiday::Holiday()
37 : d( new HolidayPrivate )
38{
39}
40
41Holiday::Holiday( const Holiday &other )
42 : d( other.d )
43{
44}
45
46Holiday::~Holiday()
47{
48}
49
50Holiday &Holiday::operator=( const Holiday &other )
51{
52 if ( &other != this ) {
53 d = other.d;
54 }
55
56 return *this;
57}
58
59bool Holiday::operator<( const Holiday &rhs ) const
60{
61 return d->mObservedDate < rhs.d->mObservedDate;
62}
63
64bool Holiday::operator>( const Holiday &rhs ) const
65{
66 return d->mObservedDate > rhs.d->mObservedDate;
67}
68
69QDate Holiday::date() const
70{
71 return d->mObservedDate;
72}
73
74QDate Holiday::observedStartDate() const
75{
76 return d->mObservedDate;
77}
78
79QDate Holiday::observedEndDate() const
80{
81 return d->mObservedDate.addDays( d->mDuration - 1 );
82}
83
84int Holiday::duration() const
85{
86 return d->mDuration;
87}
88
89QString Holiday::text() const
90{
91 return d->mText;
92}
93
94QString Holiday::shortText() const
95{
96 return d->mShortText;
97}
98
99Holiday::DayType Holiday::dayType() const
100{
101 return d->mDayType;
102}
103