Base Framework
|
Uniform Resource Identifier (URI) More...
#include <base/net/Uri.h>
Inherits Object.
Public Member Functions | |
Uri () | |
Uri (const String &uri, bool strict=true) | |
Uri (const String &relative, const String &base, bool strict=true) | |
Uri (const Uri ©) noexcept | |
Uri & | operator= (const Uri &assign) noexcept |
bool | isRelative () const noexcept |
String | getScheme () const noexcept |
String | getUser () const noexcept |
String | getPassword () const noexcept |
String | getHost () const noexcept |
String | getPort () const noexcept |
virtual String | getPath () const |
String | getSearch () const noexcept |
String | getUri () const |
virtual void | setScheme (const String &value) |
void | setUser (const String &value) |
void | setPassword (const String &value) |
void | setHost (const String &value) |
void | setPort (const String &value) |
virtual void | setPath (const String &value) |
Protected Member Functions | |
void | parse (const String &uri, bool strict) |
Static Protected Member Functions | |
static String | validateScheme (const String &value) |
static String | validateUser (const String &str) |
static String | validatePassword (const String &str) |
static bool | isHost (String::ReadIterator i, const String::ReadIterator &end) noexcept |
static bool | isPort (String::ReadIterator i, const String::ReadIterator &end) noexcept |
Uniform Resource Identifier (URI)
Implementation of Uniform Resource Identifier (URI) as specified by RFC 2396. A Uniform Resource Identifier (URI) is a compact string for identifying an abstract or physical resource.
Uri uri("http://www.google.com") Uri uri("ftp://ftp.gnu.org")
Uri::Uri | ( | ) |
Initializes an empty uri.
Uri::Uri | ( | const String & | uri, |
bool | strict = true |
||
) |
Initializes uri from a string representation.
uri | The string representation of the uri. |
strict | Specifies that unsafe characters are required to be encoded. Default is true. |
Initializes uri from separate string representations of relative and base uri.
relative | The relative uri. |
base | The base uri. |
strict | Specifies that unsafe characters are required to be encoded. Default is true. |
|
noexcept |
Initializes uri from other uri.
|
noexcept |
Returns the host.
|
noexcept |
Returns the password.
|
virtual |
Returns the path.
|
noexcept |
Returns the port.
|
noexcept |
Returns the scheme (a.k.a. protocol).
|
noexcept |
Returns the search part of the identifier.
String Uri::getUri | ( | ) | const |
Returns the entire identifier.
|
noexcept |
Returns the user.
|
staticprotectednoexcept |
Returns true if the string is a valid host specification.
|
staticprotectednoexcept |
Returns true if the string is a valid port.
|
noexcept |
Returns true if the uri is relative.
|
protected |
Parses the string as a uri.
void Uri::setHost | ( | const String & | value | ) |
Sets the host.
void Uri::setPassword | ( | const String & | value | ) |
Sets the password.
|
virtual |
Sets the path.
void Uri::setPort | ( | const String & | value | ) |
Sets the port.
|
virtual |
Sets the scheme (a.k.a. protocol). The scheme is composed of letters ('a'-'z'), digits ('0'-'9'), and the characters plus ('+'), period ('.'), and hyphen ('-'). Upper case letters are also allowed but are converted into lower case. The exception URLException is thrown if the set of allowed characters is violated.
void Uri::setUser | ( | const String & | value | ) |
Sets the user.
Validates the specified password and returns it.
Validates the specified scheme and returns a slightly converted scheme to be used.