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 (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 (Date &object)
 Create a julian date object from another object.
 Date ()
 Construct a new julian date with today's date.
char * get (char *buffer)
 Get a ISO string representation of the date (yyyy-mm-dd).
long get (void)
 Get the date as a number for the object or 0 if invalid.
unsigned getDay (void)
 Get the day of the month of the date.
unsigned getDayOfWeek (void)
 Get the day of the week (0-7).
long getJulian (void)
 Get the julian number of a date.
unsigned getMonth (void)
 Get the month of the date (1-12).
time_t getTime (void)
 Get a time_t for the julian date if in time_t epoch.
int getYear (void)
 Get the year of the date.
bool isValid (void)
 Check if date is valid.
 operator bool ()
 Check if julian date is valid for is() expression.
 operator long ()
 Casting operator to return date as number.
bool operator! ()
 Check if julian date is not valid.
bool operator!= (Date &date)
 Compare julian dates if not same date.
String operator() ()
 Expression operator to return an ISO date string for the current julian date.
long operator* ()
 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- (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< (Date &date)
 Compare julian date if earlier than another date.
bool operator<= (Date &date)
 Compare julian date if earlier than or equal to another date.
Dateoperator= (Date &date)
 Assign date from another date object.
bool operator== (Date &date)
 Compare julian dates if same date.
bool operator> (Date &date)
 Compare julian date if later than another date.
bool operator>= (Date &date)
 Compare julian date if later than or equal to another date.
int operator[] (index_t component)
 Access numeric components.
void set (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)
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 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: