KDECore
kdayperiod_p.h
Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2010 John Layt <john@layt.net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KDAYPERIOD_H 00021 #define KDAYPERIOD_H 00022 00023 #include <QtCore/QSharedDataPointer> 00024 00025 #include "klocale.h" 00026 #include <kdecore_export.h> 00027 00028 class QDate; 00029 class QString; 00030 class QTime; 00031 00032 class KDayPeriodPrivate; 00033 00054 class KDayPeriod 00055 { 00056 public: 00069 KDayPeriod(const QString &periodCode, 00070 const QString &longName, 00071 const QString &shortName, 00072 const QString &narrowName, 00073 const QTime &periodStart, 00074 const QTime &periodEnd, 00075 int offsetFromStart, 00076 int offsetIfZero); 00077 00081 explicit KDayPeriod(); 00082 00089 KDayPeriod(const KDayPeriod &rhs); 00090 00094 virtual ~KDayPeriod(); 00095 00102 KDayPeriod& operator=(const KDayPeriod &rhs); 00103 00109 QString periodCode() const; 00110 00116 QTime periodStart() const; 00117 00123 QTime periodEnd() const; 00124 00132 QString periodName(KLocale::DateTimeComponentFormat format = KLocale::ShortName) const; 00133 00142 int hourInPeriod(const QTime &time) const; 00143 00155 QTime time(int hourInPeriod, int minute, int second, int millisecond = 0) const; 00156 00162 bool isValid() const; 00163 00169 bool isValid(const QTime &time) const; 00170 00171 private: 00172 QSharedDataPointer<KDayPeriodPrivate> d; 00173 }; 00174 00175 #endif // KDAYPERIOD_H
KDE 4.6 API Reference