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

panda/src/downloader/httpDate.h

Go to the documentation of this file.
00001 // Filename: httpDate.h
00002 // Created by:  drose (28Jan03)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef HTTPDATE_H
00020 #define HTTPDATE_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include <time.h>
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : HTTPDate
00028 // Description : A container for an HTTP-legal time/date indication.
00029 //               This can accept a string from an HTTP header and will
00030 //               decode it into a C time_t value; conversely, it can
00031 //               accept a time_t value and encode it for output as a
00032 //               string.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDAEXPRESS HTTPDate {
00035 PUBLISHED:
00036   INLINE HTTPDate();
00037   INLINE HTTPDate(time_t time);
00038   HTTPDate(const string &format);
00039   INLINE HTTPDate(const HTTPDate &copy);
00040   INLINE void operator = (const HTTPDate &copy);
00041   INLINE static HTTPDate now();
00042 
00043   INLINE bool is_valid() const;
00044 
00045   string get_string() const;
00046   INLINE time_t get_time() const;
00047 
00048   INLINE bool operator == (const HTTPDate &other) const;
00049   INLINE bool operator != (const HTTPDate &other) const;
00050   INLINE bool operator < (const HTTPDate &other) const;
00051   INLINE bool operator > (const HTTPDate &other) const;
00052   INLINE int compare_to(const HTTPDate &other) const;
00053 
00054   INLINE void operator += (int seconds);
00055   INLINE void operator -= (int seconds);
00056 
00057   INLINE HTTPDate operator + (int seconds) const;
00058   INLINE HTTPDate operator - (int seconds) const;
00059   INLINE int operator - (const HTTPDate &other) const;
00060 
00061   bool input(istream &in);
00062   void output(ostream &out) const;
00063 
00064 private:
00065   static string get_token(const string &str, size_t &pos);
00066 
00067   time_t _time;
00068 };
00069 
00070 INLINE istream &operator >> (istream &in, HTTPDate &date);
00071 INLINE ostream &operator << (ostream &out, const HTTPDate &date);
00072 
00073 #include "httpDate.I"
00074 
00075 #endif

Generated on Fri May 2 00:36:49 2003 for Panda by doxygen1.3