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

panda/src/downloader/httpDate.I

Go to the documentation of this file.
00001 // Filename: httpDate.I
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 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: HTTPDate::Constructor
00022 //       Access: Published
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE HTTPDate::
00026 HTTPDate() : _time(-1) {
00027 }
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: HTTPDate::Constructor
00031 //       Access: Published
00032 //  Description:
00033 ////////////////////////////////////////////////////////////////////
00034 INLINE HTTPDate::
00035 HTTPDate(time_t time) : _time(time) {
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: HTTPDate::Copy Constructor
00040 //       Access: Published
00041 //  Description:
00042 ////////////////////////////////////////////////////////////////////
00043 INLINE HTTPDate::
00044 HTTPDate(const HTTPDate &copy) : _time(copy._time) {
00045 }
00046 
00047 ////////////////////////////////////////////////////////////////////
00048 //     Function: HTTPDate::Copy Assignment Operator
00049 //       Access: Published
00050 //  Description:
00051 ////////////////////////////////////////////////////////////////////
00052 INLINE void HTTPDate::
00053 operator = (const HTTPDate &copy) {
00054   _time = copy._time;
00055 }
00056 
00057 ////////////////////////////////////////////////////////////////////
00058 //     Function: HTTPDate::now (named constructor)
00059 //       Access: Published, Static
00060 //  Description: Returns an HTTPDate that represents the current time
00061 //               and date.
00062 ////////////////////////////////////////////////////////////////////
00063 INLINE HTTPDate HTTPDate::
00064 now() {
00065   return HTTPDate(time(NULL));
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: HTTPDate::is_valid
00070 //       Access: Published
00071 //  Description: Returns true if the date is meaningful, or false if
00072 //               it is -1 (which generally indicates the source string
00073 //               could not be parsed.)
00074 ////////////////////////////////////////////////////////////////////
00075 INLINE bool HTTPDate::
00076 is_valid() const {
00077   return (_time != (time_t)(-1));
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function: HTTPDate::get_time
00082 //       Access: Published
00083 //  Description: Returns the date as a C time_t value.
00084 ////////////////////////////////////////////////////////////////////
00085 INLINE time_t HTTPDate::
00086 get_time() const {
00087   return _time;
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: HTTPDate::Operator ==
00092 //       Access: Published
00093 //  Description:
00094 ////////////////////////////////////////////////////////////////////
00095 INLINE bool HTTPDate::
00096 operator == (const HTTPDate &other) const {
00097   return _time == other._time;
00098 }
00099 
00100 ////////////////////////////////////////////////////////////////////
00101 //     Function: HTTPDate::Operator !=
00102 //       Access: Published
00103 //  Description:
00104 ////////////////////////////////////////////////////////////////////
00105 INLINE bool HTTPDate::
00106 operator != (const HTTPDate &other) const {
00107   return !operator == (other);
00108 }
00109 
00110 ////////////////////////////////////////////////////////////////////
00111 //     Function: HTTPDate::Operator <
00112 //       Access: Published
00113 //  Description:
00114 ////////////////////////////////////////////////////////////////////
00115 INLINE bool HTTPDate::
00116 operator < (const HTTPDate &other) const {
00117   return _time < other._time;
00118 }
00119 
00120 ////////////////////////////////////////////////////////////////////
00121 //     Function: HTTPDate::Operator >
00122 //       Access: Published
00123 //  Description:
00124 ////////////////////////////////////////////////////////////////////
00125 INLINE bool HTTPDate::
00126 operator > (const HTTPDate &other) const {
00127   return _time > other._time;
00128 }
00129 
00130 ////////////////////////////////////////////////////////////////////
00131 //     Function: HTTPDate::compare_to
00132 //       Access: Published
00133 //  Description: Returns a number less than zero if this HTTPDate
00134 //               sorts before the other one, greater than zero if it
00135 //               sorts after, or zero if they are equivalent.
00136 ////////////////////////////////////////////////////////////////////
00137 INLINE int HTTPDate::
00138 compare_to(const HTTPDate &other) const {
00139   return (int)(_time - other._time);
00140 }
00141 
00142 ////////////////////////////////////////////////////////////////////
00143 //     Function: HTTPDate::operator +=
00144 //       Access: Published
00145 //  Description:
00146 ////////////////////////////////////////////////////////////////////
00147 INLINE void HTTPDate::
00148 operator += (int seconds) {
00149   _time += seconds;
00150 }
00151 
00152 ////////////////////////////////////////////////////////////////////
00153 //     Function: HTTPDate::operator -=
00154 //       Access: Published
00155 //  Description:
00156 ////////////////////////////////////////////////////////////////////
00157 INLINE void HTTPDate::
00158 operator -= (int seconds) {
00159   _time -= seconds;
00160 }
00161 
00162 ////////////////////////////////////////////////////////////////////
00163 //     Function: HTTPDate::operator +
00164 //       Access: Published
00165 //  Description:
00166 ////////////////////////////////////////////////////////////////////
00167 INLINE HTTPDate HTTPDate::
00168 operator + (int seconds) const {
00169   return HTTPDate(_time + seconds);
00170 }
00171 
00172 ////////////////////////////////////////////////////////////////////
00173 //     Function: HTTPDate::operator -
00174 //       Access: Published
00175 //  Description:
00176 ////////////////////////////////////////////////////////////////////
00177 INLINE HTTPDate HTTPDate::
00178 operator - (int seconds) const {
00179   return HTTPDate(_time - seconds);
00180 }
00181 
00182 ////////////////////////////////////////////////////////////////////
00183 //     Function: HTTPDate::operator -
00184 //       Access: Published
00185 //  Description:
00186 ////////////////////////////////////////////////////////////////////
00187 INLINE int HTTPDate::
00188 operator - (const HTTPDate &other) const {
00189   return (int)(_time - other._time);
00190 }
00191 
00192 
00193 INLINE istream &
00194 operator >> (istream &in, HTTPDate &date) {
00195   if (!date.input(in)) {
00196     in.clear(ios::failbit | in.rdstate());
00197   }
00198   return in;
00199 }
00200 
00201 INLINE ostream &
00202 operator << (ostream &out, const HTTPDate &date) {
00203   date.output(out);
00204   return out;
00205 }
00206 
00207 

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