Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

look::LookDateTime Class Reference

DateTime. More...

#include <lkdatetime.h>

Inheritance diagram for look::LookDateTime::

look::LookTypeBase List of all members.

Public Methods

 LookDateTime ()
 Default constructor. More...

 LookDateTime (const LookDate &theDate, const LookTime &theTime=0)
 Constructor. More...

 LookDateTime (const LookDateTime &theOther)
 Copy constructor.

 ~LookDateTime ()
 Destructor.

LookTypeBaseGetNewCopy (void) const
 Get a new copy. More...

long GetTypeID (void) const
 Get Type ID. More...

LookDateTime& operator= (const LookDateTime &theOther)
 Assignment op.

bool operator== (const LookDateTime &theOther) const
 Equal.

bool operator!= (const LookDateTime &theOther) const
 Not equal.

bool operator< (const LookDateTime &theOther) const
 Less than.

bool operator> (const LookDateTime &theOther) const
 Greater than.

bool operator<= (const LookDateTime &theOther) const
 Less than or equal.

bool operator>= (const LookDateTime &theOther) const
 Greater than or equal.

LookDateTime& operator+= (long theChange)
 Add seconds.

LookDateTime operator+ (long theChange) const
 Add seconds.

long operator- (LookDateTime &theOther) const
 Difference in seconds. More...

LookDateTime& operator-= (long theChange)
 Subtract seconds.

LookDateTime operator- (long theChange) const
 Subtract seconds.

void SetTime (const LookTime &theTime)
 Set time.

void SetDate (const LookDate &theDate)
 Set date.

LookTime GetTime (void) const
 Get time.

LookDate GetDate (void) const
 Get date.

bool Set (const LookString &theDateTimeString)
 Set from a string. More...

LookString GetString (const LookString &theDateSeparator="/", const LookString &theOrder="dmy", bool monthIsNumber=true, int yearDigits=4, const LookString &theTimeSeparator=":", int theTimePrecision=3, bool hours24=true) const
 Convert to a string. More...


Static Public Methods

LookDateTime Now (void)
 Get current date/time (localtime).


Protected Methods

void Normalise (void)
 Normalise date/time. More...


Protected Attributes

LookDate itsDate
 Date.

LookTime itsTime
 Time.


Detailed Description

DateTime.

This class represents a Date and a time.

It is an combination of LookDate and LookTime.


Constructor & Destructor Documentation

look::LookDateTime::LookDateTime ( )
 

Default constructor.

Date is initialised to unset, time to midnight.

look::LookDateTime::LookDateTime ( const LookDate & theDate,
const LookTime & theTime = 0 )
 

Constructor.

Parameters:
theDate   Date
theTime   Time


Member Function Documentation

LookTypeBase * look::LookDateTime::GetNewCopy ( void ) const [virtual]
 

Get a new copy.

Virtual copy constructor, aka clone.

Returns:
A new copy of this. (You are responsible for deleting it).

Reimplemented from look::LookTypeBase.

LookString look::LookDateTime::GetString ( const LookString & theDateSeparator = "/",
const LookString & theOrder = "dmy",
bool monthIsNumber = true,
int yearDigits = 4,
const LookString & theTimeSeparator = ":",
int theTimePrecision = 3,
bool hours24 = true ) const
 

Convert to a string.

This returns LookDate::GetString() + " " + LookTime::GetString().

Parameters:
theDateSeparator   See LookDate::GetString()
theOrder   See LookDate::GetString()
monthIsNumber   See LookDate::GetString()
yearDigits   See LookDate::GetString()
theTimeSeparator   See LookTime::GetString()
theTimePrecision   See LookTime::GetString()
hours24   See LookTime::GetString()

long look::LookDateTime::GetTypeID ( void ) const [virtual]
 

Get Type ID.

Pseudo-rtti, or isA.

Returns:
LookDateTimeID

Reimplemented from look::LookTypeBase.

void look::LookDateTime::Normalise ( void ) [protected]
 

Normalise date/time.

This is called after adding or subtracting seconds.

bool look::LookDateTime::Set ( const LookString & theDateTimeString )
 

Set from a string.

This can cope with a variety of formats. See LookDateTimeReader for a more general converter.

The string is split by the first space character - that portion before the space is used for LookDate::Set() and that portion after (if present) is used for LookTime::Set().

If the date portion fails, the time isn't converted. If either of these fails it returns false.

Parameters:
theDateTimeString   The string.
Returns:
true for success

long look::LookDateTime::operator- ( LookDateTime & theOther ) const
 

Difference in seconds.

Divide by 86400 to get the difference in days.


The documentation for this class was generated from the following files:
Generated at Thu Jan 17 12:53:08 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001