|
CeresEngine 0.2.0
A game development framework
|
A Uniform Resource Identifier (URI) is a unique sequence of characters that identifies a logical or physical resource used by web technologies. More...
#include <CeresEngine/Foundation/URI.hpp>
Public Member Functions | |
| URI ()=default | |
| Creates a new empty URI. | |
| URI (String raw) | |
| Creates a new URI by parsing it from a raw string. | |
| URI (const StringView raw) | |
| Creates a new URI by parsing it from a raw string. | |
| URI (const char *raw) | |
| Creates a new URI by parsing it from a raw string. | |
| URI (const FilePath &path) | |
| Creates a new URI by parsing it from a raw string. | |
| URI (const std::string_view raw) | |
| Creates a new URI by parsing it from a raw string. | |
| template<typename CharTraits , typename Allocator > | |
| URI (const std::basic_string< char, CharTraits, Allocator > &raw) | |
| Creates a new URI by parsing it from a raw string. | |
| URI (const StringView scheme, const StringView path, const StringView host=StringView(), const StringView port=StringView(), const StringView query=StringView(), const StringView fragment=StringView(), const StringView userInfo=StringView()) | |
| Creates a new URI from individual parts. | |
| URI (const URI &absolute, const URI &relative) | |
Creates a new URI by resolving relative using absolute as the reference. | |
| URI (const URI &)=default | |
| Copies a URI from another. | |
| URI & | operator= (const URI &)=default |
| Copies a URI from another. | |
| URI (URI &&)=default | |
| Moves a URI from another. | |
| URI & | operator= (URI &&)=default |
| Moves a URI from another. | |
| StringView | getScheme () const noexcept |
| A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). | |
| void | setScheme (const StringView scheme) |
| A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). | |
| bool | hasScheme () const noexcept |
| A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). | |
| void | clearScheme () |
| A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). | |
| StringView | getUserInfo () const noexcept |
| An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@). | |
| bool | isUserInfoNested () const noexcept |
| Checks if the user-info is a nested URI. | |
| void | setUserInfo (const StringView userInfo) |
| An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@). | |
| bool | hasUserInfo () const noexcept |
| An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@). | |
| void | clearUserInfo () |
| An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@). | |
| StringView | getHost () const noexcept |
| A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address. | |
| bool | isHostNested () const noexcept |
| Checks if the host is a nested URI. | |
| void | setHost (const StringView host) |
| A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address. | |
| bool | hasHost () const noexcept |
| A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address. | |
| void | clearHost () |
| A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address. | |
| StringView | getPort () const noexcept |
| An optional port subcomponent preceded by a colon (:). | |
| bool | isPortNested () const noexcept |
| Checks if the port is a nested URI. | |
| void | setPort (const StringView port) |
| An optional port subcomponent preceded by a colon (:). | |
| bool | hasPort () const noexcept |
| An optional port subcomponent preceded by a colon (:). | |
| void | clearPort () |
| An optional port subcomponent preceded by a colon (:). | |
| StringView | getPath () const noexcept |
| A path component, consisting of a sequence of path segments separated by a slash (/). | |
| bool | isPathNested () const noexcept |
| Checks if the path is a nested URI. | |
| void | setPath (const StringView path) |
| A path component, consisting of a sequence of path segments separated by a slash (/). | |
| bool | hasPath () const noexcept |
| A path component, consisting of a sequence of path segments separated by a slash (/). | |
| void | clearPath () |
| A path component, consisting of a sequence of path segments separated by a slash (/). | |
| StringView | getQuery () const noexcept |
| An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data. | |
| bool | isQueryNested () const noexcept |
| Checks if the query is a nested URI. | |
| void | setQuery (const StringView query) |
| An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data. | |
| bool | hasQuery () const noexcept |
| An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data. | |
| void | clearQuery () |
| An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data. | |
| StringView | getFragment () const noexcept |
| An optional fragment component preceded by a hash (#). | |
| bool | isFragmentNested () const noexcept |
| Checks if the fragment is a nested URI. | |
| void | setFragment (const StringView fragment) |
| An optional fragment component preceded by a hash (#). | |
| bool | hasFragment () const noexcept |
| An optional fragment component preceded by a hash (#). | |
| void | clearFragment () |
| An optional fragment component preceded by a hash (#). | |
| String | toString () const |
| Converts the URI object into it's string representation. | |
| bool | isRelative () const noexcept |
| Checks if the parsed URI is a relative reference URI. | |
| bool | isAbsolute () const noexcept |
| Checks if the parsed URI is an absolute (and complete) URI. | |
| bool | isNested () const noexcept |
| Checks if the parsed URI contains any nested part. | |
| void | clear () noexcept |
| Clears the URI content. | |
| bool | isEmpty () const noexcept |
| Checks if the URI is empty. | |
| URI | resolve (const URI &relative) const |
| Resolves a relative URI using this URI as the reference. | |
| URI | canonicalize () const |
| Converts the URI into a canonical form. | |
| bool | empty () const noexcept |
| Checks if the URI is empty. | |
Private Types | |
| using | Part = TRange< std::size_t > |
A type used to internally represent a range in that contains the sub-string range contained in mData. | |
Private Member Functions | |
| bool | tryParse (String string) |
| Tries to parse the URI from a string. | |
| StringView | get (const Part &part) const noexcept |
| Gets a URI part. | |
| void | set (const Part &part, StringView newContent) |
| Sets (and changes the content) of a URI part. | |
| bool | isPartNested (const Part &part) const noexcept |
Private Attributes | |
| Part | mScheme |
| A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). | |
| Part | mUserInfo |
| An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@). | |
| Part | mHost |
| A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address. | |
| Part | mPort |
| An optional port subcomponent preceded by a colon (:). | |
| Part | mPath |
| A path component, consisting of a sequence of path segments separated by a slash (/). | |
| Part | mQuery |
| An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data. | |
| Part | mFragment |
| An optional fragment component preceded by a hash (#). | |
| String | mData |
| The raw URI data. | |
A Uniform Resource Identifier (URI) is a unique sequence of characters that identifies a logical or physical resource used by web technologies.
URIs may be used to identify anything, including real-world objects, such as people and places, concepts, or information resources such as web pages and books. Some URIs provide a means of locating and retrieving information resources on a network (either on the Internet or on another private network, such as a computer filesystem or an Intranet); these are Uniform Resource Locators (URLs). A URL provides the location of the resource. A URI identifies the resource by name at the specified location or URL. Other URIs provide only a unique name, without a means of locating or retrieving the resource or information about it, these are Uniform Resource Names (URNs). The web technologies that use URIs are not limited to web browsers. URIs are used to identify anything described using the Resource Description Framework (RDF), for example, concepts that are part of an ontology defined using the Web Ontology Language (OWL), and people who are described using the Friend of a Friend vocabulary would each have an individual URI.
Each URI begins with a scheme name that refers to a specification for assigning identifiers within that scheme. As such, the URI syntax is a federated and extensible naming system wherein each scheme's specification may further restrict the syntax and semantics of identifiers using that scheme.
The URI generic syntax consists of a hierarchical sequence of five components:
where the authority component divides into three subcomponents:
|
private |
A type used to internally represent a range in that contains the sub-string range contained in mData.
|
default |
Creates a new empty URI.
|
explicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
Creates a new URI from individual parts.
|
inline |
An optional fragment component preceded by a hash (#).
The fragment contains a fragment identifier providing direction to a secondary resource, such as a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an getEntityID attribute of a specific element, and web browsers will scroll this element into view.
|
inline |
A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address.
IPv4 addresses must be in dot-decimal notation, and IPv6 addresses must be enclosed in brackets ([]).
|
inline |
A path component, consisting of a sequence of path segments separated by a slash (/).
A path is always defined for a URI, though the defined path may be empty (zero length). A segment may also be empty, resulting in two consecutive slashes (//) in the path component. A path component may resemble or map exactly to a file system path, but does not always imply a relation to one. If an authority component is present, then the path component must either be empty or begin with a slash (/). If an authority component is absent, then the path cannot begin with an empty segment, that is with two slashes (//), as the following characters would be interpreted as an authority component. The final segment of the path may be referred to as a 'slug'.
|
inline |
An optional port subcomponent preceded by a colon (:).
|
inline |
An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data.
Its syntax is not well defined, but by convention is most often a sequence of attribute–value pairs separated by a delimiter.
|
inline |
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-).
Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. Examples of popular schemes include http, https, ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.
|
inline |
An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@).
Use of the format username:password in the userinfo subcomponent is deprecated for security reasons. Applications should not render as clear text any data after the first colon (:) found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password).
|
inlineprivatenoexcept |
Gets a URI part.
Computes the sub-string ´StringView´ based on the
| part | The part to get the value for. |
|
inlinenoexcept |
An optional fragment component preceded by a hash (#).
The fragment contains a fragment identifier providing direction to a secondary resource, such as a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an getEntityID attribute of a specific element, and web browsers will scroll this element into view.
|
inlinenoexcept |
A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address.
IPv4 addresses must be in dot-decimal notation, and IPv6 addresses must be enclosed in brackets ([]).
|
inlinenoexcept |
A path component, consisting of a sequence of path segments separated by a slash (/).
A path is always defined for a URI, though the defined path may be empty (zero length). A segment may also be empty, resulting in two consecutive slashes (//) in the path component. A path component may resemble or map exactly to a file system path, but does not always imply a relation to one. If an authority component is present, then the path component must either be empty or begin with a slash (/). If an authority component is absent, then the path cannot begin with an empty segment, that is with two slashes (//), as the following characters would be interpreted as an authority component. The final segment of the path may be referred to as a 'slug'.
|
inlinenoexcept |
An optional port subcomponent preceded by a colon (:).
|
inlinenoexcept |
An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data.
Its syntax is not well defined, but by convention is most often a sequence of attribute–value pairs separated by a delimiter.
|
inlinenoexcept |
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-).
Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. Examples of popular schemes include http, https, ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.
|
inlinenoexcept |
An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@).
Use of the format username:password in the userinfo subcomponent is deprecated for security reasons. Applications should not render as clear text any data after the first colon (:) found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password).
|
inlinenoexcept |
An optional fragment component preceded by a hash (#).
The fragment contains a fragment identifier providing direction to a secondary resource, such as a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an getEntityID attribute of a specific element, and web browsers will scroll this element into view.
|
inlinenoexcept |
A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address.
IPv4 addresses must be in dot-decimal notation, and IPv6 addresses must be enclosed in brackets ([]).
|
inlinenoexcept |
A path component, consisting of a sequence of path segments separated by a slash (/).
A path is always defined for a URI, though the defined path may be empty (zero length). A segment may also be empty, resulting in two consecutive slashes (//) in the path component. A path component may resemble or map exactly to a file system path, but does not always imply a relation to one. If an authority component is present, then the path component must either be empty or begin with a slash (/). If an authority component is absent, then the path cannot begin with an empty segment, that is with two slashes (//), as the following characters would be interpreted as an authority component. The final segment of the path may be referred to as a 'slug'.
|
inlinenoexcept |
An optional port subcomponent preceded by a colon (:).
|
inlinenoexcept |
An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data.
Its syntax is not well defined, but by convention is most often a sequence of attribute–value pairs separated by a delimiter.
|
inlinenoexcept |
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-).
Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. Examples of popular schemes include http, https, ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.
|
inlinenoexcept |
An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@).
Use of the format username:password in the userinfo subcomponent is deprecated for security reasons. Applications should not render as clear text any data after the first colon (:) found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password).
|
inlinenoexcept |
|
inlinenoexcept |
Checks if the fragment is a nested URI.
|
noexcept |
Checks if the parsed URI contains any nested part.
|
inlinenoexcept |
|
inlinenoexcept |
Checks if the user-info is a nested URI.
|
private |
|
inline |
An optional fragment component preceded by a hash (#).
The fragment contains a fragment identifier providing direction to a secondary resource, such as a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an getEntityID attribute of a specific element, and web browsers will scroll this element into view.
|
inline |
A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address.
IPv4 addresses must be in dot-decimal notation, and IPv6 addresses must be enclosed in brackets ([]).
|
inline |
A path component, consisting of a sequence of path segments separated by a slash (/).
A path is always defined for a URI, though the defined path may be empty (zero length). A segment may also be empty, resulting in two consecutive slashes (//) in the path component. A path component may resemble or map exactly to a file system path, but does not always imply a relation to one. If an authority component is present, then the path component must either be empty or begin with a slash (/). If an authority component is absent, then the path cannot begin with an empty segment, that is with two slashes (//), as the following characters would be interpreted as an authority component. The final segment of the path may be referred to as a 'slug'.
|
inline |
An optional port subcomponent preceded by a colon (:).
|
inline |
An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data.
Its syntax is not well defined, but by convention is most often a sequence of attribute–value pairs separated by a delimiter.
|
inline |
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-).
Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. Examples of popular schemes include http, https, ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.
|
inline |
An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@).
Use of the format username:password in the userinfo subcomponent is deprecated for security reasons. Applications should not render as clear text any data after the first colon (:) found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password).
| String CeresEngine::URI::toString | ( | ) | const |
Converts the URI object into it's string representation.
|
private |
|
private |
An optional fragment component preceded by a hash (#).
The fragment contains a fragment identifier providing direction to a secondary resource, such as a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an getEntityID attribute of a specific element, and web browsers will scroll this element into view.
|
private |
A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address.
IPv4 addresses must be in dot-decimal notation, and IPv6 addresses must be enclosed in brackets ([]).
|
private |
A path component, consisting of a sequence of path segments separated by a slash (/).
A path is always defined for a URI, though the defined path may be empty (zero length). A segment may also be empty, resulting in two consecutive slashes (//) in the path component. A path component may resemble or map exactly to a file system path, but does not always imply a relation to one. If an authority component is present, then the path component must either be empty or begin with a slash (/). If an authority component is absent, then the path cannot begin with an empty segment, that is with two slashes (//), as the following characters would be interpreted as an authority component. The final segment of the path may be referred to as a 'slug'.
|
private |
An optional port subcomponent preceded by a colon (:).
|
private |
An optional query component preceded by a question mark (?), containing a query string of non-hierarchical data.
Its syntax is not well defined, but by convention is most often a sequence of attribute–value pairs separated by a delimiter.
|
private |
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-).
Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. Examples of popular schemes include http, https, ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.
|
private |
An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at symbol (@).
Use of the format username:password in the userinfo subcomponent is deprecated for security reasons. Applications should not render as clear text any data after the first colon (:) found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password).