Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

Doc Class Reference

A class to contain document references. More...

List of all members.


Public Methods

 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)
const char * url () const
 Get the URL.

const char * urlBase () const
 Get the portion of the path likely to correspond to a file name without its extension.

const char * urlExt () const
 Get the portion of the path likely to correspond to a file name extension.

const char * urlPath () const
 Get the URL without the last component of the path.

const char * urlProtocol () const
 Get the URL scheme.

const char * urlModifier () const
 Get the fragment identifier.

const char * localName ()
 Get the fully qualified name of a local file that is the downloaded resource at d_url.

const char * localPath ()
 Get the path of the local file that is the downloaded resource at d_url.

FILE * fopen (const char *mode)
 Open a file.

void fclose ()
 Close a file.

std::ostream & outputStream ()
 Get an output stream for writing to the resource.


Private Methods

 Doc (Doc const &)
Doc & operator= (Doc const &)
bool filename (char *fn, int nfn)
 Converts a url into a local filename.


Private Attributes

char * d_url
 The URL.

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

FILE * d_fp
 A file descriptor for reading the local copy of the resource.

char * d_tmpfile
 Name of the temporary file created for the local copy of the resource.


Detailed Description

A class to contain document references.

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


Constructor & Destructor Documentation

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.

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.

~Doc  
 

Destructor.


Member Function Documentation

void fclose  
 

Close a file.

Closes the file opened with Doc::fopen.

bool 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.

FILE * 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.

const char * localName  
 

Get the fully qualified name of a local file that is the downloaded resource at d_url.

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

const char * localPath  
 

Get the path of the local file that is the downloaded resource at d_url.

Returns:
the path of the local file that is the downloaded resource at d_url.

std::ostream & outputStream  
 

Get an output stream for writing to the resource.

Returns:
an output stream.

void 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.

const char * url   const
 

Get the URL.

Returns:
the URL.

const char * urlBase   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 * urlExt   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 * urlModifier   const
 

Get the fragment identifier.

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

const char * urlPath   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 * urlProtocol   const
 

Get the URL scheme.

Returns:
the URL scheme.

Member Data Documentation

FILE * d_fp [private]
 

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

std::ostream * d_ostream [private]
 

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

char * d_tmpfile [private]
 

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

char * d_url [private]
 

The URL.