UCommon
Public Types | Public Member Functions | Protected Member Functions
ucommon::DateTimeString Class Reference

A DateTime string class. More...

#include <datetime.h>

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

Public Types

enum  mode_t { DATE, TIME, BOTH }
 Specify string buffer mode. More...

Public Member Functions

char * c_str (void)
 Extract char from string.
 DateTimeString (time_t time)
 Construct a date and time from C libraray time_t type.
 DateTimeString (tm_t *tm)
 Construct a date and time from C library time structure.
 DateTimeString (char *pointer, size_t size=0)
 Construct a date and time from ISO string buffer.
 DateTimeString (int year, unsigned month, unsigned day, int hour=0, int minute=0, int second=0)
 Construct a date and time object from explicit date and time values.
 DateTimeString (DateTimeString &object)
 Create a datetime object from another object.
 DateTimeString (mode_t string=DateTimeString::BOTH)
 Construct a new date and time object with current date and time.
 operator char * (void)
 Cast to string.
void set (void)
 Set (update) the date and time with current date and time.
void set (mode_t string)
 Set the string mode.
virtual ~DateTimeString ()
 Destroy date time string.

Protected Member Functions

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

Detailed Description

A DateTime string class.

This can be used to access the date and time as a standard string without requiring an external buffer.

Author:
David Sugar <dyfet@gnutelephony.org> a datetime class that returns strings.

Definition at line 899 of file datetime.h.


Member Enumeration Documentation

Specify string buffer mode.

By default we form a string with date and time.

Definition at line 906 of file datetime.h.


Constructor & Destructor Documentation

Construct a date and time from C libraray time_t type.

Parameters:
timetype to make date and time from.

Construct a date and time from C library time structure.

Parameters:
tmstructure from C library (from glt or gmt).
ucommon::DateTimeString::DateTimeString ( char *  pointer,
size_t  size = 0 
)

Construct a date and time from ISO string buffer.

Parameters:
pointerto string field holding date and time.
sizeof field if not null terminated string.
ucommon::DateTimeString::DateTimeString ( int  year,
unsigned  month,
unsigned  day,
int  hour = 0,
int  minute = 0,
int  second = 0 
)

Construct a date and time object from explicit date and time values.

Parameters:
yearof object.
monthof object (1-12).
dayof month of object (1-31).
hourof object (0-23).
minuteof object (0-59).
secondof object (0-59).

Create a datetime object from another object.

Parameters:
objectto copy.

Member Function Documentation

char* ucommon::DateTimeString::c_str ( void  ) [inline]

Extract char from string.

Returns:
string of datetime.

Definition at line 969 of file datetime.h.

ucommon::DateTimeString::operator char * ( void  ) [inline]

Cast to string.

Returns:
string of datetime.

Definition at line 977 of file datetime.h.

Set the string mode.

Parameters:
stringmode to use.
void ucommon::DateTimeString::update ( void  ) [protected, virtual]

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::DateTime.


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