TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
Representation of a Uniform Resource Locator (URL). More...
#include <tsURL.h>
Public Member Functions | |
URL ()=default | |
Default constructor. | |
URL (const UString &path) | |
Constructor from a string. | |
URL (const UString &path, const URL &base) | |
Constructor from a string and a base URL. | |
URL (const UString &path, const UString &base) | |
Constructor from a string and a base string. | |
void | clear () |
Clear the content of the URL (becomes invalid). | |
UString | getFragment () const |
Get the optional fragment after '#' . | |
UString | getHost () const |
Get the host name . | |
UString | getPassword () const |
Get the optional password . | |
UString | getPath () const |
Get the local path . | |
uint16_t | getPort () const |
Get the optional port number . | |
UString | getQuery () const |
Get the optional query after '?' . | |
UString | getScheme () const |
Get the scheme name without trailing colon . | |
UString | getUserName () const |
Get the optiona user name part . | |
bool | isValid () const |
Check if the URL is valid (was built from a valid URL string). | |
bool | sameServer (const URL &other) const |
Check if two URL's use the same server (scheme, host, user, etc.) | |
void | setFragment (const UString &value) |
Set the optional fragment after '#' . | |
void | setHost (const UString &value) |
Set the host name . | |
void | setPassword (const UString &value) |
Set the optional password . | |
void | setPath (const UString &value) |
Set the local path . | |
void | setPort (const uint16_t &value) |
Set the optional port number . | |
void | setQuery (const UString &value) |
Set the optional query after '?' . | |
void | setScheme (const UString &value) |
Set the scheme name without trailing colon . | |
void | setURL (const UString &path) |
Set URL from a string. | |
void | setURL (const UString &path, const URL &base) |
Set URL from a string and a base URL. | |
void | setURL (const UString &path, const UString &base) |
Set URL from a string and a base string. | |
void | setUserName (const UString &value) |
Set the optiona user name part . | |
UString | toRelative (const URL &base, bool useWinInet=true) const |
Extract a relative URL of this object, from a base URL. | |
UString | toRelative (const UString &base, bool useWinInet=true) const |
Extract a relative URL of this object, from a base URL. | |
UString | toString (bool useWinInet=true) const |
Convert to a string object. | |
Static Public Member Functions | |
static bool | IsURL (const UString &path) |
This static method checks if a string contains a URL. | |
Representation of a Uniform Resource Locator (URL).
|
inline |
void ts::URL::setURL | ( | const UString & | path | ) |
UString ts::URL::toString | ( | bool | useWinInet = true | ) | const |
Convert to a string object.
[in] | useWinInet | This boolean is used on Windows only. When true, a file URL is built as 'file://C:/dir/file' (with 2 slashes). When false, the URL is 'file:///C:/dir/file' (with 3 slashes). The latter form is the documented one from Microsoft and should be considered as the "correct" one. However, the Microsoft WinInet library (which is used by the WebRequest class) requires the incorrect form with 2 slashes. So, if the resulting URL is to be used by WebRequest, set useWinInet to true (the default) but if the URL needs to be published somewhere, use false. |
Extract a relative URL of this object, from a base URL.
[in] | base | The base URL to use. If this object and base share the same scheme and host specification. |
[in] | useWinInet | This boolean is used on Windows only. See toString() for details. |
Extract a relative URL of this object, from a base URL.
[in] | base | The base URL to use. If this object and base share the same scheme and host specification. |
[in] | useWinInet | This boolean is used on Windows only. See toString() for details. |
bool ts::URL::sameServer | ( | const URL & | other | ) | const |
|
inline |
|
inline |
Set the scheme name without trailing colon .
[in] | value | The scheme name without trailing colon . |
|
inline |
Get the scheme name without trailing colon .
|
inline |
Set the optiona user name part .
[in] | value | The optiona user name part . |
|
inline |
Get the optiona user name part .
|
inline |
Set the optional password .
[in] | value | The optional password . |
|
inline |
Get the optional password .
|
inline |
Set the host name .
[in] | value | The host name . |
|
inline |
Get the host name .
|
inline |
Set the optional port number .
[in] | value | The optional port number . |
|
inline |
Get the optional port number .
|
inline |
Set the local path .
[in] | value | The local path . |
|
inline |
Get the local path .
|
inline |
Set the optional query after '?' .
[in] | value | The optional query after '?' . |
|
inline |
Get the optional query after '?' .
|
inline |
Set the optional fragment after '#' .
[in] | value | The optional fragment after '#' . |
|
inline |
Get the optional fragment after '#' .
|
inlinestatic |