Kodi Documentation 23.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
URIParser Namespace Reference

Classes

struct  Components
 Raw URI-reference boundaries in the scanned input. More...
 
struct  Range
 A raw component's byte range, excluding its delimiter. More...
 

Functions

std::optional< std::string_view > GetScheme (std::string_view input)
 Recognize a leading RFC 3986 scheme followed by a colon, regardless of body validity.
 
Components ScanReference (std::string_view input)
 Locate URI-reference components, including those in malformed candidates.
 
std::optional< Components > ParseReference (std::string_view input)
 Validate the RFC 3986 URI-reference production (URI or relative-ref).
 
bool IsURI (std::string_view input)
 Validate the RFC 3986 URI production using ParseReference and requiring a scheme.
 

Function Documentation

◆ GetScheme()

std::optional< std::string_view > URIParser::GetScheme ( std::string_view input)

Recognize a leading RFC 3986 scheme followed by a colon, regardless of body validity.

Parameters
inputURI candidate; native-path intent must be handled by the caller.
Returns
The raw scheme without its colon, or no value if the leading token is not a scheme.
Note
The view is valid until input storage is changed or destroyed. Spelling is preserved; scheme comparisons are case-insensitive. Recognition implies neither validity nor a handler.
See also
https://www.rfc-editor.org/rfc/rfc3986.html#section-3.1
https://www.rfc-editor.org/rfc/rfc3986.html#section-1.2.2

◆ IsURI()

bool URIParser::IsURI ( std::string_view input)

Validate the RFC 3986 URI production using ParseReference and requiring a scheme.

Parameters
inputRaw URI candidate; no native-path precedence is applied.
Returns
True for valid generic URI syntax, independently of scheme/backend support.
Note
Fragments are accepted: URI differs from the fragment-free absolute-URI production.
See also
https://www.rfc-editor.org/rfc/rfc3986.html#section-3
https://www.rfc-editor.org/rfc/rfc3986.html#section-4.3

◆ ParseReference()

std::optional< Components > URIParser::ParseReference ( std::string_view input)

Validate the RFC 3986 URI-reference production (URI or relative-ref).

Parameters
inputRaw ASCII URI-reference, including empty input and optional query/fragment.
Returns
Source ranges on success, or no value for invalid generic syntax.
Note
Only generic syntax is validated, without filesystem/network access or scheme rules. Raw bytes and empty delimiters are preserved. Percent escapes are checked but never decoded; no normalization, query mapping, or relative-reference resolution occurs.
See also
https://www.rfc-editor.org/rfc/rfc3986.html#section-4.1
https://www.rfc-editor.org/rfc/rfc3986.html#section-4.2
https://www.rfc-editor.org/rfc/rfc3986.html#appendix-A

◆ ScanReference()

Components URIParser::ScanReference ( std::string_view input)

Locate URI-reference components, including those in malformed candidates.

Parameters
inputRaw candidate bytes, interpreted only by generic delimiters and GetScheme().
Returns
Source ranges with absent and empty components distinguished; scanning never fails.
Note
This is the lexical layer used by ParseReference and Kodi compatibility handling. Except for the leading scheme token, syntax is not validated. No decoding, normalization, native-path interpretation, or scheme-specific policy is applied.
See also
https://www.rfc-editor.org/rfc/rfc3986.html#section-4.1