kexi

KexiTimeFormatter Class Reference

#include <kexidatetimeformatter.h>

Public Member Functions

 KexiTimeFormatter ()
 
 ~KexiTimeFormatter ()
 
TQTime stringToTime (const TQString &str) const
 
TQVariant stringToVariant (const TQString &str)
 
TQString timeToString (const TQTime &time) const
 
TQString inputMask () const
 
bool isEmpty (const TQString &str) const
 

Protected Attributes

TQString m_inputMask
 
bool m_24h
 
bool m_hoursWithLeadingZero
 
TQString m_outputFormat
 
int m_hourpos
 
int m_minpos
 
int m_secpos
 
int m_ampmpos
 
TQRegExp * m_hmsRegExp
 
TQRegExp * m_hmRegExp
 

Detailed Description

Time formatter used by KexiTimeTableEdit and KexiDateTimeTableEdit Following time formats are allowed: HH:MM:SS (24h), HH:MM (24h), HH:MM AM/PM (12h) Separator MUST be ":".

Definition at line 88 of file kexidatetimeformatter.h.

Constructor & Destructor Documentation

◆ KexiTimeFormatter()

KexiTimeFormatter::KexiTimeFormatter ( )

Creates new formatter with KDE setting for time.

Definition at line 170 of file kexidatetimeformatter.cpp.

◆ ~KexiTimeFormatter()

KexiTimeFormatter::~KexiTimeFormatter ( )

Creates new formatter with given settings.

Todo:
KexiDateFormatter(... settings ...);

Definition at line 236 of file kexidatetimeformatter.cpp.

Member Function Documentation

◆ inputMask()

TQString KexiTimeFormatter::inputMask ( ) const
inline
Returns
Input mask generated using the formatter settings. Can be used in TQLineEdit::setInputMask().

Definition at line 116 of file kexidatetimeformatter.h.

◆ isEmpty()

bool KexiTimeFormatter::isEmpty ( const TQString &  str) const
Returns
true if str contains only spaces and separators according to the time format.

Definition at line 283 of file kexidatetimeformatter.cpp.

◆ stringToTime()

TQTime KexiTimeFormatter::stringToTime ( const TQString &  str) const

converts string str to time using predefined settings

Returns
invalid time if the conversion is impossible

Definition at line 242 of file kexidatetimeformatter.cpp.

◆ stringToVariant()

TQVariant KexiTimeFormatter::stringToVariant ( const TQString &  str)

Converts string str to time using predefined settings and returns TQVariant containing the time value. This method does the same as stringToTime() but if string contains invalid time representation, e.g. contains only spaces and separators, null TQVariant() is returned.

Definition at line 273 of file kexidatetimeformatter.cpp.

◆ timeToString()

TQString KexiTimeFormatter::timeToString ( const TQTime &  time) const

converts time to string using predefined settings

Returns
null string if time is invalid

Definition at line 289 of file kexidatetimeformatter.cpp.

Member Data Documentation

◆ m_24h

bool KexiTimeFormatter::m_24h
protected

12 or 12h

Definition at line 130 of file kexidatetimeformatter.h.

◆ m_ampmpos

int KexiTimeFormatter::m_ampmpos
protected

Definition at line 138 of file kexidatetimeformatter.h.

◆ m_hmRegExp

TQRegExp * KexiTimeFormatter::m_hmRegExp
protected

Definition at line 140 of file kexidatetimeformatter.h.

◆ m_hmsRegExp

TQRegExp* KexiTimeFormatter::m_hmsRegExp
protected

Definition at line 140 of file kexidatetimeformatter.h.

◆ m_hourpos

int KexiTimeFormatter::m_hourpos
protected

Used in stringToTime() to convert string back to TQTime.

Definition at line 138 of file kexidatetimeformatter.h.

◆ m_hoursWithLeadingZero

bool KexiTimeFormatter::m_hoursWithLeadingZero
protected

Definition at line 132 of file kexidatetimeformatter.h.

◆ m_inputMask

TQString KexiTimeFormatter::m_inputMask
protected

Input mask generated using the formatter settings. Can be used in TQLineEdit::setInputMask().

Definition at line 124 of file kexidatetimeformatter.h.

◆ m_minpos

int KexiTimeFormatter::m_minpos
protected

Definition at line 138 of file kexidatetimeformatter.h.

◆ m_outputFormat

TQString KexiTimeFormatter::m_outputFormat
protected

Time format used in timeToString(). Notation from TDELocale::setTimeFormat() is used.

Definition at line 135 of file kexidatetimeformatter.h.

◆ m_secpos

int KexiTimeFormatter::m_secpos
protected

Definition at line 138 of file kexidatetimeformatter.h.


The documentation for this class was generated from the following files: