File indexing completed on 2024-12-08 09:38:10

0001 /*
0002     This file is part of the kholidays library.
0003 
0004     SPDX-FileCopyrightText: 2001 Cornelius Schumacher <schumacher@kde.org>
0005     SPDX-FileCopyrightText: 2004 Allen Winter <winter@kde.org>
0006     SPDX-FileCopyrightText: 2008 David Jarvie <djarvie@kde.org>
0007     SPDX-FileCopyrightText: 2010 John Layt <john@layt.net>
0008 
0009     SPDX-License-Identifier: LGPL-2.0-or-later
0010 */
0011 
0012 #include "holiday.h"
0013 #include "holiday_p.h"
0014 
0015 #include <QSharedData>
0016 
0017 using namespace KHolidays;
0018 
0019 Holiday::Holiday()
0020     : d(new HolidayPrivate)
0021 {
0022 }
0023 
0024 Holiday::Holiday(const Holiday &other)
0025     : d(other.d)
0026 {
0027 }
0028 
0029 Holiday::~Holiday()
0030 {
0031 }
0032 
0033 Holiday &Holiday::operator=(const Holiday &other)
0034 {
0035     if (&other != this) {
0036         d = other.d;
0037     }
0038 
0039     return *this;
0040 }
0041 
0042 bool Holiday::operator<(const Holiday &rhs) const
0043 {
0044     return d->mObservedDate < rhs.d->mObservedDate;
0045 }
0046 
0047 bool Holiday::operator>(const Holiday &rhs) const
0048 {
0049     return d->mObservedDate > rhs.d->mObservedDate;
0050 }
0051 
0052 QDate Holiday::observedStartDate() const
0053 {
0054     return d->mObservedDate;
0055 }
0056 
0057 QDate Holiday::observedEndDate() const
0058 {
0059     return d->mObservedDate.addDays(d->mDuration - 1);
0060 }
0061 
0062 int Holiday::duration() const
0063 {
0064     return d->mDuration;
0065 }
0066 
0067 QString Holiday::name() const
0068 {
0069     return d->mName;
0070 }
0071 
0072 QString Holiday::description() const
0073 {
0074     return d->mDescription;
0075 }
0076 
0077 Holiday::DayType Holiday::dayType() const
0078 {
0079     return d->mDayType;
0080 }
0081 
0082 QStringList Holiday::categoryList() const
0083 {
0084     return d->mCategoryList;
0085 }