Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::URL Class Reference

The URL class wraps a string that points to some resource, either on the local filesystem or over the internet. More...

#include <vcf/InternetKit/URL.h>

Inheritance diagram for VCF::URL:

VCF::Object VCF::AsyncURL List of all members.

Public Types

enum  UrlParts {
  upScheme = 0, upUser, upPassword, upHost,
  upPort, upUrlPath, upTotalCount
}
 An enum compreising the various component parts of the URL. More...
enum  Events {
  evDataReceiving = 0x23123, evDataReceived, evDataComplete, evStatusChanged,
  evAuthenticationRequested, evDataError
}
 The possible event types that can be fired by the URL when downloading a file. More...

Public Member Functions

 URL ()
 URL (const String &urlString)
URLoperator= (const String &rhs)
 Assign a string to the URL.
 operator String () const
String getURLString () const
void download (OutputStream &stream)
 Start downloading the URL into the OutputStream.
void downloadToFile (const String &fileName)
 Download the URL to the specific filename.
String getScheme () const
 Returns the scheme component of the URL.
String getUser () const
 Returns the user component of the URL.
String getPassword () const
 Returns the password component of the URL.
String getHost () const
 Returns the host component of the URL.
String getPort () const
 Returns the port component of the URL.
String getUrlPath () const
 Returns the url path component of the URL.
std::vector< StringgetParts () const
 Returns all the components of the URL in a vector.
bool validate () const
 Verify the URL is actually valid.

Public Attributes

VCF::Delegate URLDelegate
 DataReceiving
 DataReceived
 DataComplete
 DataError
 StatusChanged
VCF::Delegate URLAuthenticationDelegate
 AuthenticationRequested

Protected Member Functions

virtual String parseScheme (String &data, bool validate=false) const
void parse (std::vector< String > *parts=NULL, bool validate=false) const

Protected Attributes

String data_

Detailed Description

The URL class wraps a string that points to some resource, either on the local filesystem or over the internet.

The URL also has delegates that fire events as data is received, when status changes during the download, and when authentication is requested in the form of a username and password.

The URL can also break the string representation into it's component parts. See http://www.faqs.org/rfcs/rfc1738.html for more information about the exact parts of a URL string.


Member Enumeration Documentation

enum VCF::URL::Events
 

The possible event types that can be fired by the URL when downloading a file.

Enumerator:
evDataReceiving  The URL is about to receive some data.
evDataReceived  The URL has received a chunk of data and written to a the output stream.
evDataComplete  The URL has received all of the data for the resource.
evStatusChanged  The status of the URL download has changed.
evAuthenticationRequested  The URL requires authentication.

The handler will need to supply a valid user name and password.

evDataError  There was an error while getting data for the URL.

enum VCF::URL::UrlParts
 

An enum compreising the various component parts of the URL.

Enumerator:
upScheme  The scheme of the URL.

These can include things like "http", "ftp", and so on.

Required
upUser  The user name for the resource.

Used for authentication purposes. Unless you're using an SSL connection there's a good chance this is being sent in the clear.

Optional
upPassword  The password for the resource.

Used for authentication purposes. Unless you're using an SSL connection there's a good chance this is being sent in the clear.

Optional
upHost  The host name for the resource.

This would be things like "www.google.com", or "vcf-online.org", or even an IP address like "192.45.66.121".

Required
upPort  The port to use to make a connection to the host.

Optional
upUrlPath  The path to the resource.

Required
upTotalCount  The total number of possible URL components.


Constructor & Destructor Documentation

VCF::URL::URL  )  [inline]
 

VCF::URL::URL const String urlString  )  [inline]
 


Member Function Documentation

void VCF::URL::download OutputStream stream  )  [inline]
 

Start downloading the URL into the OutputStream.

The InternetToolKit will extract the data and write it to the output stream. During this process various events may get fired.

If the URL was not able to access the data, a URLException may be thrown.

void VCF::URL::downloadToFile const String fileName  )  [inline]
 

Download the URL to the specific filename.

The InternetToolKit will extract the data and write it to the file. During this process various events may get fired.

If the URL was not able to access the data, a URLException may be thrown.

String VCF::URL::getHost  )  const [inline]
 

Returns the host component of the URL.

std::vector<String> VCF::URL::getParts  )  const [inline]
 

Returns all the components of the URL in a vector.

String VCF::URL::getPassword  )  const [inline]
 

Returns the password component of the URL.

String VCF::URL::getPort  )  const [inline]
 

Returns the port component of the URL.

String VCF::URL::getScheme  )  const [inline]
 

Returns the scheme component of the URL.

String VCF::URL::getUrlPath  )  const [inline]
 

Returns the url path component of the URL.

String VCF::URL::getURLString  )  const [inline]
 

String VCF::URL::getUser  )  const [inline]
 

Returns the user component of the URL.

VCF::URL::operator String  )  const [inline]
 

URL& VCF::URL::operator= const String rhs  )  [inline]
 

Assign a string to the URL.

void VCF::URL::parse std::vector< String > *  parts = NULL,
bool  validate = false
const [inline, protected]
 

virtual String VCF::URL::parseScheme String data,
bool  validate = false
const [inline, protected, virtual]
 

bool VCF::URL::validate  )  const [inline]
 

Verify the URL is actually valid.

If the URL is invalid the function returns false, otherwise it returns true.


Member Data Documentation

VCF::URL::AuthenticationRequested
 

String VCF::URL::data_ [protected]
 

VCF::URL::DataComplete
 

VCF::URL::DataError
 

VCF::URL::DataReceived
 

VCF::URL::DataReceiving
 

VCF::URL::StatusChanged
 

VCF::Delegate VCF::URL::URLAuthenticationDelegate
 

VCF::Delegate VCF::URL::URLDelegate
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information