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

DocumentSpec Class Reference

A descriptor that refers to a particular version of a document. More...

#include <documentSpec.h>

List of all members.

Public Types

enum  RequestMode { RM_any, RM_equal, RM_newer, RM_equal_or_newer }
enum  CacheControl { CC_allow_cache, CC_revalidate, CC_no_cache }

Public Member Functions

 DocumentSpec ()
 DocumentSpec (const string &url)
 DocumentSpec (const URLSpec &url)
 DocumentSpec (const DocumentSpec &copy)
void operator= (const DocumentSpec &copy)
bool operator== (const DocumentSpec &other) const
bool operator!= (const DocumentSpec &other) const
bool operator< (const DocumentSpec &other) const
int compare_to (const DocumentSpec &other) const
void set_url (const URLSpec &url)
 Changes the URL of the DocumentSpec without modifying its other properties.

const URLSpecget_url () const
 Retrieves the URL of the DocumentSpec.

void set_tag (const HTTPEntityTag &tag)
 Changes the identity tag associated with the DocumentSpec.

bool has_tag () const
 Returns true if an identity tag is associated with the DocumentSpec.

const HTTPEntityTagget_tag () const
 Returns the identity tag associated with the DocumentSpec, if there is one.

void clear_tag ()
 Removes the identity tag associated with the DocumentSpec, if there is one.

void set_date (const HTTPDate &date)
 Changes the last-modified date associated with the DocumentSpec.

bool has_date () const
 Returns true if a last-modified date is associated with the DocumentSpec.

const HTTPDateget_date () const
 Returns the last-modified date associated with the DocumentSpec, if there is one.

void clear_date ()
 Removes the last-modified date associated with the DocumentSpec, if there is one.

void set_request_mode (RequestMode request_mode)
 Sets the request mode of this DocumentSpec.

RequestMode get_request_mode () const
 Returns the request mode of this DocumentSpec.

void set_cache_control (CacheControl cache_control)
 Specifies what kind of cached value is acceptable for this document.

CacheControl get_cache_control () const
 Returns the request mode of this DocumentSpec.

bool input (istream &in)
 Can be used to read in the DocumentSpec from a stream generated either by output() or write().

void output (ostream &out) const
void write (ostream &out, int indent_level=0) const

Private Types

enum  Flags { F_has_tag = 0x0001, F_has_date = 0x0002 }

Private Attributes

URLSpec _url
HTTPEntityTag _tag
HTTPDate _date
RequestMode _request_mode
CacheControl _cache_control
int _flags


Detailed Description

A descriptor that refers to a particular version of a document.

This includes the URL of the document and its identity tag and last-modified dates.

The DocumentSpec may also be used to request a newer document than a particular one if available, for instance to refresh a cached document.

Definition at line 49 of file documentSpec.h.


Member Enumeration Documentation

enum DocumentSpec::CacheControl
 

Enumeration values:
CC_allow_cache 
CC_revalidate 
CC_no_cache 

Definition at line 85 of file documentSpec.h.

enum DocumentSpec::Flags [private]
 

Enumeration values:
F_has_tag 
F_has_date 

Definition at line 105 of file documentSpec.h.

enum DocumentSpec::RequestMode
 

Enumeration values:
RM_any 
RM_equal 
RM_newer 
RM_equal_or_newer 

Definition at line 75 of file documentSpec.h.

Referenced by get_date().


Constructor & Destructor Documentation

DocumentSpec::DocumentSpec  )  [inline]
 

Definition at line 31 of file documentSpec.I.

References _cache_control, _flags, _request_mode, CC_allow_cache, INLINE, RM_any, and url.

DocumentSpec::DocumentSpec const string &  url  )  [inline]
 

Definition at line 45 of file documentSpec.I.

References _cache_control, _flags, _request_mode, CC_allow_cache, INLINE, RM_any, and url.

DocumentSpec::DocumentSpec const URLSpec url  )  [inline]
 

Definition at line 61 of file documentSpec.I.

References INLINE.

DocumentSpec::DocumentSpec const DocumentSpec &  copy  )  [inline]
 

Definition at line 77 of file documentSpec.I.

References _cache_control, _date, _flags, _request_mode, _tag, _url, and INLINE.


Member Function Documentation

void DocumentSpec::clear_date  )  [inline]
 

Removes the last-modified date associated with the DocumentSpec, if there is one.

Definition at line 306 of file documentSpec.I.

References _cache_control, and INLINE.

void DocumentSpec::clear_tag  )  [inline]
 

Removes the identity tag associated with the DocumentSpec, if there is one.

Definition at line 242 of file documentSpec.I.

int DocumentSpec::compare_to const DocumentSpec &  other  )  const
 

Definition at line 35 of file documentSpec.cxx.

Referenced by operator=(), and operator==().

DocumentSpec::CacheControl DocumentSpec::get_cache_control  )  const [inline]
 

Returns the request mode of this DocumentSpec.

See set_cache_control().

Definition at line 464 of file documentSpec.I.

const HTTPDate & DocumentSpec::get_date  )  const [inline]
 

Returns the last-modified date associated with the DocumentSpec, if there is one.

It is an error to call this if has_date() returns false.

Definition at line 290 of file documentSpec.I.

References _request_mode, INLINE, and RequestMode.

Referenced by output().

DocumentSpec::RequestMode DocumentSpec::get_request_mode  )  const [inline]
 

Returns the request mode of this DocumentSpec.

See set_request_mode().

Definition at line 402 of file documentSpec.I.

const HTTPEntityTag & DocumentSpec::get_tag  )  const [inline]
 

Returns the identity tag associated with the DocumentSpec, if there is one.

It is an error to call this if has_tag() returns false.

The identity tag is set by the HTTP server to uniquely refer to a particular version of a document.

Definition at line 226 of file documentSpec.I.

References _date, has_date(), INLINE, and nassertr.

Referenced by output().

const URLSpec & DocumentSpec::get_url  )  const [inline]
 

Retrieves the URL of the DocumentSpec.

Definition at line 172 of file documentSpec.I.

References _tag, has_tag(), INLINE, and nassertr.

Referenced by output().

bool DocumentSpec::has_date  )  const [inline]
 

Returns true if a last-modified date is associated with the DocumentSpec.

Definition at line 273 of file documentSpec.I.

References _request_mode, and INLINE.

Referenced by get_tag(), and output().

bool DocumentSpec::has_tag  )  const [inline]
 

Returns true if an identity tag is associated with the DocumentSpec.

Definition at line 203 of file documentSpec.I.

References _date, _flags, and F_has_date.

Referenced by get_url(), and output().

bool DocumentSpec::input istream &  in  ) 
 

Can be used to read in the DocumentSpec from a stream generated either by output() or write().

Returns true on success, false on failure.

Definition at line 75 of file documentSpec.cxx.

References set_tag().

bool DocumentSpec::operator!= const DocumentSpec &  other  )  const [inline]
 

Definition at line 124 of file documentSpec.I.

References _url, INLINE, and url.

bool DocumentSpec::operator< const DocumentSpec &  other  )  const [inline]
 

Definition at line 136 of file documentSpec.I.

References _url, and INLINE.

void DocumentSpec::operator= const DocumentSpec &  copy  )  [inline]
 

Definition at line 95 of file documentSpec.I.

References compare_to(), and INLINE.

bool DocumentSpec::operator== const DocumentSpec &  other  )  const [inline]
 

Definition at line 112 of file documentSpec.I.

References compare_to(), and INLINE.

void DocumentSpec::output ostream &  out  )  const
 

Definition at line 128 of file documentSpec.cxx.

References get_date(), get_tag(), get_url(), has_date(), has_tag(), and indent().

void DocumentSpec::set_cache_control DocumentSpec::CacheControl  cache_control  )  [inline]
 

Specifies what kind of cached value is acceptable for this document.

Warning: some HTTP proxies may not respect this setting and may return a cached result anyway.

CC_allow_cache: the normal HTTP behavior; the server may return a cached value if it believes it is valid.

CC_revalidate: a proxy is forced to contact the origin server and verify that is cached value is in fact still valid before it returns it.

CC_no_cache: a proxy must not return its cached value at all, but is forced to go all the way back to the origin server for the official document.

The default mode is CC_allow_cache.

Definition at line 449 of file documentSpec.I.

void DocumentSpec::set_date const HTTPDate date  )  [inline]
 

Changes the last-modified date associated with the DocumentSpec.

Definition at line 257 of file documentSpec.I.

void DocumentSpec::set_request_mode DocumentSpec::RequestMode  request_mode  )  [inline]
 

Sets the request mode of this DocumentSpec.

This is only relevant when using the DocumentSpec to generate a request (for instance, in HTTPChannel). This specifies whether the document request will ask the server for a newer version than the indicated version, or the exact version, neither, or either.

The possible values are:

RM_any: ignore date and tag (if specified), and retrieve any document that matches the URL. For a subrange request, if the document matches the version indicated exactly, retrieve the subrange only; otherwise, retrieve the entire document.

RM_equal: request only the precise version of the document that matches the particular date and/or tag exactly, if specified; fail if this version is not available.

RM_newer: request any document that is newer than the version indicated by the particular date and/or tag; fail if only that version (or older versions) are available.

RM_newer_or_equal: request any document that matches the version indicated by the particular date and/or tag, or is a newer version; fail if only older versions are available.

In any of the above, you may specify either or both of the last-modified date and the identity tag, whichever is known to the client.

The default mode is RM_any.

Definition at line 387 of file documentSpec.I.

void DocumentSpec::set_tag const HTTPEntityTag tag  )  [inline]
 

Changes the identity tag associated with the DocumentSpec.

Definition at line 187 of file documentSpec.I.

References _flags, F_has_tag, and INLINE.

Referenced by input().

void DocumentSpec::set_url const URLSpec url  )  [inline]
 

Changes the URL of the DocumentSpec without modifying its other properties.

Normally this would be a strange thing to do, because the tag and date are usually strongly associated with the URL. To get a DocumentSpec pointing to a new URL, you would normally create a new DocumentSpec object.

Definition at line 159 of file documentSpec.I.

References _flags, F_has_tag, and INLINE.

void DocumentSpec::write ostream &  out,
int  indent_level = 0
const
 

Definition at line 148 of file documentSpec.cxx.


Member Data Documentation

CacheControl DocumentSpec::_cache_control [private]
 

Definition at line 103 of file documentSpec.h.

Referenced by clear_date(), and DocumentSpec().

HTTPDate DocumentSpec::_date [private]
 

Definition at line 101 of file documentSpec.h.

Referenced by DocumentSpec(), get_tag(), and has_tag().

int DocumentSpec::_flags [private]
 

Definition at line 109 of file documentSpec.h.

Referenced by DocumentSpec(), has_tag(), set_tag(), and set_url().

RequestMode DocumentSpec::_request_mode [private]
 

Definition at line 102 of file documentSpec.h.

Referenced by DocumentSpec(), get_date(), and has_date().

HTTPEntityTag DocumentSpec::_tag [private]
 

Definition at line 100 of file documentSpec.h.

Referenced by DocumentSpec(), and get_url().

URLSpec DocumentSpec::_url [private]
 

Definition at line 99 of file documentSpec.h.

Referenced by DocumentSpec(), operator!=(), and operator<().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:49:28 2003 for Panda by doxygen1.3