OpendTect  7.0
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
DateInfo Class Reference

A date info class. More...

Public Types

enum  DayOfWeek {
  Su =0 , Mo , Tu , We ,
  Th , Fr , Sa
}
 
enum  Month {
  Jan =0 , Feb , Mar , Apr ,
  May , Jun , Jul , Aug ,
  Sep , Oct , Nov , Dec
}
 

Public Member Functions

 DateInfo ()
 Today. More...
 
 DateInfo (const char *)
 
 DateInfo (int the_key)
 
 DateInfo (int usryr, const char *mnth, int usrdy)
 
 DateInfo (int usryr, int usrmnth, int usrdy)
 
 DateInfo (int usryr, Month, int usrdy)
 
void addMonths (int)
 
int day () const
 
bool fromNumString (const char *, bool yearfirst)
 
bool fromStdDateString (const char *)
 
bool fromString (const char *)
 
const char * fullMonthName () const
 
void getUsrDisp (BufferString &, bool withcurtime) const
 
bool isUdf () const
 
int key () const
 
Month month () const
 
const char * monthName () const
 
bool operator!= (const DateInfo &) const
 
DateInfooperator+= (int)
 
DateInfooperator-= (int dys)
 
bool operator< (const DateInfo &) const
 
bool operator<= (const DateInfo &) const
 
bool operator== (const DateInfo &) const
 
bool operator> (const DateInfo &) const
 
bool operator>= (const DateInfo &) const
 
void setDay (int)
 
void setMonth (int)
 
void setMonth (Month)
 
void setUdf (bool yn=true)
 
void setYear (int)
 
void toString (BufferString &) const
 
int usrMonth () const
 
int weekDay () const
 Sunday => 1. More...
 
const char * weekDayName () const
 
const char * whenRelative (const DateInfo *di=0) const
 
int year () const
 

Static Public Member Functions

static int daysInMonth (int yr, Month)
 
static int daysInYear (int yr)
 
static const char * fullMonthName (int)
 
static const char * fullMonthName (Month)
 
static const char ** sAllDaysInMonth ()
 0 to 31 More...
 
static const char ** sFullMonths ()
 str = sFullMonths()[Month] More...
 
static Month usrMonth2Month (int)
 

Private Member Functions

void addDay (BufferString &) const
 
void calcDays1900 ()
 
void calcDMY ()
 
void getDaysMonths (int, int, int &, int &)
 
void getRel (const DateInfo &, BufferString &) const
 
void getRelToday (BufferString &) const
 

Private Attributes

int days1900_
 
int days_
 
int months_
 
int years_
 

Friends

int operator- (const DateInfo &, const DateInfo &)
 

Detailed Description

A date info class.

Class does not work before 1900. Non-default constructors are for dates other than today. Constructors accept numbers as in normal usage.

Parsing: toString/fromString format is [n]n-xxx-nnnn, like 14-nov-2008. fromStdDateString() reads the 'file' standard,like 'Wed Nov 14 12:50:15 2008'. fromNumString() reads '2008-11-14' or '14-11-2008' or the same with slashes, dots or colons.

The class has some kewl 'relative' printouts.

<>

Member Enumeration Documentation

◆ DayOfWeek

Enumerator
Su 
Mo 
Tu 
We 
Th 
Fr 
Sa 

◆ Month

Enumerator
Jan 
Feb 
Mar 
Apr 
May 
Jun 
Jul 
Aug 
Sep 
Oct 
Nov 
Dec 

Constructor & Destructor Documentation

◆ DateInfo() [1/6]

DateInfo::DateInfo ( )

Today.

◆ DateInfo() [2/6]

DateInfo::DateInfo ( int  usryr,
int  usrmnth,
int  usrdy 
)

◆ DateInfo() [3/6]

DateInfo::DateInfo ( int  usryr,
Month  ,
int  usrdy 
)

◆ DateInfo() [4/6]

DateInfo::DateInfo ( int  usryr,
const char *  mnth,
int  usrdy 
)

◆ DateInfo() [5/6]

DateInfo::DateInfo ( const char *  )

◆ DateInfo() [6/6]

DateInfo::DateInfo ( int  the_key)

Member Function Documentation

◆ addDay()

void DateInfo::addDay ( BufferString ) const
private

◆ addMonths()

void DateInfo::addMonths ( int  )

◆ calcDays1900()

void DateInfo::calcDays1900 ( )
private

◆ calcDMY()

void DateInfo::calcDMY ( )
private

◆ day()

int DateInfo::day ( ) const
inline

◆ daysInMonth()

static int DateInfo::daysInMonth ( int  yr,
Month   
)
static

◆ daysInYear()

static int DateInfo::daysInYear ( int  yr)
inlinestatic

◆ fromNumString()

bool DateInfo::fromNumString ( const char *  ,
bool  yearfirst 
)

◆ fromStdDateString()

bool DateInfo::fromStdDateString ( const char *  )

◆ fromString()

bool DateInfo::fromString ( const char *  )

◆ fullMonthName() [1/3]

const char* DateInfo::fullMonthName ( ) const
inline

◆ fullMonthName() [2/3]

static const char* DateInfo::fullMonthName ( int  )
static

◆ fullMonthName() [3/3]

static const char* DateInfo::fullMonthName ( Month  )
static

◆ getDaysMonths()

void DateInfo::getDaysMonths ( int  ,
int  ,
int &  ,
int &   
)
private

◆ getRel()

void DateInfo::getRel ( const DateInfo ,
BufferString  
) const
private

◆ getRelToday()

void DateInfo::getRelToday ( BufferString ) const
private

◆ getUsrDisp()

void DateInfo::getUsrDisp ( BufferString ,
bool  withcurtime 
) const

◆ isUdf()

bool DateInfo::isUdf ( ) const
inline

◆ key()

int DateInfo::key ( ) const
inline

◆ month()

Month DateInfo::month ( ) const
inline

◆ monthName()

const char* DateInfo::monthName ( ) const
inline

◆ operator!=()

bool DateInfo::operator!= ( const DateInfo di) const
inline

◆ operator+=()

DateInfo& DateInfo::operator+= ( int  )

◆ operator-=()

DateInfo& DateInfo::operator-= ( int  dys)
inline

◆ operator<()

bool DateInfo::operator< ( const DateInfo di) const
inline

◆ operator<=()

bool DateInfo::operator<= ( const DateInfo di) const
inline

◆ operator==()

bool DateInfo::operator== ( const DateInfo di) const
inline

◆ operator>()

bool DateInfo::operator> ( const DateInfo di) const
inline

◆ operator>=()

bool DateInfo::operator>= ( const DateInfo di) const
inline

◆ sAllDaysInMonth()

static const char** DateInfo::sAllDaysInMonth ( )
static

0 to 31

◆ setDay()

void DateInfo::setDay ( int  )

◆ setMonth() [1/2]

void DateInfo::setMonth ( int  )

◆ setMonth() [2/2]

void DateInfo::setMonth ( Month  )

◆ setUdf()

void DateInfo::setUdf ( bool  yn = true)

◆ setYear()

void DateInfo::setYear ( int  )

◆ sFullMonths()

static const char** DateInfo::sFullMonths ( )
static

str = sFullMonths()[Month]

◆ toString()

void DateInfo::toString ( BufferString ) const

◆ usrMonth()

int DateInfo::usrMonth ( ) const
inline

◆ usrMonth2Month()

static Month DateInfo::usrMonth2Month ( int  )
static

◆ weekDay()

int DateInfo::weekDay ( ) const

Sunday => 1.

◆ weekDayName()

const char* DateInfo::weekDayName ( ) const

◆ whenRelative()

const char* DateInfo::whenRelative ( const DateInfo di = 0) const

◆ year()

int DateInfo::year ( ) const
inline

Friends And Related Function Documentation

◆ operator-

int operator- ( const DateInfo di1,
const DateInfo di2 
)
friend

Member Data Documentation

◆ days1900_

int DateInfo::days1900_
private

◆ days_

int DateInfo::days_
private

◆ months_

int DateInfo::months_
private

◆ years_

int DateInfo::years_
private

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024