URL Class Reference

A class representing a URL (Uniform Resource Locator). More...

#include <URL.h++>

List of all members.

Public Member Functions

 URL ()
 Construct a new, empty URL.
 URL (const String &url)
 Construct a new URL for the given URL string.
 URL (const URL &other)
 Copy constructor.
 ~URL () throw ()
 Destructor.
void setScheme (const String &scheme)
 Set the scheme component of the URL.
String getScheme () const
 Get the scheme component of the URL.
void setHost (const String &host)
 Set the hostname component of the URL.
String getHost () const
 Get the hostname component of the URL.
void setPort (uint16_t port) throw ()
 Set the port number for the URL.
uint16_t getPort () const throw ()
 Get the port number for the URL.
void setPath (const String &path)
 Set the path component of the URL.
String getPath () const
 Get the path component of the URL.
String getCanonicalPath () const
 Get the path component of the URL, in canonicalized form.
void setQuery (const String &query)
 Set the query component of the URL.
String getQuery () const
 Get the query component of the URL.
bool isValid () const throw ()
 Test if the URL is valid.
String toString () const
 Get a String representation of the URL.
bool operator== (const URL &other) const throw ()
 Equality operator.
bool operator!= (const URL &other) const throw ()
 Inequality operator.
URLoperator= (const String &other)
 Assignment operator.
URLoperator= (const URL &other)
 Assignment operator.

Static Public Member Functions

static String encode (const String &str)
 URL-encode a String.
static String decode (const String &str)
 Decode a URL-encoded String.

Detailed Description

A class representing a URL (Uniform Resource Locator).

This class will parse simple, common URLs, but is not a fully-conformant URL parser.

Author:
Mark Lindner

Constructor & Destructor Documentation

URL (  ) 

Construct a new, empty URL.

URL ( const String url  ) 

Construct a new URL for the given URL string.

URL ( const URL other  ) 

Copy constructor.

~URL (  )  throw ()

Destructor.


Member Function Documentation

String decode ( const String str  )  [static]

Decode a URL-encoded String.

Parameters:
str The string to decode.
Returns:
THe decoded form.
String encode ( const String str  )  [static]

URL-encode a String.

Parameters:
str The string to encode.
Returns:
The encoded form.
String getCanonicalPath (  )  const [inline]

Get the path component of the URL, in canonicalized form.

String getHost (  )  const [inline]

Get the hostname component of the URL.

String getPath (  )  const [inline]

Get the path component of the URL.

uint16_t getPort (  )  const throw () [inline]

Get the port number for the URL.

Returns 0 if no port number was specified.

String getQuery (  )  const [inline]

Get the query component of the URL.

Returns:
The query, in its original, URL-encoded form.
String getScheme (  )  const [inline]

Get the scheme component of the URL.

bool isValid (  )  const throw ()

Test if the URL is valid.

bool operator!= ( const URL other  )  const throw () [inline]

Inequality operator.

URL & operator= ( const URL other  ) 

Assignment operator.

URL & operator= ( const String other  ) 

Assignment operator.

bool operator== ( const URL other  )  const throw ()

Equality operator.

void setHost ( const String host  )  [inline]

Set the hostname component of the URL.

void setPath ( const String path  ) 

Set the path component of the URL.

void setPort ( uint16_t  port  )  throw () [inline]

Set the port number for the URL.

A value of 0 indicates no port number.

void setQuery ( const String query  )  [inline]

Set the query component of the URL.

Parameters:
query The query, in URL-encoded form.
void setScheme ( const String scheme  )  [inline]

Set the scheme component of the URL.

String toString (  )  const

Get a String representation of the URL.


The documentation for this class was generated from the following files:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3