libkholidays
kholidays.h
Go to the documentation of this file.00001 /* 00002 This file is part of the kholidays library. 00003 00004 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 00005 Copyright (c) 2004 Allen Winter <winter@kde.org> 00006 Copyright (c) 2008 David Jarvie <djarvie@kde.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to the 00020 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 #ifndef KHOLIDAYS_HOLIDAYS_H 00024 #define KHOLIDAYS_HOLIDAYS_H 00025 00026 #include "kholidays_export.h" 00027 00028 #include <QList> 00029 #include <QString> 00030 #include <QStringList> 00031 00032 class QDate; 00033 00034 namespace LibKHolidays { 00035 00036 struct KHoliday { 00037 QString text; 00038 QString shortText; 00039 int Category; 00040 }; 00041 00042 class KHOLIDAYS_EXPORT KHolidays 00043 { 00044 public: 00050 static QStringList locations(); 00051 00057 explicit KHolidays( const QString &location = QString() ); 00058 ~KHolidays(); 00059 00066 QString location() const; 00067 00068 QList<KHoliday> getHolidays( const QDate &date ) const; 00069 00073 bool isHoliday( const QDate &date ) const; 00074 00078 bool isValid() const; 00079 00080 enum { 00081 WORKDAY, 00082 HOLIDAY 00083 }; 00084 00085 private: 00086 // Prohibit copying 00087 KHolidays(const KHolidays& ); 00088 KHolidays &operator=(const KHolidays& ); 00089 00090 bool parseFile( const QDate &date ) const; 00091 00092 QString mLocation; // location string used to determine holidays file 00093 QString mHolidayFile; // full path of file containing holiday data, or null 00094 mutable int mYearLast;// save of the last year we have seen 00095 }; 00096 00097 } 00098 00099 #endif
KDE 4.2 API Reference