qi::Url¶
Summary¶
class qi::Url
Global Classes
Reference¶
qi::Url Class Reference¶
Public Functions¶
-
()Url
-
(const std::string& url)Url
-
(const std::string& url, unsigned short int defaultPort)Url
-
(const std::string& url, const std::string& defaultProtocol)Url
-
(const std::string& url, const std::string& defaultProtocol, unsigned short int defaultPort)Url
-
()~Url
-
bool
() constisValid
-
const std::string&
() conststr
-
const std::string&
() constprotocol
-
bool
() consthasProtocol
-
void
(const std::string& protocol)setProtocol
-
const std::string&
() consthost
-
bool
() consthasHost
-
void
(const std::string& host)setHost
-
unsigned short int
() constport
-
bool
() consthasPort
-
void
(unsigned short int port)setPort
Detailed Description¶
qi::Url is an address represented by a protocol, a host and a port. The class isn’t compliant with RFC 3986. qi::Url can parse the following formats:
- protocol://host:port
- protocol://host
- host:port
- host
- protocol://:port
- protocol://
- :port
- empty string
This class is copyable.
Function Documentation¶
-
qi::Url::
Url
()¶ Creates an empty url.
-
qi::Url::
Url
(const std::string& url)¶ Brief:
Parameters: - url – The url string, the port and the protocol will be extracted if they’re present.
-
qi::Url::
Url
(const std::string& url, unsigned short int defaultPort)¶ Brief:
Parameters: - url – The url string, the port and the protocol will be extracted if they’re present.
- defaultPort – The port that will be used if no port had been found in the url string.
-
qi::Url::
Url
(const std::string& url, const std::string& defaultProtocol)¶ Brief:
Parameters: - url – The url string, the port and the protocol will be extracted if they’re present.
- defaultProtocol – The protocol that will be used if no protocol had been found in the url string.
-
qi::Url::
Url
(const std::string& url, const std::string& defaultProtocol, unsigned short int defaultPort)¶ Brief:
Parameters: - url – The url string, the port and the protocol will be extracted if they’re present.
- defaultProtocol – The protocol that will be used if no protocol had been found in the url string.
- defaultPort – The port that will be used if no port had been found in the url string.
-
qi::Url::
~Url
()¶
-
const std::string&
qi::Url::
str
()const
¶ Brief:
Returns: The url string used by the Url class, the port and/or the protocol may have been appended if they had been given in the constructor.
-
const std::string&
qi::Url::
protocol
()const
¶ Brief:
Returns: The protocol of the url or an empty string if no protocol was set.
-
void
qi::Url::
setProtocol
(const std::string& protocol)¶ Sets the protocol to the given protocol identifier (tcp, tcps, udp, ...).
-
const std::string&
qi::Url::
host
()const
¶ Brief:
Returns: The host part of the url or an empty string if no host part was found.
-
void
qi::Url::
setHost
(const std::string& host)¶ Sets the host.
-
unsigned short int
qi::Url::
port
()const
¶ Brief:
Returns: The port of the url, 0 if no port were given.
-
void
qi::Url::
setPort
(unsigned short int port)¶ Sets the port. You can use 0.