KDECore
#include <kdayperiod_p.h>
Public Member Functions | |
KDayPeriod (const QString &periodCode, const QString &longName, const QString &shortName, const QString &narrowName, const QTime &periodStart, const QTime &periodEnd, int offsetFromStart, int offsetIfZero) | |
KDayPeriod () | |
KDayPeriod (const KDayPeriod &rhs) | |
virtual | ~KDayPeriod () |
int | hourInPeriod (const QTime &time) const |
bool | isValid () const |
bool | isValid (const QTime &time) const |
KDayPeriod & | operator= (const KDayPeriod &rhs) |
QString | periodCode () const |
QTime | periodEnd () const |
QString | periodName (KLocale::DateTimeComponentFormat format=KLocale::ShortName) const |
QTime | periodStart () const |
QTime | time (int hourInPeriod, int minute, int second, int millisecond=0) const |
Detailed Description
- Since
- 4.6
This class is internal for now but may later be exported if required.
This is a class to implement the CLDR Day Period Rules.
Most commonly this will be used to implement support for the 12 hour clock e.g. 00:00:00 to 11:59:59.999 is AM and 12:00:00 to 23:59:59.999 is PM. However CLDR Day Period Rules cater for cultures where the day may be divided into more periods than just AM/PM. See http://www.unicode.org/reports/tr35/tr35-15.html#DayPeriodRules
license GNU-LGPL v.2 or later
- See also
- KLocale
Definition at line 54 of file kdayperiod_p.h.
Constructor & Destructor Documentation
KDayPeriod::KDayPeriod | ( | const QString & | periodCode, |
const QString & | longName, | ||
const QString & | shortName, | ||
const QString & | narrowName, | ||
const QTime & | periodStart, | ||
const QTime & | periodEnd, | ||
int | offsetFromStart, | ||
int | offsetIfZero | ||
) |
Constructs a KDayPeriod for a given time period.
- Parameters
-
periodCode the unique code for the period longName the KLocale::LongName of the Day Period shortName the KLocale::ShortName of the Day Period narrowName the KLocale::NarrowName of the Day Period periodStart the inclusive Start Time of the Day Period periodEnd the inclusive End Time of the Day Period offsetFromStart offset of hour in period from the periodStart offsetIfZero if hour is 0, what should it be converted to
Definition at line 82 of file kdayperiod.cpp.
|
explicit |
Constructs a null KDayPeriod.
Definition at line 101 of file kdayperiod.cpp.
KDayPeriod::KDayPeriod | ( | const KDayPeriod & | rhs | ) |
|
virtual |
Destructor.
Definition at line 111 of file kdayperiod.cpp.
Member Function Documentation
int KDayPeriod::hourInPeriod | ( | const QTime & | time | ) | const |
Calculate and return the hour in the Day Period for a given 24h time.
For example, 17:00 would return 5 in the PM period of the standard 12 hour clock
- Parameters
-
time the time to return the hour for
- Returns
- the Hour in the Day Period
Definition at line 149 of file kdayperiod.cpp.
bool KDayPeriod::isValid | ( | ) | const |
Return if the Day Period is valid.
- Returns
- if the Day Period is valid
Definition at line 186 of file kdayperiod.cpp.
Return if a given time is in the Day Period.
- Returns
- if the time is valid in the Day Period
Definition at line 193 of file kdayperiod.cpp.
KDayPeriod & KDayPeriod::operator= | ( | const KDayPeriod & | rhs | ) |
Assignment operator.
- Parameters
-
rhs KDayPeriod to assign
Definition at line 115 of file kdayperiod.cpp.
QString KDayPeriod::periodCode | ( | ) | const |
QTime KDayPeriod::periodEnd | ( | ) | const |
Return the time the Period ends at.
- Returns
- the time the Period ends
Definition at line 133 of file kdayperiod.cpp.
QString KDayPeriod::periodName | ( | KLocale::DateTimeComponentFormat | format = KLocale::ShortName | ) | const |
Return translated Period Name in the required format e.g.
Ante Meridian, AM or A
- Parameters
-
format the name format to return
- Returns
- the Period Name
Definition at line 138 of file kdayperiod.cpp.
QTime KDayPeriod::periodStart | ( | ) | const |
Return the time the Period starts at.
- Returns
- the time the Period starts
Definition at line 128 of file kdayperiod.cpp.
QTime KDayPeriod::time | ( | int | hourInPeriod, |
int | minute, | ||
int | second, | ||
int | millisecond = 0 |
||
) | const |
Calculate and return the 24hr time for a given hms in the Day Period.
For example, 5 in the PM period of the standard 12 hour clock would return 17:00
- Parameters
-
hourInPeriod the hour in the day period minute the minute in the hour second the second in the minute millisecond the millisecond in the second
- Returns
- the Time in the 24hr clock
Definition at line 161 of file kdayperiod.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.