libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
qi::Url Class Reference

#include <url.hpp>

Public Member Functions

 Url ()
 
 Url (const std::string &url)
 
 Url (const std::string &url, unsigned short defaultPort)
 
 Url (const std::string &url, const std::string &defaultProtocol)
 
 Url (const std::string &url, const std::string &defaultProtocol, unsigned short defaultPort)
 
virtual ~Url ()
 
bool isValid () const
 
const std::string & str () const
 
const std::string & protocol () const
 
bool hasProtocol () const
 
void setProtocol (const std::string &protocol)
 Sets the protocol to the given protocol identifier (tcp, tcps, udp, ...). More...
 
const std::string & host () const
 
bool hasHost () const
 
void setHost (const std::string &host)
 Sets the host. More...
 
unsigned short port () const
 
bool hasPort () const
 
void setPort (unsigned short port)
 Sets the port. You can use 0. More...
 

Detailed Description

qi::Url is an address represented by a protocol, a host and a port.

Warning
The class isn't compliant with RFC 3986.

qi::Url can parse the following formats:

Note
This class is copyable.

Definition at line 35 of file url.hpp.

Constructor & Destructor Documentation

qi::Url::Url ( )

Creates an empty url.

qi::Url::Url ( const std::string &  url)
Parameters
urlThe url string, the port and the protocol will be extracted if they're present.
qi::Url::Url ( const std::string &  url,
unsigned short  defaultPort 
)
Parameters
urlThe url string, the port and the protocol will be extracted if they're present.
defaultPortThe 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 
)
Parameters
urlThe url string, the port and the protocol will be extracted if they're present.
defaultProtocolThe 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  defaultPort 
)
Parameters
urlThe url string, the port and the protocol will be extracted if they're present.
defaultProtocolThe protocol that will be used if no protocol had been found in the url string.
defaultPortThe port that will be used if no port had been found in the url string.
virtual qi::Url::~Url ( )
virtual

Member Function Documentation

bool qi::Url::hasHost ( ) const
Returns
True if the host was set.
bool qi::Url::hasPort ( ) const
Returns
True if the port was set.
bool qi::Url::hasProtocol ( ) const
Returns
True if the protocol was set.
const std::string& qi::Url::host ( ) const
Returns
The host part of the url or an empty string if no host part was found.
bool qi::Url::isValid ( ) const
Returns
True if the protocol, host and port have been set.
unsigned short qi::Url::port ( ) const
Returns
The port of the url, 0 if no port were given.
const std::string& qi::Url::protocol ( ) const
Returns
The protocol of the url or an empty string if no protocol was set.
void qi::Url::setHost ( const std::string &  host)

Sets the host.

void qi::Url::setPort ( unsigned short  port)

Sets the port. You can use 0.

void qi::Url::setProtocol ( const std::string &  protocol)

Sets the protocol to the given protocol identifier (tcp, tcps, udp, ...).

const std::string& qi::Url::str ( ) const
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.

The documentation for this class was generated from the following file: