|
DART 6.12.2
|
The Uri struct provides URI parsing and merging functionality based on RFC 3986. More...
#include <Uri.hpp>
Public Member Functions | |
| Uri ()=default | |
| Constructor. | |
| Uri (const std::string &_input) | |
| Constructor that takes a URI or local path. | |
| Uri (const char *_input) | |
| Constructor that takes a URI or local path as const char*. | |
| void | clear () |
| Clear the URI by reset()ing all components. | |
| bool | fromString (const std::string &_input) |
| Parse a URI from a string; return success. | |
| bool | fromPath (const std::string &_path) |
| Parse a local path (i.e. | |
| bool | fromStringOrPath (const std::string &_input) |
| Parse a URI or local path (i.e. | |
| bool | fromRelativeUri (const std::string &_base, const std::string &_relative, bool _strict=false) |
| Resolve a relative path reference; return success. | |
| bool | fromRelativeUri (const char *_base, const char *_relative, bool _strict=false) |
| Resolve a relative path reference; return success. | |
| bool | fromRelativeUri (const Uri &_base, const std::string &_relative, bool _strict=false) |
| Resolve a relative path reference; return success. | |
| bool | fromRelativeUri (const Uri &_base, const char *_relative, bool _strict=false) |
| Resolve a relative path reference; return success. | |
| bool | fromRelativeUri (const Uri &_base, const Uri &_relative, bool _strict=false) |
| Resolve a relative path reference; return success. | |
| std::string | toString () const |
| Combine the parts of the URI into a string. | |
| std::string | getPath () const |
| Get the path component of the URI as a string. | |
| std::string | getFilesystemPath () const |
| Get the path in the local filesystem as a string. | |
Static Public Member Functions | |
| static Uri | createFromString (const std::string &_input) |
| Create URI from a string; return an empty URI on failure. | |
| static Uri | createFromPath (const std::string &_path) |
| Create file URI from a string; return an empty URI on failure. | |
| static Uri | createFromStringOrPath (const std::string &_input) |
| Create general URI or file URI from a string; return an empty URI on failure. | |
| static Uri | createFromRelativeUri (const std::string &_base, const std::string &_relative, bool _strict=false) |
| Create URI resolving a relative path reference; return an empty URI on failure. | |
| static Uri | createFromRelativeUri (const Uri &_base, const std::string &_relative, bool _strict=false) |
| Create URI resolving a relative path reference; return an empty URI on failure. | |
| static Uri | createFromRelativeUri (const Uri &_base, const Uri &_relative, bool _strict=false) |
| Create URI resolving a relative path reference; return an empty URI on failure. | |
| static std::string | getUri (const std::string &_input) |
| Parse a URI from a string; return an empty string on failure. | |
| static std::string | getRelativeUri (const std::string &_base, const std::string &_relative, bool _strict=false) |
| Resolve a relative path reference; return an empty string on failure. | |
| static std::string | getRelativeUri (const Uri &_base, const std::string &_relative, bool _strict=false) |
| Resolve a relative path reference; return an empty string on failure. | |
| static std::string | getRelativeUri (const Uri &_base, const Uri &_relative, bool _strict=false) |
| Resolve a relative path reference; return an empty string on failure. | |
Public Attributes | |
| UriComponent | mScheme |
| Scheme, e.g. 'http', 'file', 'package'. | |
| UriComponent | mAuthority |
| Authority, e.g. 'google.com', 'en.wikipedia.org'. | |
| UriComponent | mPath |
| Path, e.g. '/index.html', '/foo/bar.txt'. | |
| UriComponent | mQuery |
| Query string, i.e. the part of the URI after the ? | |
| UriComponent | mFragment |
| Fragment, e.g. the part of the URI after the #. | |
Static Private Member Functions | |
| static std::string | mergePaths (const Uri &_base, const Uri &_relative) |
| Implement section 5.2.3 of RFC 3986. | |
| static std::string | removeDotSegments (const std::string &_path) |
| Implement section 5.2.4 of RFC 3986. | |
The Uri struct provides URI parsing and merging functionality based on RFC 3986.
We have Uri as a struct rather than class to expose member variables. Many ResourceRetreiver classes rewrite URIs to other types of URIs (e.g, resolve 'package://' URIs to 'file://' URIs), which is easier to implement if you have direct access to the URI components.
|
default |
Constructor.
| dart::common::Uri::Uri | ( | const std::string & | _input | ) |
Constructor that takes a URI or local path.
Internally, this is equivalent to calling fromStringOrPath(_input) after default constructor.
We don't declare this constructor as explicit in order to allow implicit conversion from string so that you can pass in string parameter to a function that takes Uri.
| dart::common::Uri::Uri | ( | const char * | _input | ) |
Constructor that takes a URI or local path as const char*.
The behavior is identical to Uri(const std::string&).
| void dart::common::Uri::clear | ( | ) |
Clear the URI by reset()ing all components.
|
static |
Create file URI from a string; return an empty URI on failure.
|
static |
Create URI resolving a relative path reference; return an empty URI on failure.
|
static |
Create URI resolving a relative path reference; return an empty URI on failure.
|
static |
Create URI resolving a relative path reference; return an empty URI on failure.
|
static |
Create URI from a string; return an empty URI on failure.
|
static |
Create general URI or file URI from a string; return an empty URI on failure.
| bool dart::common::Uri::fromPath | ( | const std::string & | _path | ) |
Parse a local path (i.e.
URI with no schema) from a string; return success. Note that the input path should be absolute path. All the components will be cleared on failure.
| bool dart::common::Uri::fromRelativeUri | ( | const char * | _base, |
| const char * | _relative, | ||
| bool | _strict = false |
||
| ) |
Resolve a relative path reference; return success.
All the components will be cleared on failure.
| bool dart::common::Uri::fromRelativeUri | ( | const std::string & | _base, |
| const std::string & | _relative, | ||
| bool | _strict = false |
||
| ) |
Resolve a relative path reference; return success.
All the components will be cleared on failure.
| bool dart::common::Uri::fromRelativeUri | ( | const Uri & | _base, |
| const char * | _relative, | ||
| bool | _strict = false |
||
| ) |
Resolve a relative path reference; return success.
All the components will be cleared on failure.
| bool dart::common::Uri::fromRelativeUri | ( | const Uri & | _base, |
| const std::string & | _relative, | ||
| bool | _strict = false |
||
| ) |
Resolve a relative path reference; return success.
All the components will be cleared on failure.
| bool dart::common::Uri::fromRelativeUri | ( | const Uri & | _base, |
| const Uri & | _relative, | ||
| bool | _strict = false |
||
| ) |
Resolve a relative path reference; return success.
All the components will be cleared on failure.
| bool dart::common::Uri::fromString | ( | const std::string & | _input | ) |
Parse a URI from a string; return success.
All the components will be cleared on failure.
| bool dart::common::Uri::fromStringOrPath | ( | const std::string & | _input | ) |
Parse a URI or local path (i.e.
URI with no schema) from a string; return success. We assume that any string without a scheme is a path. All the components will be cleared on failure.
| std::string dart::common::Uri::getFilesystemPath | ( | ) | const |
| std::string dart::common::Uri::getPath | ( | ) | const |
Get the path component of the URI as a string.
|
static |
Resolve a relative path reference; return an empty string on failure.
|
static |
Resolve a relative path reference; return an empty string on failure.
|
static |
Resolve a relative path reference; return an empty string on failure.
|
static |
Parse a URI from a string; return an empty string on failure.
|
staticprivate |
Implement section 5.2.3 of RFC 3986.
|
staticprivate |
Implement section 5.2.4 of RFC 3986.
| std::string dart::common::Uri::toString | ( | ) | const |
Combine the parts of the URI into a string.
| UriComponent dart::common::Uri::mAuthority |
Authority, e.g. 'google.com', 'en.wikipedia.org'.
| UriComponent dart::common::Uri::mFragment |
Fragment, e.g. the part of the URI after the #.
| UriComponent dart::common::Uri::mPath |
Path, e.g. '/index.html', '/foo/bar.txt'.
| UriComponent dart::common::Uri::mQuery |
Query string, i.e. the part of the URI after the ?
| UriComponent dart::common::Uri::mScheme |
Scheme, e.g. 'http', 'file', 'package'.