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

panda/src/downloader/httpEntityTag.I

Go to the documentation of this file.
00001 // Filename: httpEntityTag.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: HTTPEntityTag::Constructor
00022 //       Access: Published
00023 //  Description: 
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE HTTPEntityTag::
00026 HTTPEntityTag() {
00027   _weak = false;
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: HTTPEntityTag::Constructor
00032 //       Access: Published
00033 //  Description: This constructor accepts an explicit weak flag and a
00034 //               literal (not quoted) tag string.
00035 ////////////////////////////////////////////////////////////////////
00036 INLINE HTTPEntityTag::
00037 HTTPEntityTag(bool weak, const string &tag) :
00038   _weak(weak),
00039   _tag(tag)
00040 {
00041 }
00042 
00043 ////////////////////////////////////////////////////////////////////
00044 //     Function: HTTPEntityTag::Copy Constructor
00045 //       Access: Published
00046 //  Description:
00047 ////////////////////////////////////////////////////////////////////
00048 INLINE HTTPEntityTag::
00049 HTTPEntityTag(const HTTPEntityTag &copy) : 
00050   _weak(copy._weak),
00051   _tag(copy._tag)
00052 {
00053 }
00054 
00055 ////////////////////////////////////////////////////////////////////
00056 //     Function: HTTPEntityTag::Copy Assignment Operator
00057 //       Access: Published
00058 //  Description:
00059 ////////////////////////////////////////////////////////////////////
00060 INLINE void HTTPEntityTag::
00061 operator = (const HTTPEntityTag &copy) {
00062   _weak = copy._weak;
00063   _tag = copy._tag;
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function: HTTPEntityTag::is_weak
00068 //       Access: Published
00069 //  Description: Returns true if the entity tag is marked as "weak".
00070 //               A consistent weak entity tag does not guarantee that
00071 //               its resource has not changed in any way, but it does
00072 //               promise that the resource has not changed in any
00073 //               semantically meaningful way.
00074 ////////////////////////////////////////////////////////////////////
00075 INLINE bool HTTPEntityTag::
00076 is_weak() const {
00077   return _weak;
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function: HTTPEntityTag::get_tag
00082 //       Access: Published
00083 //  Description: Returns the tag as a literal string.
00084 ////////////////////////////////////////////////////////////////////
00085 INLINE const string &HTTPEntityTag::
00086 get_tag() const {
00087   return _tag;
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: HTTPEntityTag::strong_equiv
00092 //       Access: Published
00093 //  Description: Returns true if the two tags have "strong" equivalence:
00094 //               they are the same tag, and both are "strong".
00095 ////////////////////////////////////////////////////////////////////
00096 INLINE bool HTTPEntityTag::
00097 strong_equiv(const HTTPEntityTag &other) const {
00098   return _tag == other._tag && !_weak && !other._weak;
00099 }
00100 
00101 ////////////////////////////////////////////////////////////////////
00102 //     Function: HTTPEntityTag::weak_equiv
00103 //       Access: Published
00104 //  Description: Returns true if the two tags have "weak" equivalence:
00105 //               they are the same tag, and one or both may be "weak".
00106 ////////////////////////////////////////////////////////////////////
00107 INLINE bool HTTPEntityTag::
00108 weak_equiv(const HTTPEntityTag &other) const {
00109   return _tag == other._tag;
00110 }
00111 
00112 ////////////////////////////////////////////////////////////////////
00113 //     Function: HTTPEntityTag::Operator ==
00114 //       Access: Published
00115 //  Description: The == operator tests object equivalence; see also
00116 //               strong_equiv() and weak_equiv() for the two kinds of
00117 //               HTTP equivalence.
00118 ////////////////////////////////////////////////////////////////////
00119 INLINE bool HTTPEntityTag::
00120 operator == (const HTTPEntityTag &other) const {
00121   return _weak == other._weak && _tag == other._tag;
00122 }
00123 
00124 ////////////////////////////////////////////////////////////////////
00125 //     Function: HTTPEntityTag::Operator !=
00126 //       Access: Published
00127 //  Description:
00128 ////////////////////////////////////////////////////////////////////
00129 INLINE bool HTTPEntityTag::
00130 operator != (const HTTPEntityTag &other) const {
00131   return !operator == (other);
00132 }
00133 
00134 ////////////////////////////////////////////////////////////////////
00135 //     Function: HTTPEntityTag::Operator <
00136 //       Access: Published
00137 //  Description:
00138 ////////////////////////////////////////////////////////////////////
00139 INLINE bool HTTPEntityTag::
00140 operator < (const HTTPEntityTag &other) const {
00141   if (_weak != other._weak) {
00142     return (int)_weak < (int)other._weak;
00143   }
00144   return _tag < other._tag;
00145 }
00146 
00147 ////////////////////////////////////////////////////////////////////
00148 //     Function: HTTPEntityTag::compare_to
00149 //       Access: Published
00150 //  Description: Returns a number less than zero if this HTTPEntityTag
00151 //               sorts before the other one, greater than zero if it
00152 //               sorts after, or zero if they are equivalent.
00153 ////////////////////////////////////////////////////////////////////
00154 INLINE int HTTPEntityTag::
00155 compare_to(const HTTPEntityTag &other) const {
00156   if (_weak != other._weak) {
00157     return (int)_weak - (int)other._weak;
00158   }
00159   return strcmp(_tag.c_str(), other._tag.c_str());
00160 }
00161 
00162 ////////////////////////////////////////////////////////////////////
00163 //     Function: HTTPEntityTag::output
00164 //       Access: Published
00165 //  Description: 
00166 ////////////////////////////////////////////////////////////////////
00167 INLINE void HTTPEntityTag::
00168 output(ostream &out) const {
00169   out << get_string();
00170 }
00171 
00172 
00173 INLINE ostream &
00174 operator << (ostream &out, const HTTPEntityTag &entityTag) {
00175   entityTag.output(out);
00176   return out;
00177 }
00178 
00179 

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