Home | Download | Screen shots | Discussion | Documentation
--- | --- | --- | --- | ---

Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

# openvrml::doc Class Reference

List of all members.

## Detailed Description

A class to contain document references.

This is just a shell until a real http protocol library is found...

## Public Member Functions
| doc (const std::string &url=std::string(), const doc *relative=0)
| Constructor.
| doc (const std::string &url, const doc2 *relative)
| Constructor.
| ~doc ()
| Destructor.
void | seturl (const char *url, const doc *relative=0)
| Set the URL.
void | seturl (const char *url, const doc2 *relative=0)
| Set the URL.
const char * | url () const
| Get the URL.
const char * | url_base () const
| Get the portion of the path likely to correspond to a file name without its extension.
const char * | url_ext () const
| Get the portion of the path likely to correspond to a file name extension.
const char * | url_path () const
| Get the URL without the last component of the path.
const char * | url_protocol () const
| Get the URL scheme.
const char * | url_modifier () const
| Get the fragment identifier.
const char * | local_name ()
| Get the fully qualified name of a local file that is the downloaded resource at url_.
const char * | local_path ()
| Get the path of the local file that is the downloaded resource at url_.
FILE * | fopen (const char *mode)
| Open a file.
void | fclose ()
| Close a file.
std::ostream & | output_stream ()
| Get an output stream for writing to the resource.
## Private Member Functions
bool | filename (char *fn, int nfn)
| Converts a url into a local filename.
## Private Attributes
char * | url_
| The URL.
std::ostream * | out_
| A pointer to a std::ostream used for writing the resource.
FILE * | fp_
| A file descriptor for reading the local copy of the resource.
char * | tmpfile_
| Name of the temporary file created for the local copy of the resource.

## Constructor & Destructor Documentation

openvrml::doc::doc | ( | const std::string & | url = `std::string()`,
|  | const doc * | relative = `0`
| ) | `[explicit]`

  | Constructor. Parameters:
  | url | an HTTP or file URL.
  | relative | the doc that `url` is relative to, or 0 if `url` is an absolute URL.

openvrml::doc::doc | ( | const std::string & | url,
|  | const doc2 * | relative
| ) |

  | Constructor. Parameters:
  | url | an HTTP or file URL.
  | relative | the doc2 that `url` is relative to, or 0 if `url` is an absolute URL.

openvrml::doc::~doc | ( |  | ) |

| Destructor.

## Member Function Documentation

void openvrml::doc::seturl | ( | const char * | url,
|  | const doc * | relative = `0`
| ) |

  | Set the URL. Parameters:
  | url | the new URL.
  | relative | the doc that `url` is relative to, or 0 if `url` is an absolute URL.

void openvrml::doc::seturl | ( | const char * | url,
|  | const doc2 * | relative = `0`
| ) |

  | Set the URL. Parameters:
  | url | the new URL.
  | relative | the doc2 that `url` is relative to, or 0 if `url` is an absolute URL.

const char * openvrml::doc::url | ( |  | ) | const

| Get the URL. Returns: the URL.

const char * openvrml::doc::url_base | ( |  | ) | const

| Get the portion of the path likely to correspond to a file name without its extension. Returns: the portion of the last path element preceding the last '.' in the path, or an empty string if the last path element is empty.

const char * openvrml::doc::url_ext | ( |  | ) | const

| Get the portion of the path likely to correspond to a file name extension. Returns: the portion of the last path element succeeding the last '.' in the path, or an empty string if the last path element includes no '.'.

const char * openvrml::doc::url_path | ( |  | ) | const

| Get the URL without the last component of the path. In spite of its name, this method does not return the URL's path. Returns: the portion of the URL including the scheme, the authority, and all but the last component of the path.

const char * openvrml::doc::url_protocol | ( |  | ) | const

| Get the URL scheme. Returns: the URL scheme.

const char * openvrml::doc::url_modifier | ( |  | ) | const

| Get the fragment identifier. Returns: the fragment identifier, including the leading '#', or an empty string if there is no fragment identifier.

const char * openvrml::doc::local_name | ( |  | ) |

| Get the fully qualified name of a local file that is the downloaded resource at url_. Returns: the fully qualified name of a local file that is the downloaded resource at url_.

const char * openvrml::doc::local_path | ( |  | ) |

| Get the path of the local file that is the downloaded resource at url_. Returns: the path of the local file that is the downloaded resource at url_.

FILE * openvrml::doc::fopen | ( | const char * | mode | ) |

| Open a file. Returns: a pointer to a FILE struct for the opened file. Having both fopen and outputStream is dumb.

void openvrml::doc::fclose | ( |  | ) |

| Close a file. Closes the file opened with doc::fopen.

std::ostream & openvrml::doc::output_stream | ( |  | ) |

| Get an output stream for writing to the resource. Returns: an output stream.

bool openvrml::doc::filename | ( | char * | fn,
|  | int | nfn
| ) | `[private]`

  | Converts a url into a local filename. Return values:
  | fn | a character buffer to hold the local filename.
  Parameters:
  | nfn | the number of elements in the buffer `fn` points to.

## Member Data Documentation

char * openvrml::doc::url_`[private]`

| The URL.

std::ostream * openvrml::doc::out_`[private]`

| A pointer to a std::ostream used for writing the resource.

FILE * openvrml::doc::fp_`[private]`

| A file descriptor for reading the local copy of the resource.

char * openvrml::doc::tmpfile_`[private]`

| Name of the temporary file created for the local copy of the resource.