#include <Url.h>
Public Types | |
| enum | Protocol { unknown, file, ftp, http, https, cd, dvd, nfs, dir, hd, smb, cifs } |
| typedef std::map < std::string, std::string > | OptionMapType |
Public Member Functions | |
| Url () | |
| Url (const std::string &url) | |
| ~Url () | |
| bool | operator== (const Url &) const |
| void | setProtocol (Protocol) |
| void | setProtocolString (const std::string &str) |
| void | setUsername (const std::string &str) |
| void | setPassword (const std::string &str) |
| void | setHost (const std::string &str) |
| void | setPort (int) |
| void | setPath (const std::string &path) |
| Protocol | protocol () const |
| const std::string & | protocolString () const |
| const std::string & | username () const |
| const std::string & | password () const |
| const std::string & | host () const |
| int | port () const |
| const std::string & | path () const |
| const OptionMapType & | options () const |
| std::string | option (const std::string &key) const |
| bool | isLocal () const |
| bool | isValid () const |
| bool | set (const std::string url) |
| std::string | asString (bool path=true, bool options=true, bool plainpassword=false) const |
| std::string | saveAsString () const |
Static Public Member Functions | |
| static Protocol | stringToProtocol (const std::string &protocolString) |
| static std::string | protocolToString (Protocol) |
Private Member Functions | |
| void | clearifinvalid (bool valid) |
Static Private Member Functions | |
| static bool | split (const std::string &url, Protocol &protocol, std::string &protocolString, std::string &username, std::string &password, std::string &hostname, int &port, std::string &path, OptionMapType &options) |
Private Attributes | |
| Protocol | _protocol |
| std::string | _protocolString |
| std::string | _username |
| std::string | _password |
| std::string | _host |
| int | _port |
| std::string | _path |
| OptionMapType | _options |
| bool | _valid |
Static Private Attributes | |
| static ProtocolStrings | _protocolStrings |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const Url &obj) |
Classes | |
| class | ProtocolStrings |
TODO: (un)escaping special characters like space -> 20 TODO: check if url is still valid when using set* functions
| typedef std::map<std::string,std::string> Url::OptionMapType |
| enum Url::Protocol |
| Url::Url | ( | ) |
default constructor creating an (invalid) empty Url
| Url::Url | ( | const std::string & | url | ) |
construct new url
| url | string of the form protocol://[[username[:password]][:port]]/path[;options] |
| Url::~Url | ( | ) | [inline] |
| void Url::clearifinvalid | ( | bool | valid | ) | [private] |
clear all variables
| valid | clear if this parameter is false, do nothing if true |
| bool Url::operator== | ( | const Url & | ) | const |
| void Url::setProtocol | ( | Protocol | ) |
| void Url::setProtocolString | ( | const std::string & | str | ) |
| void Url::setUsername | ( | const std::string & | str | ) |
| void Url::setPassword | ( | const std::string & | str | ) |
| void Url::setHost | ( | const std::string & | str | ) |
| void Url::setPort | ( | int | ) |
| void Url::setPath | ( | const std::string & | path | ) |
| Protocol Url::protocol | ( | ) | const [inline] |
| const std::string& Url::protocolString | ( | ) | const [inline] |
| const std::string& Url::username | ( | ) | const [inline] |
| const std::string& Url::password | ( | ) | const [inline] |
| const std::string& Url::host | ( | ) | const [inline] |
| int Url::port | ( | ) | const [inline] |
| const std::string& Url::path | ( | ) | const [inline] |
| const OptionMapType& Url::options | ( | ) | const [inline] |
| std::string Url::option | ( | const std::string & | key | ) | const |
return Option
| key | name of option |
| bool Url::isLocal | ( | ) | const |
| bool Url::isValid | ( | ) | const |
| bool Url::set | ( | const std::string | url | ) |
set url
| url | string of the form protocol://[[username[:password]][:port]]/path[;options] |
| std::string Url::asString | ( | bool | path = true, |
|
| bool | options = true, |
|||
| bool | plainpassword = false | |||
| ) | const |
join tokens to a valid url
| path | whether to append the path | |
| options | whether to append options | |
| plainpassword | whether to include the password in plaintext (otherwise PASSWORD is printed) |
| std::string Url::saveAsString | ( | ) | const [inline] |
use this function to get full Url for storing it in a file
| static Protocol Url::stringToProtocol | ( | const std::string & | protocolString | ) | [static] |
| static std::string Url::protocolToString | ( | Protocol | ) | [static] |
| static bool Url::split | ( | const std::string & | url, | |
| Protocol & | protocol, | |||
| std::string & | protocolString, | |||
| std::string & | username, | |||
| std::string & | password, | |||
| std::string & | hostname, | |||
| int & | port, | |||
| std::string & | path, | |||
| OptionMapType & | options | |||
| ) | [static, private] |
split url into tokens
| url | string of the form protocol://[[username[:password]][:port]]/path[;options] |
| std::ostream& operator<< | ( | std::ostream & | str, | |
| const Url & | obj | |||
| ) | [friend] |
ProtocolStrings Url::_protocolStrings [static, private] |
Protocol Url::_protocol [private] |
std::string Url::_protocolString [private] |
std::string Url::_username [private] |
std::string Url::_password [private] |
std::string Url::_host [private] |
int Url::_port [private] |
std::string Url::_path [private] |
OptionMapType Url::_options [private] |
bool Url::_valid [private] |
1.5.3