Helper class to convert an RWDateTime instance to a date from a string and vice versa, conforming to the HTTP/1.1 specification.
More...
#include <rw/http/RWHttpDate.h>
RWHttpDate maintains the date and time. It outputs the date as a string that conforms to the HTTP/1.1 date specification.
◆ RWHttpDate() [1/3]
RWHttpDate::RWHttpDate |
( |
void | | ) |
|
|
inline |
Constructs a default RWHttpDate object. Internal date and time are initialized to the current date and time, respectively.
◆ RWHttpDate() [2/3]
Constructs an RWHttpDate object with the internal date and time set to those in dt.
◆ RWHttpDate() [3/3]
RWHttpDate::RWHttpDate |
( |
const RWCString & | str | ) |
|
|
inline |
Constructs an RWHttpDate object with the input str. The str argument must be an HTTP/1.1-compliant date string. The str is parsed for date and time, and the internals are set to the result. If str cannot be parsed, an invalid date is constructed.
HTTP/1.1 defines the following formats as acceptable date strings:
- Sun, 06 Nov 1994 08:49:37 GMT; RFC 822, updated by RFC 1123
- Sunday, 06-Nov-94 08:49:37 GMT; RFC 850, obsoleted by RFC 1036
- Sun Nov 06 08:49:37 1994; C++ Standard Library std::asctime() format
- Note
- RWHttpDate assumes a two-digit RFC 850 date that appears to be more than 50 years in the future is in fact in the past. (This helps solve the "year 2000" problem.)
◆ asString()
Returns the internal date and time formatted to comply with the HTTP/1.1 specification. The RWCString should contain 7-bit US-ASCII data. Throws RWInternalErr if isValid() is false
.
◆ getDate()
◆ isValid()
bool RWHttpDate::isValid |
( |
| ) |
const |
|
inline |
Returns true
if the internal RWDateTime is not a sentinel value.
◆ setDate() [1/2]
void RWHttpDate::setDate |
( |
const RWCString & | str | ) |
|
Sets the internal date of the RWHttpDate object from the string str. The str argument must be an HTTP/1.1-compliant date string. The str is parsed for date and time, and the internals are set to the result. If str cannot be parsed, an invalid date is constructed. The RWCString should contain 7-bit US-ASCII data.
◆ setDate() [2/2]
Sets the internal date of the RWHttpDate object to the date and time in dt.
◆ operator!=()
◆ operator<()
◆ operator<<()
std::ostream & operator<< |
( |
std::ostream & | s, |
|
|
const RWHttpDate & | d ) |
|
related |
◆ operator<=()
◆ operator==()
◆ operator>()
◆ operator>=()
◆ operator>>()
std::istream & operator>> |
( |
std::istream & | s, |
|
|
RWHttpDate & | d ) |
|
related |
Restores an RWHttpDate from an std::istream
into d, replacing the previous contents of d.