Public Member Functions |
| URI () |
| Default Constructor, same as calling a Constructor with all fields empty.
|
| URI (const URI &uri) |
| Constructs a URI as a copy of another URI.
|
| URI (const std::string &uri) |
| Constructs a URI from the given string.
|
| URI (const std::string &scheme, const std::string &ssp, const std::string &fragment) |
| Constructs a URI from the given components.
|
| URI (const std::string &scheme, const std::string &userInfo, const std::string &host, int port, const std::string &path, const std::string &query, const std::string &fragment) |
| Constructs a URI from the given components.
|
| URI (const std::string &scheme, const std::string &host, const std::string &path, const std::string &fragment) |
| Constructs a URI from the given components.
|
| URI (const std::string &scheme, const std::string &authority, const std::string &path, const std::string &query, const std::string &fragment) |
| Constructs a URI from the given components.
|
virtual | ~URI () |
virtual int | compareTo (const URI &value) const |
| Compares this object with the specified object for order.
|
virtual bool | equals (const URI &value) const |
virtual bool | operator== (const URI &value) const |
| Compares equality between this object and the one passed.
|
virtual bool | operator< (const URI &value) const |
| Compares this object to another and returns true if this object is considered to be less than the one passed.
|
std::string | getAuthority () const |
std::string | getFragment () const |
std::string | getHost () const |
std::string | getPath () const |
int | getPort () const |
std::string | getQuery () const |
std::string | getScheme () const |
std::string | getUserInfo () const |
std::string | getRawAuthority () const |
| Returns the raw authority component of this URI.
|
std::string | getRawFragment () const |
| Returns the raw fragment component of this URI.
|
std::string | getRawPath () const |
| Returns the raw path component of this URI.
|
std::string | getRawQuery () const |
| Returns the raw query component of this URI.
|
std::string | getRawSchemeSpecificPart () const |
| Returns the raw scheme-specific part of this URI.
|
std::string | getSchemeSpecificPart () const |
| Returns the decoded scheme-specific part of this URI.
|
std::string | getRawUserInfo () const |
| Returns the raw user-information component of this URI.
|
bool | isAbsolute () const |
| Tells whether or not this URI is absolute.
|
bool | isOpaque () const |
| Tells whether or not this URI is opaque.
|
URI | normalize () const |
| Normalizes this URI's path.
|
URI | parseServerAuthority () const |
| Attempts to parse this URI's authority component, if defined, into user-information, host, and port components.
|
URI | relativize (const URI &uri) const |
| Relativizes the given URI against this URI.
|
URI | resolve (const std::string &str) const |
| Constructs a new URI by parsing the given string and then resolving it against this URI.
|
URI | resolve (const URI &uri) const |
| Resolves the given URI against this URI.
|
std::string | toString () const |
| Returns the content of this URI as a string.
|
URL | toURL () const |
| Constructs a URL from this URI.
|
Static Public Member Functions |
static URI | create (const std::string uri) |
| Creates a URI by parsing the given string.
|
This class represents an instance of a URI as defined by RFC 2396.
std::string decaf::net::URI::getRawAuthority |
( |
| ) |
const |
Returns the raw authority component of this URI.
The authority component of a URI, if defined, only contains the commercial-at character ('@') and characters in the unreserved, punct, escaped, and other categories. If the authority is server-based then it is further constrained to have valid user-information, host, and port components.
- Returns:
- the raw authority component of the URI
std::string decaf::net::URI::getRawPath |
( |
| ) |
const |
Returns the raw path component of this URI.
The path component of a URI, if defined, only contains the slash character ('/'), the commercial-at character ('@'), and characters in the unreserved, punct, escaped, and other categories.
- Returns:
- the raw path component of this URI
URI decaf::net::URI::normalize |
( |
| ) |
const |
Normalizes this URI's path.
If this URI is opaque, or if its path is already in normal form, then this URI is returned. Otherwise a new URI is constructed that is identical to this URI except that its path is computed by normalizing this URI's path in a manner consistent with RFC 2396, section 5.2, step 6, sub-steps c through f; that is:
1. All "." segments are removed. 2. If a ".." segment is preceded by a non-".." segment then both of these segments are removed. This step is repeated until it is no longer applicable. 3. If the path is relative, and if its first segment contains a colon character (':'), then a "." segment is prepended. This prevents a relative URI with a path such as "a:b/c/d" from later being re-parsed as an opaque URI with a scheme of "a" and a scheme-specific part of "b/c/d". (Deviation from RFC 2396)
A normalized path will begin with one or more ".." segments if there were insufficient non-".." segments preceding them to allow their removal. A normalized path will begin with a "." segment if one was inserted by step 3 above. Otherwise, a normalized path will not contain any "." or ".." segments.
- Returns:
- A URI equivalent to this URI, but whose path is in normal form
URI decaf::net::URI::parseServerAuthority |
( |
| ) |
const |
Attempts to parse this URI's authority component, if defined, into user-information, host, and port components.
If this URI's authority component has already been recognized as being server-based then it will already have been parsed into user-information, host, and port components. In this case, or if this URI has no authority component, this method simply returns this URI.
Otherwise this method attempts once more to parse the authority component into user-information, host, and port components, and throws an exception describing why the authority component could not be parsed in that way.
- Returns:
- A URI whose authority field has been parsed as a server-based authority
- Exceptions:
-
URISyntaxException | - If the authority component of this URI is defined but cannot be parsed as a server-based authority. |
URI decaf::net::URI::resolve |
( |
const URI & |
uri | ) |
const |
Resolves the given URI against this URI.
If the given URI is already absolute, or if this URI is opaque, then a copy of the given URI is returned.
If the given URI's fragment component is defined, its path component is empty, and its scheme, authority, and query components are undefined, then a URI with the given fragment but with all other components equal to those of this URI is returned. This allows a URI representing a standalone fragment reference, such as "#foo", to be usefully resolved against a base URI.
Otherwise this method constructs a new hierarchical URI in a manner consistent with RFC 2396, section 5.2; that is:
1. A new URI is constructed with this URI's scheme and the given URI's query and fragment components. 2. If the given URI has an authority component then the new URI's authority and path are taken from the given URI. 3. Otherwise the new URI's authority component is copied from this URI, and its path is computed as follows:
1. If the given URI's path is absolute then the new URI's path is taken from the given URI. 2. Otherwise the given URI's path is relative, and so the new URI's path is computed by resolving the path of the given URI against the path of this URI. This is done by concatenating all but the last segment of this URI's path, if any, with the given URI's path and then normalizing the result as if by invoking the normalize method.
The result of this method is absolute if, and only if, either this URI is absolute or the given URI is absolute.
- Parameters:
-
uri | - The URI to be resolved against this URI |
- Returns:
- The resulting URI
std::string decaf::net::URI::toString |
( |
| ) |
const |
Returns the content of this URI as a string.
If this URI was created by invoking one of the constructors in this class then a string equivalent to the original input string, or to the string computed from the originally-given components, as appropriate, is returned. Otherwise this URI was created by normalization, resolution, or relativization, and so a string is constructed from this URI's components according to the rules specified in RFC 2396, section 5.2, step 7.
- Returns:
- the string form of this URI