Panda3D
Public Member Functions | Static Public Member Functions | List of all members
HTTPDate Class Reference

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

#include "httpDate.h"

Public Member Functions

 HTTPDate (time_t time)
 
 HTTPDate (const string &format)
 Decodes the string into a sensible date. More...
 
 HTTPDate (const HTTPDate &copy)
 
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. More...
 
string get_string () const
 
time_t get_time () const
 Returns the date as a C time_t value. More...
 
bool input (istream &in)
 
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.) More...
 
bool operator!= (const HTTPDate &other) const
 
HTTPDate operator+ (int seconds) const
 
void operator+= (int seconds)
 
HTTPDate operator- (int seconds) const
 
int operator- (const HTTPDate &other) const
 
void operator-= (int seconds)
 
bool operator< (const HTTPDate &other) const
 
void operator= (const HTTPDate &copy)
 
bool operator== (const HTTPDate &other) const
 
bool operator> (const HTTPDate &other) const
 
void output (ostream &out) const
 

Static Public Member Functions

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

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 30 of file httpDate.h.

Constructor & Destructor Documentation

◆ HTTPDate()

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 39 of file httpDate.cxx.

References is_valid(), and now().

Member Function Documentation

◆ compare_to()

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 134 of file httpDate.I.

Referenced by get_time().

◆ get_time()

time_t HTTPDate::get_time ( ) const
inline

Returns the date as a C time_t value.

Definition at line 82 of file httpDate.I.

References compare_to().

Referenced by is_valid().

◆ is_valid()

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 72 of file httpDate.I.

References get_time().

Referenced by HTTPDate(), and now().

◆ now()

HTTPDate HTTPDate::now ( )
inlinestatic

Returns an HTTPDate that represents the current time and date.

Definition at line 60 of file httpDate.I.

References is_valid().

Referenced by HTTPDate().


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