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 | ( | ) |
Default constructor of a new URL.
Definition at line 47 of file URL.cpp.
Referenced by setEncodedString().
| te::common::URL::URL | ( | const std::string & | s | ) |
| void te::common::URL::addPath | ( | const std::string & | p | ) |
| 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 540 of file URL.cpp.
References m_uri, and te::common::uri::uri::query().
Referenced by main().
| te::common::URL::const_pathIterator te::common::URL::beginPath | ( | ) | const |
It returns the begin const path iterator.
Definition at line 441 of file URL.cpp.
References te::common::uri::path::begin(), m_uri, and te::common::uri::uri::path().
| te::common::URL::queryIterator te::common::URL::beginQuery | ( | ) |
It returns the begin query iterator.
Definition at line 553 of file URL.cpp.
References m_uri, and te::common::uri::uri::query().
Referenced by getQueryString(), and main().
| te::common::URL::const_queryIterator te::common::URL::beginQuery | ( | ) | const |
It returns the begin const query iterator.
Definition at line 579 of file URL.cpp.
References m_uri, and te::common::uri::uri::query().
| void te::common::URL::clearPath | ( | ) |
It cleans the path.
Definition at line 353 of file URL.cpp.
References te::common::uri::path::clear(), m_uri, and te::common::uri::uri::path().
| void te::common::URL::clearQuery | ( | ) |
It cleans the vector of queries.
Definition at line 527 of file URL.cpp.
References m_uri, and te::common::uri::uri::query().
| te::common::URL::const_pathIterator te::common::URL::endPath | ( | ) | const |
It returns the end const path iterator.
Definition at line 454 of file URL.cpp.
References te::common::uri::path::end(), m_uri, and te::common::uri::uri::path().
| te::common::URL::queryIterator te::common::URL::endQuery | ( | ) |
It returns the end query iterator.
Definition at line 566 of file URL.cpp.
References m_uri, and te::common::uri::uri::query().
Referenced by getQueryString(), and main().
| te::common::URL::const_queryIterator te::common::URL::endQuery | ( | ) | const |
It returns the end const query iterator.
Definition at line 592 of file URL.cpp.
References m_uri, and te::common::uri::uri::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 605 of file URL.cpp.
References te::common::uri::query::find(), m_uri, and te::common::uri::uri::query().
Referenced by main().
| 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 619 of file URL.cpp.
References te::common::uri::query::find(), m_uri, and te::common::uri::uri::query().
| std::string te::common::URL::getEncodedFragmentString | ( | ) | const |
It returns encoded the fragment.
Definition at line 645 of file URL.cpp.
References te::common::uri::fragment::encoding(), te::common::uri::uri::fragment(), and m_uri.
Referenced by getEncodedString(), and main().
| std::string te::common::URL::getEncodedPathString | ( | ) | const |
It returns the encoded path.
Definition at line 328 of file URL.cpp.
References te::common::uri::path::encoding(), m_uri, and te::common::uri::uri::path().
Referenced by getEncodedString(), and main().
| std::string te::common::URL::getEncodedQueryString | ( | ) | const |
It returns the encoded query.
Definition at line 490 of file URL.cpp.
References te::common::uri::query::encoding(), m_uri, and te::common::uri::uri::query().
Referenced by getEncodedString(), and main().
| std::string te::common::URL::getEncodedString | ( | ) |
It returns encoded URL string.
Definition at line 115 of file URL.cpp.
References te::common::uri::uri::authority(), te::common::uri::authority::getDefaultPort(), getEncodedFragmentString(), te::common::uri::authority::getEncodedLogin(), te::common::uri::authority::getEncodedPassword(), getEncodedPathString(), getEncodedQueryString(), getHost(), getHostPort(), getProtocol(), and m_uri.
Referenced by main().
| std::string te::common::URL::getFragmentString | ( | ) | const |
It returns the fragment.
Definition at line 633 of file URL.cpp.
References te::common::uri::uri::fragment(), m_uri, and te::common::uri::fragment::string().
Referenced by getString(), and main().
| const std::string & te::common::URL::getHost | ( | ) | const |
It returns the host.
Definition at line 201 of file URL.cpp.
References te::common::uri::uri::authority(), te::common::uri::authority::host(), and m_uri.
Referenced by getEncodedString(), getString(), and main().
| unsigned short te::common::URL::getHostPort | ( | ) | const |
It returns the host port.
Definition at line 241 of file URL.cpp.
References te::common::uri::uri::authority(), m_uri, and te::common::uri::authority::port().
Referenced by getEncodedString(), getString(), and main().
| te::common::uri::authority::host_type_e te::common::URL::getHostType | ( | ) | const |
It returns the host type.
Definition at line 229 of file URL.cpp.
References te::common::uri::uri::authority(), te::common::uri::authority::host_type(), and m_uri.
Referenced by main().
| std::string te::common::URL::getLogin | ( | ) | const |
It returns the login.
Definition at line 266 of file URL.cpp.
References te::common::uri::uri::authority(), te::common::uri::authority::getLogin(), and m_uri.
Referenced by main().
| std::string te::common::URL::getPassword | ( | ) | const |
It returns the password.
Definition at line 291 of file URL.cpp.
References te::common::uri::uri::authority(), te::common::uri::authority::getPassword(), and m_uri.
Referenced by main().
| std::string te::common::URL::getPathString | ( | ) | const |
It returns the path.
Definition at line 316 of file URL.cpp.
References m_uri, te::common::uri::uri::path(), and te::common::uri::path::string().
Referenced by getString(), and main().
| const std::string & te::common::URL::getProtocol | ( | ) | const |
It returns the protocol.
Definition at line 175 of file URL.cpp.
References m_uri, te::common::uri::uri::scheme(), and te::common::uri::scheme::string().
Referenced by getEncodedString(), getString(), main(), and setHost().
| int te::common::URL::getQuerySize | ( | ) | const |
It returns the query size.
Definition at line 515 of file URL.cpp.
References m_uri, and te::common::uri::uri::query().
| std::string te::common::URL::getQueryString | ( | ) |
It returns the query string.
Definition at line 467 of file URL.cpp.
References beginQuery(), and endQuery().
Referenced by getString(), and main().
| std::string te::common::URL::getString | ( | ) |
It returns URL string.
Definition at line 67 of file URL.cpp.
References te::common::uri::uri::authority(), te::common::uri::authority::getDefaultPort(), getFragmentString(), getHost(), getHostPort(), te::common::uri::authority::getLogin(), te::common::uri::authority::getPassword(), getPathString(), getProtocol(), getQueryString(), and m_uri.
Referenced by main().
| bool te::common::URL::isAbsolutePath | ( | ) | const |
It Checks if the path is absolute.
Definition at line 379 of file URL.cpp.
References te::common::uri::path::absolute(), m_uri, and te::common::uri::uri::path().
Referenced by main().
| bool te::common::URL::isDirectoryPath | ( | ) | const |
It Checks if the path is directory.
Definition at line 404 of file URL.cpp.
References te::common::uri::path::is_directory(), m_uri, and te::common::uri::uri::path().
Referenced by main().
| bool te::common::URL::isEmptyPath | ( | ) | const |
It Checks if the path is empty.
Definition at line 429 of file URL.cpp.
References te::common::uri::path::empty(), m_uri, and te::common::uri::uri::path().
Referenced by main().
| void te::common::URL::setEncodedFragmentString | ( | const std::string & | f | ) |
It sets the encoded fragment.
| f | The encoded fragment string. |
Definition at line 671 of file URL.cpp.
References te::common::uri::uri::fragment(), and m_uri.
Referenced by main(), and setFragmentString().
| void te::common::URL::setEncodedPathString | ( | const std::string & | path | ) |
It sets the encoded path.
| path | The encoded path string. |
Definition at line 340 of file URL.cpp.
References m_uri, and te::common::uri::uri::path().
| void te::common::URL::setEncodedQueryString | ( | const std::string & | query | ) |
It sets the encoded query.
| query | The encoded query string. |
Definition at line 502 of file URL.cpp.
References m_uri, and te::common::uri::uri::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 657 of file URL.cpp.
References te::common::uri::urisyn::encode(), te::common::uri::urisyn::FRAGMENT_TRAITS, and setEncodedFragmentString().
Referenced by main().
| void te::common::URL::setHost | ( | const std::string & | s | ) |
It sets the host.
| s | The host. |
Definition at line 213 of file URL.cpp.
References te::common::uri::uri::authority(), getProtocol(), m_uri, te::common::uri::authority::port(), and te::common::uri::authority::setDefaultPort().
Referenced by main().
| void te::common::URL::setHostPort | ( | unsigned short | p | ) |
It sets the host port.
| p | The host port. |
Definition at line 253 of file URL.cpp.
References te::common::uri::uri::authority(), m_uri, and te::common::uri::authority::port().
Referenced by main(), and setProtocol().
| void te::common::URL::setIsAbsolutePath | ( | bool | v | ) |
It sets the absolute path propertie.
| v | True for absolute path, false otherwise. |
Definition at line 391 of file URL.cpp.
References te::common::uri::path::absolute(), m_uri, and te::common::uri::uri::path().
Referenced by main().
| void te::common::URL::setIsDirectoryPath | ( | bool | v | ) |
It sets the directory path propertie.
| v | True for directory path, false otherwise. |
Definition at line 416 of file URL.cpp.
References te::common::uri::path::is_directory(), m_uri, and te::common::uri::uri::path().
| void te::common::URL::setLogin | ( | const std::string & | s | ) |
It sets the login.
| s | The login. |
Definition at line 278 of file URL.cpp.
References te::common::uri::uri::authority(), m_uri, and te::common::uri::authority::setLogin().
Referenced by main().
| void te::common::URL::setPassword | ( | const std::string & | s | ) |
It sets the password.
| s | The login. |
Definition at line 303 of file URL.cpp.
References te::common::uri::uri::authority(), m_uri, and te::common::uri::authority::setPassword().
Referenced by main().
| void te::common::URL::setProtocol | ( | const std::string & | s | ) |
It sets the protocol.
| s | The protocol |
Definition at line 187 of file URL.cpp.
References te::common::uri::uri::authority(), te::common::uri::authority::getDefaultPort(), m_uri, te::common::uri::uri::scheme(), and setHostPort().
Referenced by main().
|
private |
Definition at line 388 of file URL.h.
Referenced by addPath(), addQuery(), beginPath(), beginQuery(), clearPath(), clearQuery(), endPath(), endQuery(), findQueryKey(), getEncodedFragmentString(), getEncodedPathString(), getEncodedQueryString(), getEncodedString(), getFragmentString(), getHost(), getHostPort(), getHostType(), getLogin(), getPassword(), getPathString(), getProtocol(), getQuerySize(), getString(), isAbsolutePath(), isDirectoryPath(), isEmptyPath(), setEncodedFragmentString(), setEncodedPathString(), setEncodedQueryString(), setHost(), setHostPort(), setIsAbsolutePath(), setIsDirectoryPath(), setLogin(), setPassword(), setProtocol(), and URL().