|
Transfer Ease
|
Use to manage URLs. More...
Public Types | |
| enum | IdScheme { SCHEME_UNK = 0 , SCHEME_FTP , SCHEME_FTPS , SCHEME_HTTP , SCHEME_HTTPS , SCHEME_NB_SUPPORTED } |
| List of supported schemes. More... | |
Public Member Functions | |
| Url () | |
| Build a empty URL which will be invalid. | |
| Url (const std::string &url) | |
| Create an URL from a string which will be parsed. | |
| Url (const Url &other) | |
| Url (Url &&other) noexcept | |
| void | clear () |
| Use to reset an URL. | |
| void | setUrl (const std::string &url) |
| Use to set URL from a string. | |
| void | setIdScheme (IdScheme idScheme) |
| void | setHost (const std::string &host) |
| void | setPort (uint16_t port) |
| void | setPath (const std::string &path) |
| bool | isValid () const |
| Use to know if URL is valid. | |
| std::string | toString () const |
| Use to generate properly formatted URL. | |
| IdScheme | getIdScheme () const |
| const std::string & | getHost () const |
| uint16_t | getPort () const |
| const std::string & | getPath () const |
| Url & | operator= (const Url &other) |
| Url & | operator= (Url &&other) noexcept |
Static Public Member Functions | |
| static std::string | idSchemeToString (IdScheme idScheme) |
| static IdScheme | idSchemeFromString (const std::string &idScheme) |
Friends | |
| TEASE_EXPORT friend bool | operator== (const Url &left, const Url &right) |
| TEASE_EXPORT friend bool | operator!= (const Url &left, const Url &right) |
Use to manage URLs.
| enum tease::Url::IdScheme |
List of supported schemes.
| tease::Url::Url | ( | ) |
Build a empty URL which will be invalid.
|
explicit |
| void tease::Url::clear | ( | ) |
Use to reset an URL.
| bool tease::Url::isValid | ( | ) | const |
Use to know if URL is valid.
URL is considered valid if scheme is supported and associated fields are set.
true if URL is valid | void tease::Url::setUrl | ( | const std::string & | url | ) |
Use to set URL from a string.
This method will parse the provided string to URL format. Examples:
Properties of those URLs will be:
Url::SCHEME_HTTPSexample.com8080 for url1 and 0 for url2 (0 simply means that we don't provide port info)path/to/resource.zip| [in] | url | URL to parse. If invalid or protocol unsupported, URL will be cleared. |
| std::string tease::Url::toString | ( | ) | const |
Use to generate properly formatted URL.