00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00029
00030
00031
00032
00033
00034
00035
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 ©);
00043 INLINE void operator = (const DocumentSpec ©);
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