timely::day_in_year Class Reference

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

#include <earth_time.h>

Inheritance diagram for timely::day_in_year:
Inheritance graph
[legend]
Collaboration diagram for timely::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

int packed_size () const
 Estimates the space needed for the packed structure.
 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 (basis::byte_array &packed_form) const
 Packs a day object into an array of bytes.
virtual bool unpack (basis::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".
basis::astring text_form (int how=SHORT_MONTH) const
 Prints the day according to "how".
void text_form (basis::astring &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 130 of file earth_time.h.


Member Enumeration Documentation

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 158 of file earth_time.h.


Constructor & Destructor Documentation

timely::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 141 of file earth_time.h.


Member Function Documentation

int timely::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 211 of file earth_time.cpp.

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

bool timely::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 166 of file earth_time.cpp.

References day_in_month, EASY_LT, and month.

bool timely::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 173 of file earth_time.cpp.

References day_in_month, and month.

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

Packs a day object into an array of bytes.

Implements basis::packable.

Reimplemented in timely::time_locus.

Definition at line 143 of file earth_time.cpp.

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

int timely::day_in_year::packed_size (  )  const [inline, virtual]

Estimates the space needed for the packed structure.

Implements basis::packable.

Reimplemented in timely::time_locus.

Definition at line 138 of file earth_time.h.

References structures::PACKED_SIZE_INT32.

void timely::day_in_year::text_form ( basis::astring to_stuff,
int  how = SHORT_MONTH 
) const

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

Definition at line 186 of file earth_time.cpp.

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

astring timely::day_in_year::text_form ( int  how = SHORT_MONTH  )  const

Prints the day according to "how".

Definition at line 179 of file earth_time.cpp.

bool timely::day_in_year::unpack ( basis::byte_array packed_form  )  [virtual]

Unpacks a day object from an array of bytes.

Implements basis::packable.

Reimplemented in timely::time_locus.

Definition at line 153 of file earth_time.cpp.

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

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


Member Data Documentation

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

Definition at line 134 of file earth_time.h.

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

The day of the week.

Definition at line 135 of file earth_time.h.

Referenced by timely::convert(), pack(), timely::time_control::set_time(), text_form(), and unpack().

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

Definition at line 136 of file earth_time.h.

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

The current month.

Definition at line 133 of file earth_time.h.

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


The documentation for this class was generated from the following files:
Generated on Sat Jan 28 04:26:04 2012 for hoople2 project by  doxygen 1.6.3