All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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.

Definition at line 48 of file URL.cpp.

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.

Definition at line 52 of file URL.cpp.

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

Destructor.

Definition at line 64 of file URL.cpp.

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.

Definition at line 367 of file URL.cpp.

References te::common::uri::path::path().

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.

Definition at line 541 of file URL.cpp.

References te::common::uri::query::query().

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

It returns the begin const path iterator.

Returns
The begin const path iterator.

Definition at line 442 of file URL.cpp.

References te::common::uri::path::begin(), and te::common::uri::path::path().

te::common::URL::queryIterator te::common::URL::beginQuery ( )

It returns the begin query iterator.

Returns
The begin query iterator.

Definition at line 554 of file URL.cpp.

References te::common::uri::query::query().

te::common::URL::const_queryIterator te::common::URL::beginQuery ( ) const

It returns the begin const query iterator.

Returns
The begin const query iterator.

Definition at line 580 of file URL.cpp.

References te::common::uri::query::query().

void te::common::URL::clearPath ( )

It cleans the path.

Definition at line 354 of file URL.cpp.

References te::common::uri::path::clear(), and te::common::uri::path::path().

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

It cleans the vector of queries.

Definition at line 528 of file URL.cpp.

References te::common::uri::query::query().

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

It returns the end const path iterator.

Returns
The end const path iterator.

Definition at line 455 of file URL.cpp.

References te::common::uri::path::end(), and te::common::uri::path::path().

te::common::URL::queryIterator te::common::URL::endQuery ( )

It returns the end query iterator.

Returns
The end query iterator.

Definition at line 567 of file URL.cpp.

References te::common::uri::query::query().

te::common::URL::const_queryIterator te::common::URL::endQuery ( ) const

It returns the end const query iterator.

Returns
The end const query iterator.

Definition at line 593 of file URL.cpp.

References te::common::uri::query::query().

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.

Definition at line 606 of file URL.cpp.

References te::common::uri::query::find(), and te::common::uri::query::query().

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.

Definition at line 620 of file URL.cpp.

References te::common::uri::query::find(), and te::common::uri::query::query().

std::string te::common::URL::getEncodedFragmentString ( ) const

It returns encoded the fragment.

Returns
The encoded fragment string.

Definition at line 646 of file URL.cpp.

std::string te::common::URL::getEncodedPathString ( ) const

It returns the encoded path.

Returns
The encoded path string.

Definition at line 329 of file URL.cpp.

std::string te::common::URL::getEncodedQueryString ( ) const

It returns the encoded query.

Returns
The encoded query string.

Definition at line 491 of file URL.cpp.

std::string te::common::URL::getEncodedString ( )
std::string te::common::URL::getFragmentString ( ) const

It returns the fragment.

Returns
The fragment string.

Definition at line 634 of file URL.cpp.

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

It returns the host.

Returns
The host.

Definition at line 202 of file URL.cpp.

unsigned short te::common::URL::getHostPort ( ) const

It returns the host port.

Returns
The host port.

Definition at line 242 of file URL.cpp.

te::common::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

Definition at line 230 of file URL.cpp.

std::string te::common::URL::getLogin ( ) const

It returns the login.

Returns
The login.

Definition at line 267 of file URL.cpp.

std::string te::common::URL::getPassword ( ) const

It returns the password.

Returns
The login.

Definition at line 292 of file URL.cpp.

std::string te::common::URL::getPathString ( ) const

It returns the path.

Returns
The path string.

Definition at line 317 of file URL.cpp.

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

It returns the protocol.

Returns
The protocol.

Definition at line 176 of file URL.cpp.

int te::common::URL::getQuerySize ( ) const

It returns the query size.

Returns
The query size.

Definition at line 516 of file URL.cpp.

std::string te::common::URL::getQueryString ( )

It returns the query string.

Returns
The query string.

Definition at line 468 of file URL.cpp.

std::string te::common::URL::getString ( )
bool te::common::URL::isAbsolutePath ( ) const

It Checks if the path is absolute.

Returns
True if the path is absolute, false otherwise.

Definition at line 380 of file URL.cpp.

bool te::common::URL::isDirectoryPath ( ) const

It Checks if the path is directory.

Returns
True if the path is directory, false otherwise.

Definition at line 405 of file URL.cpp.

bool te::common::URL::isEmptyPath ( ) const

It Checks if the path is empty.

Returns
True if the path is empty, false otherwise.

Definition at line 430 of file URL.cpp.

void te::common::URL::setEncodedFragmentString ( const std::string &  f)

It sets the encoded fragment.

Parameters
fThe encoded fragment string.

Definition at line 672 of file URL.cpp.

References te::common::uri::fragment::fragment().

void te::common::URL::setEncodedPathString ( const std::string &  path)

It sets the encoded path.

Parameters
pathThe encoded path string.

Definition at line 341 of file URL.cpp.

References te::common::uri::path::path().

void te::common::URL::setEncodedQueryString ( const std::string &  query)

It sets the encoded query.

Parameters
queryThe encoded query string.

Definition at line 503 of file URL.cpp.

References te::common::uri::query::query().

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

It sets the encoded URL string.

Returns
The protocol.

Definition at line 164 of file URL.cpp.

void te::common::URL::setFragmentString ( const std::string &  f)

It sets the fragment.

Parameters
fThe fragment string.

Definition at line 658 of file URL.cpp.

References te::common::uri::urisyn::encode(), and te::common::uri::urisyn::FRAGMENT_TRAITS.

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

It sets the host.

Parameters
sThe host.

Definition at line 214 of file URL.cpp.

References te::common::uri::authority::authority(), te::common::uri::authority::port(), and te::common::uri::authority::setDefaultPort().

void te::common::URL::setHostPort ( unsigned short  p)

It sets the host port.

Parameters
pThe host port.

Definition at line 254 of file URL.cpp.

References te::common::uri::authority::authority(), and te::common::uri::authority::port().

void te::common::URL::setIsAbsolutePath ( bool  v)

It sets the absolute path propertie.

Parameters
vTrue for absolute path, false otherwise.

Definition at line 392 of file URL.cpp.

References te::common::uri::path::absolute(), and te::common::uri::path::path().

void te::common::URL::setIsDirectoryPath ( bool  v)

It sets the directory path propertie.

Parameters
vTrue for directory path, false otherwise.

Definition at line 417 of file URL.cpp.

References te::common::uri::path::is_directory(), and te::common::uri::path::path().

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

It sets the login.

Parameters
sThe login.

Definition at line 279 of file URL.cpp.

References te::common::uri::authority::authority(), and te::common::uri::authority::setLogin().

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

It sets the password.

Parameters
sThe login.

Definition at line 304 of file URL.cpp.

References te::common::uri::authority::authority(), and te::common::uri::authority::setPassword().

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

It sets the protocol.

Parameters
sThe protocol

Definition at line 188 of file URL.cpp.

References te::common::uri::scheme::scheme().

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 files: