Vault  4.1
Public Types | Public Member Functions | Static Public Member Functions | Friends
VDate Class Reference

VDate represents a calendar date: a year/month/day. More...

#include <vinstant.h>

List of all members.

Public Types

enum  {
  kYMD, kYDM, kMYD, kMDY,
  kDYM, kDMY
}
enum  {
  kSunday = 0, kMonday, kTuesday, kWednesday,
  kThursday, kFriday, kSaturday
}

Public Member Functions

 VDate ()
 Constructs a date with values set to 0000-01-01 (useless but legal state for a VDate object).
 VDate (const VString &timeZoneID)
 Constructs a date from the current instant.
 VDate (int year, int month, int day)
 Constructs a date from specified values.
virtual ~VDate ()
 Destructor.
int getYear () const
 Returns the year of the date.
int getMonth () const
 Returns the month of the date.
int getDay () const
 Returns the day of the month of the date.
int getDayOfWeek () const
 Returns the day of the week of the date.
void set (int year, int month, int day)
 Sets the date from specified values.
void setYear (int year)
 Sets the year of the date.
void setMonth (int month)
 Sets the month of the date.
void setDay (int day)
 Sets the day of the month.

Static Public Member Functions

static VDate createFromDateString (const VString &dateString, const VCodePoint &delimiter)
static const VCodePointgetLocalDateSeparator ()
 Returns the date separator for the locale.
static int getLocalDateOrder ()
 Returns the date string element order for the locale.

Friends

bool operator== (const VDate &lhs, const VDate &rhs)
 Compares two dates.
bool operator!= (const VDate &lhs, const VDate &rhs)
 Compares two dates.
bool operator< (const VDate &lhs, const VDate &rhs)
 Compares two dates.
bool operator<= (const VDate &lhs, const VDate &rhs)
 Compares two dates.
bool operator>= (const VDate &lhs, const VDate &rhs)
 Compares two dates.
bool operator> (const VDate &lhs, const VDate &rhs)
 Compares two dates.

Detailed Description

VDate represents a calendar date: a year/month/day.

Per (*) below, the "day" field is actually allowed to be in the range 1 to 32, for purposes of allowing the caller to increment the day and then convert to a VInstant.

Definition at line 956 of file vinstant.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kYMD 

Year/Month/Day.

kYDM 

Year/Day/Month.

kMYD 

Month/Year/Day.

kMDY 

Year/Day/Month.

kDYM 

Day/Year/Month.

kDMY 

Day/Month/Year.

Definition at line 1040 of file vinstant.h.


Constructor & Destructor Documentation

VDate::VDate ( )

Constructs a date with values set to 0000-01-01 (useless but legal state for a VDate object).

Your first use of such a date object should be to assign it a useful value.

Definition at line 1071 of file vinstant.cpp.

References ASSERT_INVARIANT.

VDate::VDate ( const VString timeZoneID)

Constructs a date from the current instant.

Throws an exception if you specify RTZ conversion and there is no converter installed.

Parameters:
timeZoneIDspecifies which time zone the y/m/d should be given in

Definition at line 1079 of file vinstant.cpp.

References ASSERT_INVARIANT, VInstant::getDate(), getDay(), getMonth(), and getYear().

VDate::VDate ( int  year,
int  month,
int  day 
)

Constructs a date from specified values.

Parameters:
yearthe year
monththe month (1 to 12)
daythe day of the month (1 to 31*)

Definition at line 1093 of file vinstant.cpp.

References ASSERT_INVARIANT.


Member Function Documentation

int VDate::getYear ( ) const

Returns the year of the date.

Returns:
the year

Definition at line 1105 of file vinstant.cpp.

References ASSERT_INVARIANT.

int VDate::getMonth ( ) const

Returns the month of the date.

Returns:
the month (1 to 12)

Definition at line 1111 of file vinstant.cpp.

References ASSERT_INVARIANT.

int VDate::getDay ( ) const

Returns the day of the month of the date.

Returns:
the day of the month (1 to 31*)

Definition at line 1117 of file vinstant.cpp.

References ASSERT_INVARIANT.

int VDate::getDayOfWeek ( ) const

Returns the day of the week of the date.

Returns:
the day of the week (0=kSunday to 6=kSaturday, as in time.h and defined in the enum below)

Definition at line 1123 of file vinstant.cpp.

References ASSERT_INVARIANT, VInstantStruct::getOffsetFromUTCStruct(), VInstantStruct::mDay, VInstantStruct::mDayOfWeek, VInstantStruct::mHour, VInstantStruct::mMillisecond, VInstantStruct::mMinute, VInstantStruct::mMonth, VInstantStruct::mSecond, VInstantStruct::mYear, and VInstantStruct::setUTCStructFromOffset().

void VDate::set ( int  year,
int  month,
int  day 
)

Sets the date from specified values.

Parameters:
yearthe year
monththe month of the year (1 to 12)
daythe day of the month (1 to 31*)

Definition at line 1145 of file vinstant.cpp.

References ASSERT_INVARIANT.

void VDate::setYear ( int  year)

Sets the year of the date.

Parameters:
yearthe year

Definition at line 1159 of file vinstant.cpp.

References ASSERT_INVARIANT.

void VDate::setMonth ( int  month)

Sets the month of the date.

Parameters:
monththe month of the year (1 to 12)

Definition at line 1167 of file vinstant.cpp.

References ASSERT_INVARIANT.

void VDate::setDay ( int  day)

Sets the day of the month.

Parameters:
daythe day of the month (1 to 31*)

Definition at line 1175 of file vinstant.cpp.

References ASSERT_INVARIANT.

static const VCodePoint& VDate::getLocalDateSeparator ( ) [inline, static]

Returns the date separator for the locale.

(Currently just returns a slash.)

Returns:
the date separator character constant

Definition at line 1038 of file vinstant.h.

static int VDate::getLocalDateOrder ( ) [inline, static]

Returns the date string element order for the locale.

(Currently just returns a kMDY.)

Returns:
the date string format order

Definition at line 1054 of file vinstant.h.

References kMDY.


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

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.