UCommon
Public Member Functions | Protected Member Functions
ucommon::DateNumber Class Reference

A number class that manipulates a string buffer that is also a date. More...

#include <datetime.h>

Inheritance diagram for ucommon::DateNumber:
Inheritance graph
[legend]
Collaboration diagram for ucommon::DateNumber:
Collaboration graph
[legend]

Public Member Functions

 DateNumber (char *pointer)
 Create a date number tied to a refreshed string buffer.
void set (void)
 Set date number to current date.
virtual ~DateNumber ()
 Release a datenumber object.
- Public Member Functions inherited from ucommon::Number
const char * c_str () const
 Get string buffer representing the number.
long get () const
 Get value of string buffer as a long integer.
 Number (char *buffer, unsigned size)
 Create an instance of a number.
 operator char * ()
 Cast object as a string to retrieve buffer.
 operator long ()
 Cast string as long integer and get value of buffer.
long operator() ()
 Get value of string buffer as expression of object.
long operator++ ()
 Increment the number object.
long operator+= (const long value)
 Add a value to the number.
long operator-- ()
 Decrement the number object.
long operator-= (const long value)
 Subtract a value from the number.
long operator= (long value)
 Assign a value to the number.
long operator= (const Number &number)
 Assign another number to this number.
void set (long value)
 Set string based on a new value.
- Public Member Functions inherited from ucommon::Date
 Date (time_t value)
 Create a julian date from a time_t type.
 Date (struct tm *object)
 Create a julian date from a local or gmt date and time.
 Date (const char *pointer, size_t size=0)
 Create a julian date from a ISO date string of a specified size.
 Date (int year, unsigned month=1, unsigned day=1)
 Create a julian date from an arbitrary year, month, and day.
 Date (const Date &object)
 Create a julian date object from another object.
 Date ()
 Construct a new julian date with today's date.
char * get (char *buffer) const
 Get a ISO string representation of the date (yyyy-mm-dd).
long get (void) const
 Get the date as a number for the object or 0 if invalid.
unsigned getDay (void) const
 Get the day of the month of the date.
unsigned getDayOfWeek (void) const
 Get the day of the week (0-7).
long getJulian (void)
 Get the julian number of a date.
unsigned getMonth (void) const
 Get the month of the date (1-12).
time_t getTime (void) const
 Get a time_t for the julian date if in time_t epoch.
int getYear (void) const
 Get the year of the date.
bool isValid (void) const
 Check if date is valid.
 operator bool () const
 Check if julian date is valid for is() expression.
 operator long () const
 Casting operator to return date as number.
bool operator! () const
 Check if julian date is not valid.
bool operator!= (const Date &date)
 Compare julian dates if not same date.
String operator() () const
 Expression operator to return an ISO date string for the current julian date.
long operator* () const
 Access julian value.
Date operator+ (long days)
 Add days to julian date in an expression.
Dateoperator++ ()
 Increment date by one day.
Dateoperator+= (long offset)
 Increment date by offset.
Date operator- (long days)
 Subtract days from a julian date in an expression.
long operator- (const Date &date)
 Operator to compute number of days between two dates.
Dateoperator-- ()
 Decrement date by one day.
Dateoperator-= (long offset)
 Decrement date by offset.
bool operator< (const Date &date)
 Compare julian date if earlier than another date.
bool operator<= (const Date &date)
 Compare julian date if earlier than or equal to another date.
Dateoperator= (const Date &date)
 Assign date from another date object.
bool operator== (const Date &date)
 Compare julian dates if same date.
bool operator> (const Date &date)
 Compare julian date if later than another date.
bool operator>= (const Date &date)
 Compare julian date if later than or equal to another date.
int operator[] (index_t component) const
 Access numeric components.
void set (const char *pointer, size_t size=0)
 Set the julian date based on an ISO date string of specified size.
virtual ~Date ()
 Destroy julian date object.

Protected Member Functions

void update (void)
 A method to use to "post" any changed values when shadowing a mixed object class.
- Protected Member Functions inherited from ucommon::Date
void fromJulian (char *buf) const
void toJulian (long year, long month, long day)

Additional Inherited Members

- Public Types inherited from ucommon::Date
enum  index_t { year = 10, month, day, dow }
 index elements.
- Static Public Attributes inherited from ucommon::Date
static const size_t sz_string
 Size of date string field.
- Protected Attributes inherited from ucommon::Number
char * buffer
unsigned size
- Protected Attributes inherited from ucommon::Date
long julian

Detailed Description

A number class that manipulates a string buffer that is also a date.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m a number that is also a date string.

Definition at line 998 of file datetime.h.

Constructor & Destructor Documentation

ucommon::DateNumber::DateNumber ( char *  pointer)

Create a date number tied to a refreshed string buffer.

Parameters
pointerto string buffer to rewrite.

Member Function Documentation

void ucommon::DateNumber::update ( void  )
protectedvirtual

A method to use to "post" any changed values when shadowing a mixed object class.

This is used by DateNumber and string classes.

Reimplemented from ucommon::Date.


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