| Home | Download | Screen shots | Discussion | Documentation |
|---|
doc2 is a hack of doc. When the ANTLR parser was added to OpenVRML, a doc work-alike was needed that would read from a std::istream instead of a C FILE *. doc2's purpose is to fill that need, and to remind us through its ugliness just how badly both it and doc need to be replaced with an I/O solution that doesn't suck.
Public Member Functions | |
| doc2 (const std::string &url=std::string(), const doc2 *relative=0) | |
| Constructor. | |
| ~doc2 () | |
| Destructor. | |
| void | seturl (const std::string &url, const doc2 *relative=0) |
| Set the URL. | |
| const std::string | url () const |
| Get the URL. | |
| const std::string | url_base () const |
| Get the portion of the path likely to correspond to a file name without its extension. | |
| const std::string | url_ext () const |
| Get the portion of the path likely to correspond to a file name extension. | |
| const std::string | url_path () const |
| Get the URL without the last component of the path. | |
| const std::string | url_protocol () const |
| Get the URL scheme. | |
| const std::string | 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_. | |
| std::istream & | input_stream () |
| Get an input stream for the resource. | |
| std::ostream & | output_stream () |
| Get an output stream for the resource. | |
Private Member Functions | |
| bool | filename (char *fn, size_t nfn) |
| Converts a url into a local filename. | |
Private Attributes | |
| std::string | url_ |
| The URL. | |
| char * | tmpfile_ |
| Name of the temporary file created for the local copy of the resource. | |
| std::istream * | istm_ |
| A file descriptor for reading the local copy of the resource. | |
| std::ostream * | ostm_ |
| A pointer to a std::ostream used for writing the resource. | |
| openvrml::doc2::doc2 | ( | const std::string & | url = std::string(), |
|
| const doc2 * | relative = 0 | |||
| ) | [explicit] |
Constructor.
| url | an HTTP or file URL. | |
| relative | the doc2 that url is relative to, or 0 if url is an absolute URL. |
| openvrml::doc2::~doc2 | ( | ) |
Destructor.
| void openvrml::doc2::seturl | ( | const std::string & | url, | |
| const doc2 * | relative = 0 | |||
| ) |
Set the URL.
| url | the new URL. | |
| relative | the doc2 that url is relative to, or 0 if url is an absolute URL. |
| const std::string openvrml::doc2::url | ( | ) | const |
Get the URL.
| const std::string openvrml::doc2::url_base | ( | ) | const |
Get the portion of the path likely to correspond to a file name without its extension.
| const std::string openvrml::doc2::url_ext | ( | ) | const |
Get the portion of the path likely to correspond to a file name extension.
| const std::string openvrml::doc2::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.
| const std::string openvrml::doc2::url_protocol | ( | ) | const |
Get the URL scheme.
| const std::string openvrml::doc2::url_modifier | ( | ) | const |
Get the fragment identifier.
| const char * openvrml::doc2::local_name | ( | ) |
Get the fully qualified name of a local file that is the downloaded resource at url_.
| const char * openvrml::doc2::local_path | ( | ) |
Get the path of the local file that is the downloaded resource at url_.
| std::istream & openvrml::doc2::input_stream | ( | ) |
Get an input stream for the resource.
| std::ostream & openvrml::doc2::output_stream | ( | ) |
Get an output stream for the resource.
| bool openvrml::doc2::filename | ( | char * | fn, | |
| size_t | nfn | |||
| ) | [private] |
Converts a url into a local filename.
| fn | a character buffer to hold the local filename. |
| nfn | the number of elements in the buffer fn points to. |
char * openvrml::doc2::url_ [private] |
The URL.
char * openvrml::doc2::tmpfile_ [private] |
Name of the temporary file created for the local copy of the resource.
std::istream * openvrml::doc2::istm_ [private] |
A file descriptor for reading the local copy of the resource.
std::ostream * openvrml::doc2::ostm_ [private] |
A pointer to a std::ostream used for writing the resource.