|
constexpr | Uri () noexcept |
| Instantiates the object with default parameters (default constructor). Initializes an object.
|
|
bool | Parse (const char *first, const char *last) noexcept |
| Parses a URI string. More...
|
|
bool | Parse (const char *str) noexcept |
| Returns Parse(str, str + strlen(str)) .
|
|
bool | SetUri (const char *scheme, const char *userinfo, const char *host, const char *port, const char *path, const char *query, const char *fragment) noexcept |
| Sets the various parts of the URI. More...
|
|
bool | IsAbsolute () const noexcept |
| Returns true if the URI is an absolute URI. This function determines the string is an absolute URI if a scheme is specified.
|
|
bool | ComposeString (char *buf, size_t size) const noexcept |
| Writes a URI string. More...
|
|
template<size_t N> |
bool | ComposeString (char(&buf)[N]) const noexcept |
| Writes a URI string. More...
|
|
bool | AddBaseUri (const Uri &relative, const Uri &base) noexcept |
| Resolves a relative path. More...
|
|
const char * | GetScheme () const noexcept |
| Returns the string for the URI scheme (such as "http" or "file"). More...
|
|
const char * | GetUserInfo () const noexcept |
| Gets user-specific information (like a user name and password) associated with the specified URI. More...
|
|
const char * | GetHost () const noexcept |
| Gets the hostname. More...
|
|
const char * | GetPort () const noexcept |
| Gets the string that is the port number. More...
|
|
int | GetPortNumber () const noexcept |
| Gets the port number. If a port number string has been set and it can be converted into the int type, the function returns a non-negative integer, otherwise it returns -1.
|
|
const char * | GetPath () const noexcept |
| Gets a path. More...
|
|
const char * | GetQuery () const noexcept |
| Gets a query string. More...
|
|
const char * | GetFragment () const noexcept |
| Gets a fragment string. More...
|
|
bool | SetScheme (const char *first, const char *last) noexcept |
| Sets the scheme as a string, excluding the colon at its end.
|
|
bool | SetUserInfo (const char *first, const char *last) noexcept |
| Sets user-specific information, including the user name and password, associated with the specified URI.
|
|
bool | SetHost (const char *first, const char *last) noexcept |
| Sets the hostname.
|
|
bool | SetPort (const char *first, const char *last) noexcept |
| Sets the port number as a string, excluding the colon.
|
|
bool | SetPath (const char *first, const char *last) noexcept |
| Sets the path.
|
|
bool | SetQuery (const char *first, const char *last) noexcept |
| Sets the query string, excluding the "?" character at its beginning.
|
|
bool | SetFragment (const char *first, const char *last) noexcept |
| Sets the fragment string, excluding the "#" character at its beginning.
|
|
bool | SetScheme (const char *scheme) noexcept |
| Sets the scheme as a string, excluding the colon at its end.
|
|
bool | SetUserInfo (const char *userinfo) noexcept |
| Sets user-specific information, including the user name and password, associated with the specified URI.
|
|
bool | SetHost (const char *host) noexcept |
| Sets the hostname.
|
|
bool | SetPort (const char *port) noexcept |
| Sets the port number as a string, excluding the colon.
|
|
bool | SetPortNumber (int port) noexcept |
| Sets the port number.
|
|
bool | SetPath (const char *path) noexcept |
| Sets the path.
|
|
bool | SetQuery (const char *query) noexcept |
| Sets the query string, excluding the "?" character at its beginning.
|
|
bool | SetFragment (const char *fragment) noexcept |
| Sets the fragment string, excluding the "#" character at its beginning.
|
|
template<size_t N> |
bool | SetQuery (const UriQueryEncoder< N > &encoder) noexcept |
| Sets the query string, excluding the "?" character at its beginning.
|
|
void | Reset () noexcept |
| Initializes (resets) an object.
|
|
Error | GetError () const noexcept |
| A detailed reason for an error can be obtained when that error occurs.
|
|
|
static bool | IsHostName (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| Determines whether the string complies with the host name requirements (RFC 1034 3.1). More...
|
|
static bool | IsHostName (const nlib_utf8_t *str) noexcept |
| Returns IsHostName(str, str + strlen(str)) .
|
|
static bool | IsIpv4 (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| Determines whether the string complies with IPv4 requirements. More...
|
|
static bool | IsIpv4 (const nlib_utf8_t *str) noexcept |
| Returns IsIpv4(str, str + strlen(str)) .
|
|
static bool | IsIpv6 (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| Determines whether the string complies with IPv6 requirements. More...
|
|
static bool | IsIpv6 (const nlib_utf8_t *str) noexcept |
| Returns IsIpv6(str, str + strlen(str)) .
|
|
static bool | IsEmailAddress (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| Determines whether the string complies with the email address requirements (RFC 5322 3.4). More...
|
|
static bool | IsEmailAddress (const nlib_utf8_t *str) noexcept |
| Returns IsEmailAddress(str, str + strlen(str)) .
|
|
static bool | IsUri (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| Determines whether the string is a URI. Note that, when the string is a relative path, that string is a URI reference, instead of a URI. More...
|
|
static bool | IsUri (const nlib_utf8_t *str) noexcept |
| Returns IsUri(str, str + strlen(str)) .
|
|
static bool | IsUriReference (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| Determines whether the string is a URI reference. More...
|
|
static bool | IsUriReference (const nlib_utf8_t *str) noexcept |
| Returns IsUriReference(str, str + strlen(str)) .
|
|
static bool | IsReserved (int c) noexcept |
| Returns true if c is a reserved character in RFC 3986.
|
|
static bool | IsUnreserved (int c) noexcept |
| Returns true if c is an unreserved character in RFC 3986.
|
|
static bool | IsHexDigit (int c) noexcept |
| Returns true if the value is a hexadecimal number.
|
|
static errno_t | DecodeUriComponent (size_t *written, char *buf, size_t n, const char *first, const char *last) noexcept |
| Decodes a percent-encoded string. More...
|
|
template<size_t N> |
static errno_t | DecodeUriComponent (size_t *written, char(&buf)[N], const char *s) noexcept |
| Calls DecodeUriComponent(written, buf, N, s) .
|
|
static errno_t | DecodeUriComponent (size_t *written, char *buf, size_t n, const char *s) noexcept |
| Decodes a percent-encoded string. More...
|
|
template<size_t N> |
static errno_t | DecodeUriComponent (size_t *written, char(&buf)[N], const char *first, const char *last) noexcept |
| Calls DecodeUriComponent(written, buf, N, first, last) .
|
|
static errno_t | EncodeUriComponent (size_t *written, char *buf, size_t n, const char *first, const char *last, bool fragment_mode) noexcept |
| Percent-encodes a string. More...
|
|
template<size_t N> |
static errno_t | EncodeUriComponent (size_t *written, char(&buf)[N], const char *first, const char *last, bool fragment_mode) noexcept |
| Calls EncodeUriComponent(written, buf, N, first, last, fragment_mode) .
|
|
static errno_t | EncodeUriComponent (size_t *written, char *buf, size_t n, const char *s, bool fragment_mode) noexcept |
| Percent-encodes a string. More...
|
|
template<size_t N> |
static errno_t | EncodeUriComponent (size_t *written, char(&buf)[N], const char *s, bool fragment_mode) noexcept |
| Calls EncodeUriComponent(written, buf, N, s, fragment_mode) .
|
|
static errno_t | DecodePath (size_t *written, char *buf, size_t n, const char *s) noexcept |
| Decodes a percent-encoded string. This function is the same as DecodeUriComponent , except that it returns EILSEQ if the decoded character is the forward slash ('/').
|
|
template<size_t N> |
static errno_t | DecodePath (size_t *written, char(&buf)[N], const char *s) noexcept |
| Calls DecodePath(written, buf, N, s) .
|
|
static errno_t | EncodePath (size_t *written, char *buf, size_t n, const char *s) noexcept |
| Percent-encodes a string. This function is the same as EncodeUriComponent , except that it does not percent-encode the forward slash ( ' / ' ).
|
|
template<size_t N> |
static errno_t | EncodePath (size_t *written, char(&buf)[N], const char *s) noexcept |
| Calls EncodePath(written, buf, N, s) .
|
|
The class for parsing and constructing regular URIs.
- Description
- The
HttpStyleUri
and FileStyleUri
classes parse URIs using this class.
- This class is also used with relative URIs (relative paths). When a URI is parsed, some of the percent-encoded characters are decoded. The characters that are decoded belong to
unreserved(ALPHA / DIGIT / "-" / "." / "_" / "~")
in RFC 3986. Other percent-encoded characters are left the way they are. uri.Parse("http://www.example.com/dir/index.html?query=test#part1");
uri.GetScheme();
uri.GetHost();
uri.GetPath();
uri.GetQuery();
uri.GetFragment();
- See also
- https://www.ietf.org/rfc/rfc3986.txt (RFC 3986)
-
http://www.eonet.ne.jp/~h-hash/rfc_ja/rfc3986.ja.html (RFC 3986, in Japanese)
- Examples:
- misc/uri/uri.cpp.
Definition at line 51 of file Uri.h.