00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef DOCUMENTSPEC_H
00016 #define DOCUMENTSPEC_H
00017
00018 #include "pandabase.h"
00019 #include "urlSpec.h"
00020 #include "httpEntityTag.h"
00021 #include "httpDate.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class EXPCL_PANDAEXPRESS DocumentSpec {
00034 PUBLISHED:
00035 INLINE DocumentSpec();
00036 INLINE DocumentSpec(const string &url);
00037 INLINE DocumentSpec(const URLSpec &url);
00038 INLINE DocumentSpec(const DocumentSpec ©);
00039 INLINE void operator = (const DocumentSpec ©);
00040
00041 INLINE bool operator == (const DocumentSpec &other) const;
00042 INLINE bool operator != (const DocumentSpec &other) const;
00043 INLINE bool operator < (const DocumentSpec &other) const;
00044 int compare_to(const DocumentSpec &other) const;
00045
00046 INLINE void set_url(const URLSpec &url);
00047 INLINE const URLSpec &get_url() const;
00048
00049 INLINE void set_tag(const HTTPEntityTag &tag);
00050 INLINE bool has_tag() const;
00051 INLINE const HTTPEntityTag &get_tag() const;
00052 INLINE void clear_tag();
00053
00054 INLINE void set_date(const HTTPDate &date);
00055 INLINE bool has_date() const;
00056 INLINE const HTTPDate &get_date() const;
00057 INLINE void clear_date();
00058
00059 enum RequestMode {
00060 RM_any,
00061 RM_equal,
00062 RM_newer,
00063 RM_equal_or_newer,
00064 };
00065
00066 INLINE void set_request_mode(RequestMode request_mode);
00067 INLINE RequestMode get_request_mode() const;
00068
00069 enum CacheControl {
00070 CC_allow_cache,
00071 CC_revalidate,
00072 CC_no_cache,
00073 };
00074
00075 INLINE void set_cache_control(CacheControl cache_control);
00076 INLINE CacheControl get_cache_control() const;
00077
00078 bool input(istream &in);
00079 void output(ostream &out) const;
00080 void write(ostream &out, int indent_level = 0) const;
00081
00082 private:
00083 URLSpec _url;
00084 HTTPEntityTag _tag;
00085 HTTPDate _date;
00086 RequestMode _request_mode;
00087 CacheControl _cache_control;
00088
00089 enum Flags {
00090 F_has_tag = 0x0001,
00091 F_has_date = 0x0002,
00092 };
00093 int _flags;
00094 };
00095
00096 INLINE istream &operator >> (istream &in, DocumentSpec &doc);
00097 INLINE ostream &operator << (ostream &out, const DocumentSpec &doc);
00098
00099 #include "documentSpec.I"
00100
00101 #endif