Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DateFormat Class Reference

The format a Date and Time is composed. More...

#include </home/clem/local/src/opie/library/timestring.h>

Collaboration diagram for DateFormat:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Order { DayMonthYear = 0x0111, MonthDayYear = 0x010A, YearMonthDay = 0x0054 }
enum  Verbosity {
  shortNumber = 0x01, longNumber = 0x02, padNumber = 0x04, shortWord = 0x08,
  longWord = 0x10, showWeekDay = 0x20
}

Public Member Functions

 DateFormat (QChar s= '/', Order so=MonthDayYear)
 DateFormat (QChar s, Order so, Order lo)
 DateFormat (const DateFormat &o)
bool operator== (const DateFormat &o)
QString toNumberString () const
QString toWordString () const
QString numberDate (const QDate &d, int v=0) const
QString wordDate (const QDate &d, int v=0) const
void load (QDataStream &)
void save (QDataStream &) const
QChar separator () const
Order shortOrder () const
Order longOrder () const

Private Attributes

Order _shortOrder
Order _longOrder
QChar _shortSeparator

Detailed Description

The format a Date and Time is composed.

Define how a Date and Time should be composed

See also:
TimeString

Definition at line 34 of file timestring.h.


Member Enumeration Documentation

enum DateFormat::Order
 

The order of the Day,Month and Year

Enumeration values:
DayMonthYear 
MonthDayYear 
YearMonthDay 

Definition at line 38 of file timestring.h.

enum DateFormat::Verbosity
 

Enumeration values:
shortNumber 
longNumber 
padNumber 
shortWord 
longWord 
showWeekDay 

Definition at line 60 of file timestring.h.


Constructor & Destructor Documentation

DateFormat::DateFormat QChar  s = '/',
Order  or = MonthDayYear
[inline]
 

A Constructor.

Parameters:
s The seperator for the short representation. As used by toNumberString
or The order used for short and long dates

Definition at line 44 of file timestring.h.

DateFormat::DateFormat QChar  s,
Order  so,
Order  lo
[inline]
 

A different Constructor with different long and short representation

Parameters:
s The seperator
so The short order representation
lo The long order representation

Definition at line 46 of file timestring.h.

DateFormat::DateFormat const DateFormat o  )  [inline]
 

Copy c'tor

Definition at line 48 of file timestring.h.


Member Function Documentation

void DateFormat::load QDataStream d  ) 
 

load from the QDateStream. And set the values internally

Definition at line 222 of file timestring.cpp.

References _longOrder, _shortOrder, _shortSeparator, and v.

Referenced by operator>>().

DateFormat::Order DateFormat::longOrder  )  const [inline]
 

Return the DateFormat::Order for the longOrder which will be used by the wordString

Definition at line 85 of file timestring.h.

References _longOrder.

Referenced by FormatTabWidget::saveSettings().

QString DateFormat::numberDate const QDate d,
int  v = 0
const
 

Compose the QDate to a QString using the shortOrder() and the verbosity. The verbosity is only used to see if the year should be four positions or two positions wide.

Parameters:
d The QDate to be expressed as string
v Only DateFormat::Verbosity::shortNumber or DateFormat::Verbosity::longNumber is used. Use this to say if the year should be two or four positions wide
See also:
DateFormat::wordDate()

Definition at line 116 of file timestring.cpp.

References _shortOrder, _shortSeparator, buf, QDate::day(), i, longNumber, QDate::month(), and QDate::year().

Referenced by TimeString::longNumberDateString(), and TimeString::numberDateString().

bool DateFormat::operator== const DateFormat o  )  [inline]
 

Definition at line 51 of file timestring.h.

References _longOrder, _shortOrder, _shortSeparator, FALSE, and TRUE.

void DateFormat::save QDataStream  )  const
 

Definition at line 213 of file timestring.cpp.

References _longOrder, _shortOrder, _shortSeparator, QChar::unicode(), and v.

Referenced by operator<<().

QChar DateFormat::separator  )  const [inline]
 

Definition at line 83 of file timestring.h.

References _shortSeparator.

Referenced by FormatTabWidget::saveSettings(), and wordDate().

DateFormat::Order DateFormat::shortOrder  )  const [inline]
 

Return the DateFormat::Order for the shortOrder which will be used by numberString

Definition at line 84 of file timestring.h.

References _shortOrder.

Referenced by FormatTabWidget::saveSettings().

QString DateFormat::toNumberString  )  const
 

Return the Order of Days as string (M/D/Y) in example this string can be shown to the user. It will extract three bits at a time and compose a string

Definition at line 62 of file timestring.cpp.

References _shortOrder, _shortSeparator, buf, i, and tr.

QString DateFormat::toWordString  )  const
 

Return the DateFormat as written words

Definition at line 85 of file timestring.cpp.

References _longOrder, _shortOrder, buf, i, and tr.

QString DateFormat::wordDate const QDate d,
int  v = 0
const
 

Compose the QDate to a QString using the longOrder() options. The difference to numberDate() is the length of the resulting string. Weekday- and Monthnames are expressed as words as opposed to digits.

Parameters:
d The Date to be used
v The verbosity

Definition at line 152 of file timestring.cpp.

References _longOrder, buf, QDate::day(), QDate::dayName(), QDate::dayOfWeek(), i, QString::left(), longNumber, longWord, QDate::month(), QDate::monthName(), QString::number(), separator(), showWeekDay, and QDate::year().

Referenced by TimeString::dateString(), TimeString::longDateString(), and TimeString::shortDate().


Member Data Documentation

Order DateFormat::_longOrder [private]
 

Definition at line 89 of file timestring.h.

Referenced by load(), longOrder(), operator==(), save(), toWordString(), and wordDate().

Order DateFormat::_shortOrder [private]
 

Definition at line 85 of file timestring.h.

Referenced by load(), numberDate(), operator==(), save(), shortOrder(), toNumberString(), and toWordString().

QChar DateFormat::_shortSeparator [private]
 

Definition at line 90 of file timestring.h.

Referenced by load(), numberDate(), operator==(), save(), separator(), and toNumberString().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:30:41 2005 for OPIE by  doxygen 1.4.2