OpendTect-6_4  6.4
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Attributes | 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 (int usryr, int usrmnth, int usrdy)
 
 DateInfo (int usryr, Month, int usrdy)
 
 DateInfo (int usryr, const char *mnth, int usrdy)
 
 DateInfo (const char *)
 
bool isUdf () const
 
void setUdf (bool yn=true)
 
int day () const
 
Month month () const
 
int year () const
 
int usrMonth () const
 
void setDay (int)
 
void setMonth (int)
 
void setMonth (Month)
 
void setYear (int)
 
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
 
bool operator>= (const DateInfo &) const
 
DateInfooperator+= (int)
 
DateInfooperator-= (int dys)
 
void addMonths (int)
 
int weekDay () const
 Sunday => 1. More...
 
const char * weekDayName () const
 
const char * monthName () const
 
const char * whenRelative (const DateInfo *di=0) const
 
const char * fullMonthName () const
 
void toString (BufferString &) const
 
bool fromString (const char *)
 
bool fromStdDateString (const char *)
 
bool fromNumString (const char *, bool yearfirst)
 
void getUsrDisp (BufferString &, bool withcurtime) const
 
int key () const
 
 DateInfo (int the_key)
 

Static Public Member Functions

static const EnumDefImpl< DayOfWeek > & DayOfWeekDef ()
 
static const char ** DayOfWeekNames ()
 
static bool parseEnumDayOfWeek (const char *, DayOfWeek &)
 
static bool parseEnum (const char *, DayOfWeek &)
 
static bool parseEnum (const IOPar &, const char *, DayOfWeek &)
 
static DayOfWeek parseEnumDayOfWeek (const char *)
 
static const char * toString (DayOfWeek)
 
static uiString toUiString (DayOfWeek)
 
static const char * getDayOfWeekString (DayOfWeek)
 
static const EnumDefImpl< Month > & MonthDef ()
 
static const char ** MonthNames ()
 
static bool parseEnumMonth (const char *, Month &)
 
static bool parseEnum (const char *, Month &)
 
static bool parseEnum (const IOPar &, const char *, Month &)
 
static Month parseEnumMonth (const char *)
 
static const char * toString (Month)
 
static uiString toUiString (Month)
 
static const char * getMonthString (Month)
 
static const char ** sFullMonths ()
 < Uses "jan", "feb" etc. More...
 
static const char ** sAllDaysInMonth ()
 0 to 31 More...
 
static const char * fullMonthName (int)
 
static const char * fullMonthName (Month)
 
static int daysInMonth (int yr, Month)
 
static int daysInYear (int yr)
 
static Month usrMonth2Month (int)
 

Static Protected Attributes

static const char * DayOfWeekKeys_ []
 
static ConstPtrMan< EnumDefImpl< DayOfWeek > > DayOfWeekDefinition_
 
static const char * MonthKeys_ []
 
static ConstPtrMan< EnumDefImpl< Month > > MonthDefinition_
 

Private Member Functions

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

Private Attributes

int days1900_
 
int years_
 
int months_
 
int days_
 

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

Enumerator
Su 
Mo 
Tu 
We 
Th 
Fr 
Sa 
Enumerator
Jan 
Feb 
Mar 
Apr 
May 
Jun 
Jul 
Aug 
Sep 
Oct 
Nov 
Dec 

Constructor & Destructor Documentation

DateInfo::DateInfo ( )

Today.

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

Member Function Documentation

void DateInfo::addDay ( BufferString ) const
private
void DateInfo::addMonths ( int  )
void DateInfo::calcDays1900 ( )
private
void DateInfo::calcDMY ( )
private
int DateInfo::day ( ) const
inline
static const EnumDefImpl< DayOfWeek >& DateInfo::DayOfWeekDef ( )
static
static const char** DateInfo::DayOfWeekNames ( )
static
static int DateInfo::daysInMonth ( int  yr,
Month   
)
static
static int DateInfo::daysInYear ( int  yr)
inlinestatic
bool DateInfo::fromNumString ( const char *  ,
bool  yearfirst 
)
bool DateInfo::fromStdDateString ( const char *  )
bool DateInfo::fromString ( const char *  )
static const char* DateInfo::fullMonthName ( int  )
static
static const char* DateInfo::fullMonthName ( Month  )
static
const char* DateInfo::fullMonthName ( ) const
inline
static const char* DateInfo::getDayOfWeekString ( DayOfWeek  )
static
void DateInfo::getDaysMonths ( int  ,
int  ,
int &  ,
int &   
)
private
static const char* DateInfo::getMonthString ( Month  )
static
void DateInfo::getRel ( const DateInfo ,
BufferString  
) const
private
void DateInfo::getRelToday ( BufferString ) const
private
void DateInfo::getUsrDisp ( BufferString ,
bool  withcurtime 
) const
bool DateInfo::isUdf ( ) const
inline
int DateInfo::key ( ) const
inline
Month DateInfo::month ( ) const
inline
static const EnumDefImpl< Month >& DateInfo::MonthDef ( )
static
const char* DateInfo::monthName ( ) const
inline
static const char** DateInfo::MonthNames ( )
static
bool DateInfo::operator!= ( const DateInfo di) const
inline
DateInfo& DateInfo::operator+= ( int  )
DateInfo& DateInfo::operator-= ( int  dys)
inline
bool DateInfo::operator< ( const DateInfo di) const
inline
bool DateInfo::operator<= ( const DateInfo di) const
inline
bool DateInfo::operator== ( const DateInfo di) const
inline
bool DateInfo::operator> ( const DateInfo di) const
inline
bool DateInfo::operator>= ( const DateInfo di) const
inline
static bool DateInfo::parseEnum ( const char *  ,
DayOfWeek  
)
static
static bool DateInfo::parseEnum ( const IOPar ,
const char *  ,
DayOfWeek  
)
static
static bool DateInfo::parseEnum ( const char *  ,
Month  
)
static
static bool DateInfo::parseEnum ( const IOPar ,
const char *  ,
Month  
)
static
static bool DateInfo::parseEnumDayOfWeek ( const char *  ,
DayOfWeek  
)
static
static DayOfWeek DateInfo::parseEnumDayOfWeek ( const char *  )
static
static bool DateInfo::parseEnumMonth ( const char *  ,
Month  
)
static
static Month DateInfo::parseEnumMonth ( const char *  )
static
static const char** DateInfo::sAllDaysInMonth ( )
static

0 to 31

void DateInfo::setDay ( int  )
void DateInfo::setMonth ( int  )
void DateInfo::setMonth ( Month  )
void DateInfo::setUdf ( bool  yn = true)
void DateInfo::setYear ( int  )
static const char** DateInfo::sFullMonths ( )
static

< Uses "jan", "feb" etc.

str = sFullMonths()[Month]

static const char* DateInfo::toString ( DayOfWeek  )
static
static const char* DateInfo::toString ( Month  )
static
void DateInfo::toString ( BufferString ) const
static uiString DateInfo::toUiString ( DayOfWeek  )
static
static uiString DateInfo::toUiString ( Month  )
static
int DateInfo::usrMonth ( ) const
inline
static Month DateInfo::usrMonth2Month ( int  )
static
int DateInfo::weekDay ( ) const

Sunday => 1.

const char* DateInfo::weekDayName ( ) const
const char* DateInfo::whenRelative ( const DateInfo di = 0) const
int DateInfo::year ( ) const
inline

Friends And Related Function Documentation

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

Member Data Documentation

ConstPtrMan<EnumDefImpl< DayOfWeek > > DateInfo::DayOfWeekDefinition_
staticprotected
const char* DateInfo::DayOfWeekKeys_[]
staticprotected
int DateInfo::days1900_
private
int DateInfo::days_
private
ConstPtrMan<EnumDefImpl< Month > > DateInfo::MonthDefinition_
staticprotected
const char* DateInfo::MonthKeys_[]
staticprotected
int DateInfo::months_
private
int DateInfo::years_
private

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