earth_time::day_in_year Class Reference

An object that represents a particular day in a year. More...

#include <earth_time.h>

Inheritance diagram for earth_time::day_in_year:

Inheritance graph
[legend]
Collaboration diagram for earth_time::day_in_year:

Collaboration graph
[legend]
List of all members.

Public Types

enum  date_formats { SHORT_MONTH = 0x1, LONG_MONTH = 0x2, INCLUDE_DAY = 0x4 }
 An enumeration of ways to print out the current date. More...

Public Member Functions

 day_in_year (months m=JANUARY, int dim=1, days dow=SUNDAY, int day_o_year=1)
 Constructs a representation of the day specified.
virtual void pack (byte_array &packed_form) const
 Packs a day object into an array of bytes.
virtual bool unpack (byte_array &packed_form)
 Unpacks a day object from an array of bytes.
bool operator< (const day_in_year &to_compare) const
 Returns true if this day is earlier than "to_compare".
bool operator== (const day_in_year &to_compare) const
 Returns true if this day is equal to "to_compare".
istring text_form (int how=SHORT_MONTH) const
 Prints the day according to "how".
void text_form (istring &to_stuff, int how=SHORT_MONTH) const
 Prints the day according to "how" and stores it in "to_stuff".

Static Public Member Functions

static int normalize (day_in_year &to_fix, bool leap_year=false)
 normalizes the day as needed and returns the adjustment in years.

Public Attributes

months month
 The current month.
int day_in_month
 The day number within the month (starting at one).
days day_of_week
 The day of the week.
int day_of_year
 Numerical day, where January 1st is equal to zero.

Detailed Description

An object that represents a particular day in a year.

Definition at line 127 of file earth_time.h.


Member Enumeration Documentation

enum earth_time::day_in_year::date_formats

An enumeration of ways to print out the current date.

Enumerator:
SHORT_MONTH  default: three letter month.
LONG_MONTH  uses full month name.
INCLUDE_DAY  adds the name of the day.

Definition at line 153 of file earth_time.h.


Constructor & Destructor Documentation

earth_time::day_in_year::day_in_year ( months  m = JANUARY,
int  dim = 1,
days  dow = SUNDAY,
int  day_o_year = 1 
) [inline]

Constructs a representation of the day specified.

Definition at line 136 of file earth_time.h.


Member Function Documentation

void earth_time::day_in_year::pack ( byte_array packed_form  )  const [virtual]

Packs a day object into an array of bytes.

Implements packable.

Reimplemented in earth_time::time_locus.

Definition at line 145 of file earth_time.cpp.

References basis::attach(), day_in_month, day_of_week, day_of_year, and month.

bool earth_time::day_in_year::unpack ( byte_array packed_form  )  [virtual]

Unpacks a day object from an array of bytes.

Implements packable.

Reimplemented in earth_time::time_locus.

Definition at line 155 of file earth_time.cpp.

References day_in_month, day_of_week, day_of_year, basis::detach(), and month.

Referenced by earth_time::time_locus::unpack().

bool earth_time::day_in_year::operator< ( const day_in_year to_compare  )  const

Returns true if this day is earlier than "to_compare".

Note that this only compares the month and day in the month.

Definition at line 168 of file earth_time.cpp.

References day_in_month, EASY_LT, and month.

bool earth_time::day_in_year::operator== ( const day_in_year to_compare  )  const

Returns true if this day is equal to "to_compare".

Note that this only compares the month and day in the month.

Definition at line 175 of file earth_time.cpp.

References day_in_month, and month.

istring earth_time::day_in_year::text_form ( int  how = SHORT_MONTH  )  const

Prints the day according to "how".

Definition at line 181 of file earth_time.cpp.

Referenced by run_test_27().

void earth_time::day_in_year::text_form ( istring to_stuff,
int  how = SHORT_MONTH 
) const

Prints the day according to "how" and stores it in "to_stuff".

Definition at line 188 of file earth_time.cpp.

References day_in_month, earth_time::day_name(), day_of_week, INCLUDE_DAY, LONG_MONTH, month, earth_time::month_name(), and earth_time::short_month_name().

int earth_time::day_in_year::normalize ( day_in_year to_fix,
bool  leap_year = false 
) [static]

normalizes the day as needed and returns the adjustment in years.

note that this only adjusts the day_in_month and month members currently. the other counters are not changed.

Definition at line 213 of file earth_time.cpp.

References day_in_month, earth_time::days_in_month, earth_time::leap_days_in_month, earth_time::limit_day_of_month(), limit_value, and month.

Referenced by earth_time::time_locus::normalize().


Member Data Documentation

months earth_time::day_in_year::month

The current month.

Definition at line 130 of file earth_time.h.

Referenced by earth_time::convert(), earth_time::month_now(), normalize(), operator<(), operator==(), pack(), earth_time::set_time(), text_form(), and unpack().

int earth_time::day_in_year::day_in_month

The day number within the month (starting at one).

Definition at line 131 of file earth_time.h.

Referenced by earth_time::convert(), earth_time::time_locus::normalize(), normalize(), operator<(), operator==(), pack(), text_form(), and unpack().

days earth_time::day_in_year::day_of_week

The day of the week.

Definition at line 132 of file earth_time.h.

Referenced by earth_time::convert(), earth_time::day_now(), pack(), earth_time::set_time(), text_form(), and unpack().

int earth_time::day_in_year::day_of_year

Numerical day, where January 1st is equal to zero.

Definition at line 133 of file earth_time.h.

Referenced by earth_time::convert(), pack(), earth_time::set_time(), and unpack().


The documentation for this class was generated from the following files:
Generated on Sat Oct 11 04:30:51 2008 for HOOPLE Libraries by  doxygen 1.5.1