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 |
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/ .
typedef uri::query::const_iterator te::common::URL::const_queryIterator |
typedef uri::query::iterator te::common::URL::queryIterator |
te::common::URL::URL | ( | const std::string & | s | ) |
void te::common::URL::addPath | ( | const std::string & | p | ) |
It adds the path.
p | The path string to be added. |
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.
query | The query string. |
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.
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.
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.
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.
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.
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.
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.
key | The key to be found. |
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.
key | The key to be found. |
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 |
std::string te::common::URL::getEncodedPathString | ( | ) | const |
std::string te::common::URL::getEncodedQueryString | ( | ) | const |
std::string te::common::URL::getEncodedString | ( | ) |
It returns encoded URL string.
Definition at line 116 of file URL.cpp.
References te::common::uri::authority::authority(), te::common::uri::authority::getDefaultPort(), te::common::uri::authority::getEncodedLogin(), and te::common::uri::authority::getEncodedPassword().
std::string te::common::URL::getFragmentString | ( | ) | const |
const std::string & te::common::URL::getHost | ( | ) | const |
unsigned short te::common::URL::getHostPort | ( | ) | const |
te::common::uri::authority::host_type_e te::common::URL::getHostType | ( | ) | const |
std::string te::common::URL::getLogin | ( | ) | const |
std::string te::common::URL::getPassword | ( | ) | const |
std::string te::common::URL::getPathString | ( | ) | const |
const std::string & te::common::URL::getProtocol | ( | ) | const |
int te::common::URL::getQuerySize | ( | ) | const |
std::string te::common::URL::getQueryString | ( | ) |
std::string te::common::URL::getString | ( | ) |
It returns URL string.
Definition at line 68 of file URL.cpp.
References te::common::uri::authority::authority(), te::common::uri::authority::getDefaultPort(), te::common::uri::authority::getLogin(), and te::common::uri::authority::getPassword().
bool te::common::URL::isAbsolutePath | ( | ) | const |
bool te::common::URL::isDirectoryPath | ( | ) | const |
bool te::common::URL::isEmptyPath | ( | ) | const |
void te::common::URL::setEncodedFragmentString | ( | const std::string & | f | ) |
It sets the encoded fragment.
f | The 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.
path | The 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.
query | The 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 | ) |
void te::common::URL::setFragmentString | ( | const std::string & | f | ) |
It sets the fragment.
f | The 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.
s | The 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.
p | The 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.
v | True 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.
v | True 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.
s | The 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.
s | The 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.
s | The protocol |
Definition at line 188 of file URL.cpp.
References te::common::uri::scheme::scheme().