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