code::URL Class Reference

List of all members.

Detailed Description

A class for parsing, accessing, changing, and recombining a URL's components.

Compatability with RSS
URLs can be instantiated from strings containing an rssd pseudo-URL
or code's deprecated protocol-plus-rssd-URL:

Anatomy of a URL
The URL http://joe:blow@example.com:81/loc/script.php?var=val&foo=bar#here
has the following components, all of which correspond to fields in the URL class:
Author:
Charles Kerr
Version:
Id
code_URL.h,v 1.8 2009/06/02 20:17:40 lakshman Exp


Public Member Functions

 URL ()
 ~URL ()
 URL (const char *s)
 URL (const std::string &s)
URLoperator= (const std::string &)
URLoperator= (const char *s)
bool operator< (const URL &that) const
bool operator== (const URL &) const
bool operator!= (const URL &) const
URLoperator+= (const std::string &add)
std::string toString () const
 Returns a string form of the URL, much as you'd see in the URL entry field of a web browser.
std::string getBaseName () const
 Gets path's basename.
std::string getDirName () const
 Gets path's dirname.
std::string getSuffix () const
 Returns path's suffix.
std::string getSuffixLC () const
 Returns path's suffix in all lowercase.
std::string getQuery (const std::string &key) const
bool hasQuery (const std::string &key) const
bool empty () const
bool isLocal () const
void setQuery (const std::string &key, int val)
void setQuery (const std::string &key, const std::string &val)
void removeSuffix ()

Static Public Member Functions

static URL fromHostFileName (const std::string &host, const std::string &file)

Public Attributes

std::string scheme
 The scheme of the url, such as ftp, http, file, or rssd.
std::string user
 Optional username.
std::string pass
 Optional username.
std::string host
 Hostname of the machine to be accessed.
int port
 The port to connect to host on.
std::string path
 Path to the file, including directory and basename.
std::map< std::string, std::string > query
 Arguments to be passed along when accessing the URL.
std::string fragment
 Sub-part of the URL to skip to.

Friends

std::ostream & operator<< (std::ostream &, const code::URL &)


Constructor & Destructor Documentation

code::URL::URL (  )  [inline]

code::URL::~URL (  )  [inline]

code::URL::URL ( const char *  s  )  [inline]

code::URL::URL ( const std::string &  s  )  [inline]


Member Function Documentation

bool code::URL::empty (  )  const

static URL code::URL::fromHostFileName ( const std::string &  host,
const std::string &  file 
) [static]

std::string code::URL::getBaseName (  )  const

Gets path's basename.

For example, if path is /tmp/filename.txt.bz2, then filename.txt.bz2 will be returned.

See also:
OS::getDirName()

std::string code::URL::getDirName (  )  const

Gets path's dirname.

For example, if path is /tmp/filename.txt.bz2, then /tmp will be returned.

See also:
OS::getDirName()

std::string code::URL::getQuery ( const std::string &  key  )  const

std::string code::URL::getSuffix (  )  const

Returns path's suffix.

For example, if path is /tmp/filename.txt.bz2, then bz2 will be returned.

std::string code::URL::getSuffixLC (  )  const

Returns path's suffix in all lowercase.

For example, if path is /tmp/filename.txt.BZ2, then bz2 will be returned. This is to simplify string equality comparisons with getSuffix().

bool code::URL::hasQuery ( const std::string &  key  )  const [inline]

bool code::URL::isLocal (  )  const

bool code::URL::operator!= ( const URL  )  const

URL& code::URL::operator+= ( const std::string &  add  ) 

bool code::URL::operator< ( const URL that  )  const [inline]

URL& code::URL::operator= ( const char *  s  ) 

URL& code::URL::operator= ( const std::string &   ) 

bool code::URL::operator== ( const URL  )  const

void code::URL::removeSuffix (  )  [inline]

void code::URL::setQuery ( const std::string &  key,
const std::string &  val 
) [inline]

void code::URL::setQuery ( const std::string &  key,
int  val 
)

std::string code::URL::toString (  )  const

Returns a string form of the URL, much as you'd see in the URL entry field of a web browser.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const code::URL  
) [friend]


Member Data Documentation

std::string code::URL::fragment

Sub-part of the URL to skip to.

Currently unused by WDSSII.

std::string code::URL::host

Hostname of the machine to be accessed.

An empty string or localhost implies the file is local.

std::string code::URL::pass

Optional username.

Use if authentication is needed.

std::string code::URL::path

Path to the file, including directory and basename.

int code::URL::port

The port to connect to host on.

std::map< std::string, std::string > code::URL::query

Arguments to be passed along when accessing the URL.

std::string code::URL::scheme

The scheme of the url, such as ftp, http, file, or rssd.

std::string code::URL::user

Optional username.

Use if authentication is needed.


Generated on Fri May 4 13:40:13 2012 for WDSS-IIw2 by  doxygen 1.4.7