url Class Reference

This class represents a Uniform Resource Locator (a pointer to a "resource" on the World Wide Web). More...

Collaboration diagram for url:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 url (const string &s)
 url (const url &u)
 url (const string &protocol, const string &host, const port_t port=UNSPECIFIED_PORT, const string &path="", const string &username="", const string &password="")
const stringgetProtocol () const
void setProtocol (const string &protocol)
const stringgetUsername () const
void setUsername (const string &username)
const stringgetPassword () const
void setPassword (const string &password)
const stringgetHost () const
void setHost (const string &host)
port_t getPort () const
void setPort (const port_t port)
const stringgetPath () const
void setPath (const string &path)
const propertySetgetParams () const
propertySetgetParams ()
 operator string () const
urloperator= (const url &u)
urloperator= (const string &s)

Static Public Attributes

static const port_t UNSPECIFIED_PORT = static_cast <port_t>(-1)
static const string PROTOCOL_FILE = "file"
static const string PROTOCOL_HTTP = "http"
static const string PROTOCOL_FTP = "ftp"

Detailed Description

This class represents a Uniform Resource Locator (a pointer to a "resource" on the World Wide Web).


Constructor & Destructor Documentation

url ( const string s  ) 

Construct an URL from a string (parse the URL components).

Parameters:
s full URL string (eg. http://www.vmime.org:80/download.html)
Exceptions:
exceptions::malformed_url if URL is malformed
url ( const url u  ) 

Construct an URL from another URL object.

Parameters:
u other URL object
url ( const string protocol,
const string host,
const port_t  port = UNSPECIFIED_PORT,
const string path = "",
const string username = "",
const string password = "" 
)

Construct an URL from the components.

Parameters:
protocol protocol (eg. "http", "ftp"...)
host host name (eg. "vmime.sourceforge.net", "123.45.67.89")
port optional port number (eg. 80, 110 or UNSPECIFIED_PORT to mean "default")
path optional full path (eg. "download.html")
username optional user name
password optional user password

References url::operator=().


Member Function Documentation

const string & getHost (  )  const

Return the host name of the URL (server name or IP address).

Returns:
host name

Referenced by serviceFactory::create().

propertySet & getParams (  ) 

Return the parameters of the URL.

Returns:
parameters
const propertySet & getParams (  )  const

Return the parameters of the URL (read-only).

Returns:
parameters
const string & getPassword (  )  const

Return the password specified in the URL or empty if not specified.

Returns:
user password

Referenced by serviceFactory::create().

const string & getPath (  )  const

Return the path portion of the URL, or empty if not specified.

Returns:
path

Referenced by serviceFactory::create().

port_t getPort (  )  const

Return the port of the URL, or url::UNSPECIFIED_PORT if the default port if used.

Returns:
server port

Referenced by serviceFactory::create().

const string & getProtocol (  )  const

Return the protocol of the URL (eg: "http").

Returns:
protocol of the URL

Referenced by serviceFactory::create().

const string & getUsername (  )  const

Return the username specified in the URL or empty if not specified.

Returns:
user name

Referenced by serviceFactory::create().

operator string (  )  const

Build a string URL from this object.

url & operator= ( const string s  ) 
url & operator= ( const url u  ) 

Referenced by url::url().

void setHost ( const string host  ) 

Set the host name of the URL.

Parameters:
host server name or IP address
void setPassword ( const string password  ) 

Set the password of the URL.

Parameters:
password user password
void setPath ( const string path  ) 

Set the part portion of the URL.

Parameters:
path path
void setPort ( const port_t  port  ) 

Set the port of the URL.

Parameters:
port server port or url::UNSPECIFIED_PORT to use the default port of the protocol
void setProtocol ( const string protocol  ) 

Set the protocol of the URL.

Parameters:
protocol new protocol (eg: "http")
void setUsername ( const string username  ) 

Set the username of the URL.

Parameters:
username user name

Member Data Documentation

const string PROTOCOL_FILE = "file" [static]

Standard name for FILE protocol (local file-system).

const string PROTOCOL_FTP = "ftp" [static]

Standard name for FTP protocol.

const string PROTOCOL_HTTP = "http" [static]

Standard name for HTTP protocol.

const port_t UNSPECIFIED_PORT = static_cast <port_t>(-1) [static]

Means "port not specified" (use default port).

Referenced by serviceFactory::create().


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

Generated by  doxygen 1.6.2