• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

Public Member Functions | List of all members
KDayPeriod Class Reference

#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
Author
John Layt john@.nosp@m.layt.nosp@m..net

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
periodCodethe unique code for the period
longNamethe KLocale::LongName of the Day Period
shortNamethe KLocale::ShortName of the Day Period
narrowNamethe KLocale::NarrowName of the Day Period
periodStartthe inclusive Start Time of the Day Period
periodEndthe inclusive End Time of the Day Period
offsetFromStartoffset of hour in period from the periodStart
offsetIfZeroif hour is 0, what should it be converted to

Definition at line 82 of file kdayperiod.cpp.

KDayPeriod::KDayPeriod ( )
explicit

Constructs a null KDayPeriod.

Definition at line 101 of file kdayperiod.cpp.

KDayPeriod::KDayPeriod ( const KDayPeriod &  rhs)

Copy Constructor.

Parameters
rhsKDayPeriod to copy

Definition at line 106 of file kdayperiod.cpp.

KDayPeriod::~KDayPeriod ( )
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
timethe 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.

bool KDayPeriod::isValid ( const QTime &  time) const

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
rhsKDayPeriod to assign

Definition at line 115 of file kdayperiod.cpp.

QString KDayPeriod::periodCode ( ) const

Return the Period Code.

Returns
the Period Code

Definition at line 123 of file kdayperiod.cpp.

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
formatthe 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
hourInPeriodthe hour in the day period
minutethe minute in the hour
secondthe second in the minute
millisecondthe 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:
  • kdayperiod_p.h
  • kdayperiod.cpp
This file is part of the KDE documentation.
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.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal