KDbTime

Search for usage in LXR

#include <KDbDateTime.h>

Public Types

enum class  Period { None , Am , Pm }
 

Public Member Functions

 KDbTime ()=default
 
 KDbTime (const QByteArray &hourString, const QByteArray &minuteString, const QByteArray &secondString=QByteArray(), const QByteArray &msecString=QByteArray(), Period period=Period::None)
 
int hour () const
 
QByteArray hourString () const
 
bool isNull () const
 
bool isValid () const
 
int minute () const
 
QByteArray minuteString () const
 
int msec () const
 
QByteArray msecString () const
 
bool operator!= (const KDbTime &other) const
 
bool operator< (const KDbTime &other) const
 
bool operator<= (const KDbTime &other) const
 
bool operator== (const KDbTime &other) const
 
bool operator> (const KDbTime &other) const
 
bool operator>= (const KDbTime &other) const
 
Period period () const
 
int second () const
 
QByteArray secondString () const
 
QTime toQTime () const
 
QByteArray toString () const
 

Detailed Description

Generic time constant.

Since
3.2.0

Definition at line 260 of file KDbDateTime.h.

Member Enumeration Documentation

◆ Period

enum class KDbTime::Period
strong

Specifies hour period.

Enumerator
None 

2-hour time

Am 

AM, before noon.

Pm 

PM, after noon, before midnight.

Definition at line 266 of file KDbDateTime.h.

Constructor & Destructor Documentation

◆ KDbTime() [1/2]

KDbTime::KDbTime ( const QByteArray & hourString,
const QByteArray & minuteString,
const QByteArray & secondString = QByteArray(),
const QByteArray & msecString = QByteArray(),
Period period = Period::None )
inline

Definition at line 272 of file KDbDateTime.h.

◆ KDbTime() [2/2]

KDbTime::KDbTime ( )
default

Constructs a null time.

Member Function Documentation

◆ hour()

int KDbTime::hour ( ) const

Returns the hour part of the time converted to integer.

Correct values are in range 0..23 for None period, and 1..12 for Am and Pm periods. -1 is returned for invalid hour.

Definition at line 326 of file KDbDateTime.cpp.

◆ hourString()

QByteArray KDbTime::hourString ( ) const
inline

Returns the hour part of the date.

It is original string passed to the KDbTime object and may be invalid.

Definition at line 341 of file KDbDateTime.h.

◆ isNull()

bool KDbTime::isNull ( ) const

Returns true if the time is null.

A time is null if its hour string or minute string is empty.

Definition at line 358 of file KDbDateTime.cpp.

◆ isValid()

bool KDbTime::isValid ( ) const

Returns true if the time is valid.

Validation is performed by converting to QTime (toQTime()) and checking if it is valid.

Definition at line 353 of file KDbDateTime.cpp.

◆ minute()

int KDbTime::minute ( ) const

Returns the minute part of the time converted to integer.

Correct values are in range 0..59. -1 is returned for invalid minute.

Definition at line 338 of file KDbDateTime.cpp.

◆ minuteString()

QByteArray KDbTime::minuteString ( ) const
inline

Returns the minute part of the date.

It is original string passed to the KDbTime object and may be invalid.

Definition at line 355 of file KDbDateTime.h.

◆ msec()

int KDbTime::msec ( ) const

Definition at line 348 of file KDbDateTime.cpp.

◆ msecString()

QByteArray KDbTime::msecString ( ) const
inline

Returns the milliseconds part of the date.

It is original string passed to the KDbTime object and may be invalid.

Definition at line 378 of file KDbDateTime.h.

◆ operator!=()

bool KDbTime::operator!= ( const KDbTime & other) const
inline

Definition at line 290 of file KDbDateTime.h.

◆ operator<()

bool KDbTime::operator< ( const KDbTime & other) const

Definition at line 289 of file KDbDateTime.cpp.

◆ operator<=()

bool KDbTime::operator<= ( const KDbTime & other) const
inline

Definition at line 294 of file KDbDateTime.h.

◆ operator==()

bool KDbTime::operator== ( const KDbTime & other) const

Definition at line 282 of file KDbDateTime.cpp.

◆ operator>()

bool KDbTime::operator> ( const KDbTime & other) const
inline

Definition at line 298 of file KDbDateTime.h.

◆ operator>=()

bool KDbTime::operator>= ( const KDbTime & other) const
inline

Definition at line 296 of file KDbDateTime.h.

◆ period()

Period KDbTime::period ( ) const
inline

Specifies hour period.

Definition at line 383 of file KDbDateTime.h.

◆ second()

int KDbTime::second ( ) const

Returns the second part of the time converted to integer.

Correct values are in range 0..59. -1 is returned for invalid second.

Definition at line 343 of file KDbDateTime.cpp.

◆ secondString()

QByteArray KDbTime::secondString ( ) const
inline

Returns the second part of the date.

It is original string passed to the KDbTime object and may be invalid.

Definition at line 369 of file KDbDateTime.h.

◆ toQTime()

QTime KDbTime::toQTime ( ) const

Returns the time value converted to QTime type.

Invalid QTime is returned if the KDbTime is invalid.

Definition at line 294 of file KDbDateTime.cpp.

◆ toString()

QByteArray KDbTime::toString ( ) const

Returns the time value converted to string even if it is invalid.

For null times empty string is returned.

Definition at line 363 of file KDbDateTime.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.