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

panda/src/downloader/documentSpec.h

Go to the documentation of this file.
00001 // Filename: documentSpec.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 DOCUMENTSPEC_H
00020 #define DOCUMENTSPEC_H
00021 
00022 #include "pandabase.h"
00023 #include "urlSpec.h"
00024 #include "httpEntityTag.h"
00025 #include "httpDate.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : DocumentSpec
00029 // Description : A descriptor that refers to a particular version of a
00030 //               document.  This includes the URL of the document and
00031 //               its identity tag and last-modified dates.
00032 //
00033 //               The DocumentSpec may also be used to request a newer
00034 //               document than a particular one if available, for
00035 //               instance to refresh a cached document.
00036 ////////////////////////////////////////////////////////////////////
00037 class EXPCL_PANDAEXPRESS DocumentSpec {
00038 PUBLISHED:
00039   INLINE DocumentSpec();
00040   INLINE DocumentSpec(const string &url);
00041   INLINE DocumentSpec(const URLSpec &url);
00042   INLINE DocumentSpec(const DocumentSpec &copy);
00043   INLINE void operator = (const DocumentSpec &copy);
00044 
00045   INLINE bool operator == (const DocumentSpec &other) const;
00046   INLINE bool operator != (const DocumentSpec &other) const;
00047   INLINE bool operator < (const DocumentSpec &other) const;
00048   int compare_to(const DocumentSpec &other) const;
00049 
00050   INLINE void set_url(const URLSpec &url);
00051   INLINE const URLSpec &get_url() const;
00052 
00053   INLINE void set_tag(const HTTPEntityTag &tag);
00054   INLINE bool has_tag() const;
00055   INLINE const HTTPEntityTag &get_tag() const;
00056   INLINE void clear_tag();
00057 
00058   INLINE void set_date(const HTTPDate &date);
00059   INLINE bool has_date() const;
00060   INLINE const HTTPDate &get_date() const;
00061   INLINE void clear_date();
00062 
00063   enum RequestMode {
00064     RM_any,
00065     RM_equal,
00066     RM_newer,
00067     RM_equal_or_newer,
00068   };
00069 
00070   INLINE void set_request_mode(RequestMode request_mode);
00071   INLINE RequestMode get_request_mode() const;
00072 
00073   enum CacheControl {
00074     CC_allow_cache,
00075     CC_revalidate,
00076     CC_no_cache,
00077   };
00078 
00079   INLINE void set_cache_control(CacheControl cache_control);
00080   INLINE CacheControl get_cache_control() const;
00081 
00082   bool input(istream &in);
00083   void output(ostream &out) const;
00084   void write(ostream &out, int indent_level = 0) const;
00085 
00086 private:
00087   URLSpec _url;
00088   HTTPEntityTag _tag;
00089   HTTPDate _date;
00090   RequestMode _request_mode;
00091   CacheControl _cache_control;
00092 
00093   enum Flags {
00094     F_has_tag    = 0x0001,
00095     F_has_date   = 0x0002,
00096   };
00097   int _flags;
00098 };
00099 
00100 INLINE istream &operator >> (istream &in, DocumentSpec &doc);
00101 INLINE ostream &operator << (ostream &out, const DocumentSpec &doc);
00102 
00103 #include "documentSpec.I"
00104 
00105 #endif

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