te::common::URL Class Reference

A class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web. A resource can be something as simple as a file or a directory, or it can be a reference to a more complicated object, such as a query to a database or to a search engine. This class is based on the MIT code uripp http://uripp.sourceforge.net/ . More...

#include <URL.h>

Public Types

typedef uri::path::const_iterator const_pathIterator
 path const iterator type More...
 
typedef uri::query::const_iterator const_queryIterator
 query const iterator type More...
 
typedef uri::query::iterator queryIterator
 query iterator type More...
 

Public Member Functions

Initializer Methods

Methods related to instantiation and destruction.

 URL ()
 Default constructor of a new URL. More...
 
 URL (const std::string &s)
 It initializes a new URL with the given valid string url. More...
 
 ~URL ()
 Destructor. More...
 
Accessor methods

Methods used to get or set properties.

std::string getString ()
 It returns URL string. More...
 
std::string getEncodedString ()
 It returns encoded URL string. More...
 
void setEncodedString (const std::string &)
 It sets the encoded URL string. More...
 
const std::string & getProtocol () const
 It returns the protocol. More...
 
void setProtocol (const std::string &s)
 It sets the protocol. More...
 
const std::string & getHost () const
 It returns the host. More...
 
void setHost (const std::string &s)
 It sets the host. More...
 
uri::authority::host_type_e getHostType () const
 It returns the host type. More...
 
unsigned short getHostPort () const
 It returns the host port. More...
 
void setHostPort (unsigned short p)
 It sets the host port. More...
 
std::string getLogin () const
 It returns the login. More...
 
void setLogin (const std::string &s)
 It sets the login. More...
 
std::string getPassword () const
 It returns the password. More...
 
void setPassword (const std::string &s)
 It sets the password. More...
 
std::string getPathString () const
 It returns the path. More...
 
std::string getEncodedPathString () const
 It returns the encoded path. More...
 
void setEncodedPathString (const std::string &path)
 It sets the encoded path. More...
 
void clearPath ()
 It cleans the path. More...
 
void addPath (const std::string &p)
 It adds the path. More...
 
bool isAbsolutePath () const
 It Checks if the path is absolute. More...
 
void setIsAbsolutePath (bool v)
 It sets the absolute path propertie. More...
 
bool isDirectoryPath () const
 It Checks if the path is directory. More...
 
void setIsDirectoryPath (bool v)
 It sets the directory path propertie. More...
 
bool isEmptyPath () const
 It Checks if the path is empty. More...
 
const_pathIterator beginPath () const
 It returns the begin const path iterator. More...
 
const_pathIterator endPath () const
 It returns the end const path iterator. More...
 
std::string getQueryString ()
 It returns the query string. More...
 
std::string getEncodedQueryString () const
 It returns the encoded query. More...
 
void setEncodedQueryString (const std::string &query)
 It sets the encoded query. More...
 
int getQuerySize () const
 It returns the query size. More...
 
void clearQuery ()
 It cleans the vector of queries. More...
 
void addQuery (const std::string &key, const std::string &value)
 It cleans the vector of queries. More...
 
queryIterator beginQuery ()
 It returns the begin query iterator. More...
 
queryIterator endQuery ()
 It returns the end query iterator. More...
 
const_queryIterator beginQuery () const
 It returns the begin const query iterator. More...
 
const_queryIterator endQuery () const
 It returns the end const query iterator. More...
 
te::common::URL::queryIterator findQueryKey (const std::string &key)
 it finds the key and return query iterator. More...
 
te::common::URL::const_queryIterator findQueryKey (const std::string &key) const
 it finds the key and return const query iterator. More...
 
std::string getFragmentString () const
 It returns the fragment. More...
 
std::string getEncodedFragmentString () const
 It returns encoded the fragment. More...
 
void setFragmentString (const std::string &f)
 It sets the fragment. More...
 
void setEncodedFragmentString (const std::string &f)
 It sets the encoded fragment. More...
 

Private Attributes

uri::uri m_uri
 

Detailed Description

A class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web. A resource can be something as simple as a file or a directory, or it can be a reference to a more complicated object, such as a query to a database or to a search engine. This class is based on the MIT code uripp http://uripp.sourceforge.net/ .

Definition at line 55 of file URL.h.

Member Typedef Documentation

path const iterator type

Definition at line 60 of file URL.h.

typedef uri::query::const_iterator te::common::URL::const_queryIterator

query const iterator type

Definition at line 59 of file URL.h.

typedef uri::query::iterator te::common::URL::queryIterator

query iterator type

Definition at line 58 of file URL.h.

Constructor & Destructor Documentation

te::common::URL::URL ( )

Default constructor of a new URL.

te::common::URL::URL ( const std::string &  s)

It initializes a new URL with the given valid string url.

Parameters
sThe valid encoded string url.
te::common::URL::~URL ( )

Destructor.

Member Function Documentation

void te::common::URL::addPath ( const std::string &  p)

It adds the path.

Parameters
pThe path string to be added.
Note
The input path string can not be encoded.
void te::common::URL::addQuery ( const std::string &  key,
const std::string &  value 
)

It cleans the vector of queries.

Parameters
queryThe query string.
Note
The input query string can not be encoded.
const_pathIterator te::common::URL::beginPath ( ) const

It returns the begin const path iterator.

Returns
The begin const path iterator.
queryIterator te::common::URL::beginQuery ( )

It returns the begin query iterator.

Returns
The begin query iterator.
const_queryIterator te::common::URL::beginQuery ( ) const

It returns the begin const query iterator.

Returns
The begin const query iterator.
void te::common::URL::clearPath ( )

It cleans the path.

void te::common::URL::clearQuery ( )

It cleans the vector of queries.

const_pathIterator te::common::URL::endPath ( ) const

It returns the end const path iterator.

Returns
The end const path iterator.
queryIterator te::common::URL::endQuery ( )

It returns the end query iterator.

Returns
The end query iterator.
const_queryIterator te::common::URL::endQuery ( ) const

It returns the end const query iterator.

Returns
The end const query iterator.
te::common::URL::queryIterator te::common::URL::findQueryKey ( const std::string &  key)

it finds the key and return query iterator.

Parameters
keyThe key to be found.
Returns
The query iterator.
te::common::URL::const_queryIterator te::common::URL::findQueryKey ( const std::string &  key) const

it finds the key and return const query iterator.

Parameters
keyThe key to be found.
Returns
The const query iterator.
std::string te::common::URL::getEncodedFragmentString ( ) const

It returns encoded the fragment.

Returns
The encoded fragment string.
std::string te::common::URL::getEncodedPathString ( ) const

It returns the encoded path.

Returns
The encoded path string.
std::string te::common::URL::getEncodedQueryString ( ) const

It returns the encoded query.

Returns
The encoded query string.
std::string te::common::URL::getEncodedString ( )

It returns encoded URL string.

Returns
The protocol.
std::string te::common::URL::getFragmentString ( ) const

It returns the fragment.

Returns
The fragment string.
const std::string& te::common::URL::getHost ( ) const

It returns the host.

Returns
The host.
unsigned short te::common::URL::getHostPort ( ) const

It returns the host port.

Returns
The host port.
uri::authority::host_type_e te::common::URL::getHostType ( ) const

It returns the host type.

Returns
The host type.
Note
it can be: null, DOMAIN_NAME, IP_ADDRESS or IPV6_ADDRESS
std::string te::common::URL::getLogin ( ) const

It returns the login.

Returns
The login.
std::string te::common::URL::getPassword ( ) const

It returns the password.

Returns
The login.
std::string te::common::URL::getPathString ( ) const

It returns the path.

Returns
The path string.
const std::string& te::common::URL::getProtocol ( ) const

It returns the protocol.

Returns
The protocol.
int te::common::URL::getQuerySize ( ) const

It returns the query size.

Returns
The query size.
std::string te::common::URL::getQueryString ( )

It returns the query string.

Returns
The query string.
std::string te::common::URL::getString ( )

It returns URL string.

Returns
The protocol.
bool te::common::URL::isAbsolutePath ( ) const

It Checks if the path is absolute.

Returns
True if the path is absolute, false otherwise.
bool te::common::URL::isDirectoryPath ( ) const

It Checks if the path is directory.

Returns
True if the path is directory, false otherwise.
bool te::common::URL::isEmptyPath ( ) const

It Checks if the path is empty.

Returns
True if the path is empty, false otherwise.
void te::common::URL::setEncodedFragmentString ( const std::string &  f)

It sets the encoded fragment.

Parameters
fThe encoded fragment string.
void te::common::URL::setEncodedPathString ( const std::string &  path)

It sets the encoded path.

Parameters
pathThe encoded path string.
void te::common::URL::setEncodedQueryString ( const std::string &  query)

It sets the encoded query.

Parameters
queryThe encoded query string.
void te::common::URL::setEncodedString ( const std::string &  )

It sets the encoded URL string.

Returns
The protocol.
void te::common::URL::setFragmentString ( const std::string &  f)

It sets the fragment.

Parameters
fThe fragment string.
void te::common::URL::setHost ( const std::string &  s)

It sets the host.

Parameters
sThe host.
void te::common::URL::setHostPort ( unsigned short  p)

It sets the host port.

Parameters
pThe host port.
void te::common::URL::setIsAbsolutePath ( bool  v)

It sets the absolute path propertie.

Parameters
vTrue for absolute path, false otherwise.
void te::common::URL::setIsDirectoryPath ( bool  v)

It sets the directory path propertie.

Parameters
vTrue for directory path, false otherwise.
void te::common::URL::setLogin ( const std::string &  s)

It sets the login.

Parameters
sThe login.
void te::common::URL::setPassword ( const std::string &  s)

It sets the password.

Parameters
sThe login.
void te::common::URL::setProtocol ( const std::string &  s)

It sets the protocol.

Parameters
sThe protocol

Member Data Documentation

uri::uri te::common::URL::m_uri
private

Definition at line 388 of file URL.h.


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