Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

HTTPDate Class Reference

A container for an HTTP-legal time/date indication. More...

#include <httpDate.h>

List of all members.

Public Member Functions

 HTTPDate ()
 HTTPDate (time_t time)
 HTTPDate (const string &format)
 Decodes the string into a sensible date.

 HTTPDate (const HTTPDate &copy)
void operator= (const HTTPDate &copy)
bool is_valid () const
 Returns true if the date is meaningful, or false if it is -1 (which generally indicates the source string could not be parsed.).

string get_string () const
time_t get_time () const
 Returns the date as a C time_t value.

bool operator== (const HTTPDate &other) const
bool operator!= (const HTTPDate &other) const
bool operator< (const HTTPDate &other) const
bool operator> (const HTTPDate &other) const
int compare_to (const HTTPDate &other) const
 Returns a number less than zero if this HTTPDate sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.

void operator+= (int seconds)
void operator-= (int seconds)
HTTPDate operator+ (int seconds) const
HTTPDate operator- (int seconds) const
int operator- (const HTTPDate &other) const
bool input (istream &in)
void output (ostream &out) const

Static Public Member Functions

HTTPDate now ()
 Returns an HTTPDate that represents the current time and date.


Static Private Member Functions

string get_token (const string &str, size_t &pos)
 Extracts the next token from the string starting at the indicated position.


Private Attributes

time_t _time


Detailed Description

A container for an HTTP-legal time/date indication.

This can accept a string from an HTTP header and will decode it into a C time_t value; conversely, it can accept a time_t value and encode it for output as a string.

Definition at line 44 of file httpDate.h.


Constructor & Destructor Documentation

HTTPDate::HTTPDate  )  [inline]
 

Definition at line 31 of file httpDate.I.

References INLINE.

Referenced by compare_to(), and operator=().

HTTPDate::HTTPDate time_t  time  )  [inline]
 

Definition at line 42 of file httpDate.I.

References INLINE.

HTTPDate::HTTPDate const string &  format  ) 
 

Decodes the string into a sensible date.

Returns 0 (!is_valid()) if the string cannot be correctly decoded.

Definition at line 51 of file httpDate.cxx.

HTTPDate::HTTPDate const HTTPDate &  copy  )  [inline]
 

Definition at line 53 of file httpDate.I.

References _time.


Member Function Documentation

int HTTPDate::compare_to const HTTPDate &  other  )  const [inline]
 

Returns a number less than zero if this HTTPDate sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.

Definition at line 174 of file httpDate.I.

References _time, HTTPDate(), and INLINE.

string HTTPDate::get_string  )  const
 

Definition at line 243 of file httpDate.cxx.

References months.

time_t HTTPDate::get_time  )  const [inline]
 

Returns the date as a C time_t value.

Definition at line 109 of file httpDate.I.

References _time, and INLINE.

string HTTPDate::get_token const string &  str,
size_t pos
[static, private]
 

Extracts the next token from the string starting at the indicated position.

Returns the token and updates pos. When the last token has been extracted, returns empty string.

A token is defined as a contiguous sequence of digits or letters. If it is a sequence of letters, the function quietly truncates it to three letters before returning, and forces the first letter to capital and the second two to lowercase. If it is a sequence of digits, the function also returns the next character following the last digit (unless it is a letter).

Definition at line 346 of file httpDate.cxx.

bool HTTPDate::input istream &  in  ) 
 

Definition at line 273 of file httpDate.cxx.

bool HTTPDate::is_valid  )  const [inline]
 

Returns true if the date is meaningful, or false if it is -1 (which generally indicates the source string could not be parsed.).

Definition at line 96 of file httpDate.I.

References _time.

HTTPDate HTTPDate::now  )  [inline, static]
 

Returns an HTTPDate that represents the current time and date.

Definition at line 79 of file httpDate.I.

References _time, INLINE, and time_t.

bool HTTPDate::operator!= const HTTPDate &  other  )  const [inline]
 

Definition at line 133 of file httpDate.I.

References _time, and INLINE.

HTTPDate HTTPDate::operator+ int  seconds  )  const [inline]
 

Definition at line 210 of file httpDate.I.

void HTTPDate::operator+= int  seconds  )  [inline]
 

Definition at line 186 of file httpDate.I.

References _time, and INLINE.

int HTTPDate::operator- const HTTPDate &  other  )  const [inline]
 

Definition at line 234 of file httpDate.I.

HTTPDate HTTPDate::operator- int  seconds  )  const [inline]
 

Definition at line 222 of file httpDate.I.

void HTTPDate::operator-= int  seconds  )  [inline]
 

Definition at line 198 of file httpDate.I.

bool HTTPDate::operator< const HTTPDate &  other  )  const [inline]
 

Definition at line 145 of file httpDate.I.

References _time, and INLINE.

void HTTPDate::operator= const HTTPDate &  copy  )  [inline]
 

Definition at line 64 of file httpDate.I.

References HTTPDate(), and NULL.

bool HTTPDate::operator== const HTTPDate &  other  )  const [inline]
 

Definition at line 121 of file httpDate.I.

References _time, and INLINE.

bool HTTPDate::operator> const HTTPDate &  other  )  const [inline]
 

Definition at line 157 of file httpDate.I.

References _time, and INLINE.

void HTTPDate::output ostream &  out  )  const
 

Definition at line 309 of file httpDate.cxx.

References size_t.


Member Data Documentation

time_t HTTPDate::_time [private]
 

Definition at line 77 of file httpDate.h.

Referenced by compare_to(), get_time(), HTTPDate(), is_valid(), now(), operator!=(), operator+=(), operator<(), operator==(), and operator>().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:51:33 2003 for Panda by doxygen1.3