Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
DocumentSpec Class Reference

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

`#include "documentSpec.h"`

## Public Types
enum | CacheControl { CC_allow_cache , CC_revalidate , CC_no_cache }
enum | RequestMode { RM_any , RM_equal , RM_newer , RM_equal_or_newer }

## Public Member Functions
| DocumentSpec (const DocumentSpec &copy)
| DocumentSpec (const std::string &url)
| DocumentSpec (const URLSpec &url)
void | clear_date ()
void | clear_tag ()
int | compare_to (const DocumentSpec &other) const
CacheControl | get_cache_control () const
const HTTPDate & | get_date () const
RequestMode | get_request_mode () const
const HTTPEntityTag & | get_tag () const
const URLSpec & | get_url () const
bool | has_date () const
bool | has_tag () const
bool | input (std::istream &in)
| Can be used to read in the DocumentSpec from a stream generated either by output() or write().
bool | operator!= (const DocumentSpec &other) const
bool | operator< (const DocumentSpec &other) const
void | operator= (const DocumentSpec &copy)
bool | operator== (const DocumentSpec &other) const
void | output (std::ostream &out) const
void | set_cache_control (CacheControl cache_control)
void | set_date (const HTTPDate &date)
void | set_request_mode (RequestMode request_mode)
void | set_tag (const HTTPEntityTag &tag)
void | set_url (const URLSpec &url)
void | write (std::ostream &out, int indent_level=0) const

## Public Attributes
| clear_date
| Removes the last-modified date associated with the DocumentSpec, if there is one.
| clear_tag
| Removes the identity tag associated with the DocumentSpec, if there is one.
| get_cache_control
| Returns the request mode of this DocumentSpec.
| get_date
| Returns the last-modified date associated with the DocumentSpec, if there is one.
| get_request_mode
| Returns the request mode of this DocumentSpec.
| get_tag
| Returns the identity tag associated with the DocumentSpec, if there is one.
| get_url
| Retrieves the URL of the DocumentSpec.
| has_date
| Returns true if a last-modified date is associated with the DocumentSpec.
| has_tag
| Returns true if an identity tag is associated with the DocumentSpec.
| set_cache_control
| Specifies what kind of cached value is acceptable for this document.
| set_date
| Changes the last-modified date associated with the DocumentSpec.
| set_request_mode
| Sets the request mode of this DocumentSpec.
| set_tag
| Changes the identity tag associated with the DocumentSpec.
| set_url
| Changes the URL of the DocumentSpec without modifying its other properties.

## 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 30 of file documentSpec.h.

## Member Enumeration Documentation

## ◆ CacheControl

enum DocumentSpec::CacheControl

Definition at line 66 of file documentSpec.h.

## ◆ RequestMode

enum DocumentSpec::RequestMode

Definition at line 56 of file documentSpec.h.

## Constructor & Destructor Documentation

## ◆ DocumentSpec() [1/4]

DocumentSpec::DocumentSpec | ( |  | ) |
| inline

Definition at line 17 of file documentSpec.I.

## ◆ DocumentSpec() [2/4]

DocumentSpec::DocumentSpec | ( | const std::string & | url | ) |
| inline

Definition at line 27 of file documentSpec.I.

## ◆ DocumentSpec() [3/4]

DocumentSpec::DocumentSpec | ( | const URLSpec & | url | ) |
| inline

Definition at line 39 of file documentSpec.I.

## ◆ DocumentSpec() [4/4]

DocumentSpec::DocumentSpec | ( | const DocumentSpec & | copy | ) |
| inline

Definition at line 51 of file documentSpec.I.

## Member Function Documentation

## ◆ compare_to()

int DocumentSpec::compare_to | ( | const DocumentSpec & | other | ) | const

Definition at line 21 of file documentSpec.cxx.

## ◆ input()

bool DocumentSpec::input | ( | std::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 53 of file documentSpec.cxx.

References get_date, set_date, and set_tag.

## ◆ operator!=()

bool DocumentSpec::operator!= | ( | const DocumentSpec & | other | ) | const
| inline

Definition at line 86 of file documentSpec.I.

## ◆ operator<()

bool DocumentSpec::operator< | ( | const DocumentSpec & | other | ) | const
| inline

Definition at line 94 of file documentSpec.I.

## ◆ operator=()

void DocumentSpec::operator= | ( | const DocumentSpec & | copy | ) |
| inline

Definition at line 65 of file documentSpec.I.

## ◆ operator==()

bool DocumentSpec::operator== | ( | const DocumentSpec & | other | ) | const
| inline

Definition at line 78 of file documentSpec.I.

## ◆ output()

void DocumentSpec::output | ( | std::ostream & | out | ) | const

Definition at line 101 of file documentSpec.cxx.

## ◆ write()

void DocumentSpec::write | ( | std::ostream & | out,
|  | int | indent_level = 0 ) const

Definition at line 116 of file documentSpec.cxx.

## Member Data Documentation

## ◆ clear_date

void DocumentSpec::clear_date
| inline

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

Definition at line 82 of file documentSpec.h.

## ◆ clear_tag

void DocumentSpec::clear_tag
| inline

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

Definition at line 81 of file documentSpec.h.

## ◆ get_cache_control

DocumentSpec::CacheControl DocumentSpec::get_cache_control
| inline

Returns the request mode of this DocumentSpec.

See set_cache_control().

Definition at line 85 of file documentSpec.h.

## ◆ get_date

const HTTPDate & DocumentSpec::get_date
| 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 82 of file documentSpec.h.

Referenced by input().

## ◆ get_request_mode

DocumentSpec::RequestMode DocumentSpec::get_request_mode
| inline

Returns the request mode of this DocumentSpec.

See set_request_mode().

Definition at line 84 of file documentSpec.h.

## ◆ get_tag

const HTTPEntityTag & DocumentSpec::get_tag
| 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 81 of file documentSpec.h.

## ◆ get_url

const URLSpec & DocumentSpec::get_url
| inline

Retrieves the URL of the DocumentSpec.

Definition at line 80 of file documentSpec.h.

## ◆ has_date

bool DocumentSpec::has_date
| inline

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

Definition at line 82 of file documentSpec.h.

## ◆ has_tag

bool DocumentSpec::has_tag
| inline

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

Definition at line 81 of file documentSpec.h.

## ◆ set_cache_control

void DocumentSpec::set_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 85 of file documentSpec.h.

## ◆ set_date

void DocumentSpec::set_date
| inline

Changes the last-modified date associated with the DocumentSpec.

Definition at line 82 of file documentSpec.h.

Referenced by input().

## ◆ set_request_mode

void DocumentSpec::set_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 84 of file documentSpec.h.

## ◆ set_tag

void DocumentSpec::set_tag
| inline

Changes the identity tag associated with the DocumentSpec.

Definition at line 81 of file documentSpec.h.

Referenced by input().

## ◆ set_url

void DocumentSpec::set_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 80 of file documentSpec.h.

The documentation for this class was generated from the following files:

- panda/src/downloader/documentSpec.h
- panda/src/downloader/documentSpec.cxx
- panda/src/downloader/documentSpec.I