Panda3D
httpDate.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file httpDate.h
10 * @author drose
11 * @date 2003-01-28
12 */
13
14#ifndef HTTPDATE_H
15#define HTTPDATE_H
16
17#include "pandabase.h"
18
19#include <time.h>
20
21/**
22 * A container for an HTTP-legal time/date indication. This can accept a
23 * string from an HTTP header and will decode it into a C time_t value;
24 * conversely, it can accept a time_t value and encode it for output as a
25 * string.
26 */
27class EXPCL_PANDA_DOWNLOADER HTTPDate {
28PUBLISHED:
29 INLINE HTTPDate();
30 INLINE HTTPDate(time_t time);
31 HTTPDate(const std::string &format);
32 INLINE HTTPDate(const HTTPDate &copy);
33 INLINE void operator = (const HTTPDate &copy);
34 INLINE static HTTPDate now();
35
36 INLINE bool is_valid() const;
37
38 std::string get_string() const;
39 INLINE time_t get_time() const;
40
41 INLINE bool operator == (const HTTPDate &other) const;
42 INLINE bool operator != (const HTTPDate &other) const;
43 INLINE bool operator < (const HTTPDate &other) const;
44 INLINE bool operator > (const HTTPDate &other) const;
45 INLINE int compare_to(const HTTPDate &other) const;
46
47 INLINE void operator += (int seconds);
48 INLINE void operator -= (int seconds);
49
50 INLINE HTTPDate operator + (int seconds) const;
51 INLINE HTTPDate operator - (int seconds) const;
52 INLINE int operator - (const HTTPDate &other) const;
53
54 bool input(std::istream &in);
55 void output(std::ostream &out) const;
56
57private:
58 static std::string get_token(const std::string &str, size_t &pos);
59
60 time_t _time;
61};
62
63INLINE std::istream &operator >> (std::istream &in, HTTPDate &date);
64INLINE std::ostream &operator << (std::ostream &out, const HTTPDate &date);
65
66#include "httpDate.I"
67
68#endif
A container for an HTTP-legal time/date indication.
Definition: httpDate.h:27
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:73
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.