A helper class for the reading and using of Uniform Resource Identifiers. More...
#include <uri.h>
Public Types | |
typedef std::pair< Boole, Char8 > | DecodeResult |
Convenience typedef for storing if a decode was successful and it's result. | |
typedef String::const_iterator | StringIterator |
Convenience typedef for String iterators. | |
Public Member Functions | |
URI () | |
Blank constructor. | |
URI (const URI &Other) | |
Copy constructor. More... | |
URI (const String &ToParse) | |
Parsing constructor. More... | |
URI (const String &Scheme, const String &UserInfo, const String &Host, const String &Port, const String &Path, const String &Query, const String &Fragment) | |
Component constructor. More... | |
URI (const String &Scheme, const String &UserInfo, const String &Host, const UInt16 Port, const String &Path, const String &Query, const String &Fragment) | |
Component constructor. More... | |
~URI () | |
Class destructor. | |
URI & | AddQueryParameter (const String &Param, const String &Value) |
Adds a single param/value pair to the Query of this URI. More... | |
URI & | Clear () |
Reverts this URI to a blank slate. More... | |
String | ConvertToString () const |
Combines the set components of this URI into a usable String for transmission. More... | |
String | GetAuthority () const |
Gets the Authority Fragments of the URI. More... | |
const String & | GetFragment () const |
Gets the Fragment component of the URI. More... | |
const String & | GetHost () const |
Gets the Host component of the URI. More... | |
String | GetParameterValue (const String &Param) const |
Gets the set value for a specific parameter in the Query of this URI. More... | |
const String & | GetPath () const |
Gets the Path component of the URI. More... | |
UInt16 | GetPort () const |
Gets the Port component of the URI. More... | |
const String & | GetQuery () const |
Gets the Query component of the URI. More... | |
const String & | GetScheme () const |
Gets the Scheme component of the URI. More... | |
const String & | GetUserInfo () const |
Gets the User Information component of the URI. More... | |
Boole | HasAuthority () const |
Gets whether or not any Authority component of the URI has been set. More... | |
Boole | HasFragment () const |
Gets whether or not the Fragment component of the URI has been set. More... | |
Boole | HasHost () const |
Gets whether or not the Host component of the URI has been set. More... | |
Boole | HasPath () const |
Gets whether or not the Path component of the URI has been set. More... | |
Boole | HasPort () const |
Gets whether or not the Port component of the URI has been set. More... | |
Boole | HasQuery () const |
Gets whether or not the Query component of the URI has been set. More... | |
Boole | HasQueryParameter (const String &Param) const |
Checks if the named parameter exists in this URI. More... | |
Boole | HasScheme () const |
Gets whether or not the Scheme component of the URI has been set. More... | |
Boole | HasUserInfo () const |
Gets whether or not the User Information component of the URI has been set. More... | |
Boole | IsAbsolute () const |
Gets whether or not this URI points to an absolute resource location. More... | |
Boole | IsEmpty () const |
Checks to see if the URI is currently empty. More... | |
Boole | IsHierarchical () const |
Gets whether or not this URI has hierarchical components. More... | |
Boole | IsOpaque () const |
Gets whether or not this URI lacks a hierarchy. More... | |
Boole | IsRelative () const |
Gets whether or not this URI points to a relative resource location. More... | |
URI & | Normalize () |
Makes minor adjustments to the content of this URI to make it easier to process/compare. More... | |
Boole | operator!= (const URI &Other) const |
Inequality Comparison Operator. More... | |
void | operator= (const URI &Other) |
Assignment Operator. More... | |
Boole | operator== (const URI &Other) const |
Equality Comparison Operator. More... | |
URI & | ParseFromString (const String &ToParse) |
Parses the contents of a String into this URI. More... | |
URI & | RemoveDotSegments (const Boole Relative) |
Removes frivolous parts of the path that mean nothing. More... | |
URI | Resolve (const URI &Relative) const |
Computes the absolute referenced URI from a relative URI and the absolute URI it is relative to. More... | |
URI & | SetAuthority (const String &Authority) |
Sets the Authority Fragments of the URI. More... | |
void | SetComponents (const String &Scheme, const String &UserInfo, const String &Host, const String &Port, const String &Path, const String &Query, const String &Fragment) |
Sets each component of this URI explicitly. More... | |
void | SetComponents (const String &Scheme, const String &UserInfo, const String &Host, const UInt16 Port, const String &Path, const String &Query, const String &Fragment) |
Sets each component of this URI explicitly. More... | |
void | SetComponentsNoParse (const String &Scheme, const String &UserInfo, const String &Host, const String &Port, const String &Path, const String &Query, const String &Fragment) |
Sets each component of this URI explicitly without actually parsing the strings (direct copy). More... | |
void | SetComponentsNoParse (const String &Scheme, const String &UserInfo, const String &Host, const UInt16 Port, const String &Path, const String &Query, const String &Fragment) |
Sets each component of this URI explicitly without actually parsing the strings (direct copy). More... | |
URI & | SetFragment (const String &Fragment) |
Sets the Fragment component of the URI. More... | |
URI & | SetHost (const String &Host) |
Sets the Host component of the URI. More... | |
URI & | SetHost (const IPAddress &Host) |
Sets the Host component of the URI. More... | |
URI & | SetPath (const String &Port) |
Sets the Path component of the URI. More... | |
URI & | SetPort (const UInt16 Port) |
Sets the Port component of the URI. More... | |
URI & | SetQuery (const String &Query) |
Sets the Query component of the URI. More... | |
URI & | SetScheme (const String &Scheme) |
Sets the Scheme component of the URI. More... | |
URI & | SetUserInfo (const String &UserInfo) |
Sets the User Information component of the URI. More... | |
URI & | Swap (URI &Other) |
Swaps the contents of this URI with another. More... | |
Static Public Member Functions | |
static UInt16 | GetDefaultPort (const String &Scheme) |
Gets the default port for a named protocol. More... | |
static String | PercentDecode (const String &ToDecode, const Boole PlusToSpace=false) |
Creates a duplicate String with all percent encodings decoded and appends that to the destination String. More... | |
static void | PercentDecode (const String &ToDecode, String &Destination, const Boole PlusToSpace=false) |
Creates a duplicate String with all percent encodings decoded and appends that to the destination String. More... | |
static DecodeResult | PercentDecodeSingle (const String &ToDecode) |
Converts a String that is percent encoded into it's appropriate character. More... | |
static void | PercentDecodeSingle (const String &ToDecode, String &Destination) |
Decodes a single percent encoding to it's actual character and appends that to the destination String. More... | |
static String | PercentEncode (const String &ToEncode, const String &AdditionalDelims) |
Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String. More... | |
static void | PercentEncode (const String &ToEncode, String &Destination, const String &AdditionalDelims) |
Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String. More... | |
static String | PercentEncodeSingle (const Char8 ToEncode) |
Converts a character into a percent encoded string that is safe for use in URI's. More... | |
static void | PercentEncodeSingle (const Char8 ToEncode, String &Destination) |
Encodes a single character to it's percent encoding and appends that to the destination String. More... | |
static void | RemoveDotSegments (String &ToRemove, const Boole Relative) |
Removes frivolous parts of the path that mean nothing. More... | |
Static Public Attributes | |
static const String | GenDelims = ":/?#[]@" |
A String containing the generic delimiters for URIs. More... | |
static const String | SubDelims = "!$&'()*+,;=" |
A String containing the sub-delimiters that some URI schemes may use to delimit scheme specific data. More... | |
Protected Member Functions | |||
void | ParseAuthority (StringIterator &CurrIt, const StringIterator EndIt) | ||
Parses the Authority of a URI String.
| |||
void | ParseAuthorityNoSlash (StringIterator &CurrIt, const StringIterator EndIt) | ||
Parses the Authority of a URI String, without checking for the preceding slashes.
| |||
void | ParseFragment (StringIterator CurrIt, const StringIterator EndIt) | ||
Parses the Fragment of a URI String.
| |||
void | ParseHost (StringIterator CurrIt, const StringIterator EndIt) | ||
Parses the Host of a URI String.
| |||
void | ParsePath (StringIterator CurrIt, const StringIterator EndIt) | ||
Parses the Path of a URI String.
| |||
void | ParsePathQueryFrag (StringIterator &CurrIt, const StringIterator EndIt) | ||
Parses the Path, Query, and Fragment components of a URI String.
| |||
void | ParsePort (StringIterator CurrIt, const StringIterator EndIt) | ||
Parses the Port of a URI String.
| |||
void | ParseQuery (StringIterator CurrIt, const StringIterator EndIt) | ||
Parses the Query of a URI String.
| |||
void | ParseScheme (StringIterator CurrIt, const StringIterator EndIt) | ||
Parses the Scheme of a URI String.
| |||
void | ParseUserInfo (StringIterator CurrIt, const StringIterator EndIt) | ||
Parses the User Information of a URI String.
| |||
Protected Attributes | |
String | URIFragment |
The optional Fragment providing additional direction to a subset of the resource. More... | |
String | URIHost |
The domain or address of the Host where the resource is located. More... | |
String | URIPath |
The path to the resource on the Host machine holding the resource. More... | |
UInt16 | URIPort |
The port number on the host to connect to in order to access the resource. More... | |
String | URIQuery |
The optional Query to provide additional non-hierarchical information about the resource. More... | |
String | URIScheme |
The Scheme of the URI, usually noting the type of data the resource is. More... | |
String | URIUserInfo |
The optional user authentication information to be used when accessing the resource. More... | |
A helper class for the reading and using of Uniform Resource Identifiers.
This is a glorified String parser built according to the RFC 3986 specification. There are a few quirks about it's use.
Mezzanine::Network::URI::URI | ( | const URI & | Other | ) |
Mezzanine::Network::URI::URI | ( | const String & | ToParse | ) |
Mezzanine::Network::URI::URI | ( | const String & | Scheme, |
const String & | UserInfo, | ||
const String & | Host, | ||
const String & | Port, | ||
const String & | Path, | ||
const String & | Query, | ||
const String & | Fragment | ||
) |
Component constructor.
Scheme | The Scheme component of the URI. |
UserInfo | The User Information component of the URI. |
Host | The Host component of the URI. |
Port | The Port on the Host to use for connections to access the resource. |
Path | The Path on the Host to the resource. |
Query | The Query component of the URI. |
Fragment | The Fragment component of the URI. |
Mezzanine::Network::URI::URI | ( | const String & | Scheme, |
const String & | UserInfo, | ||
const String & | Host, | ||
const UInt16 | Port, | ||
const String & | Path, | ||
const String & | Query, | ||
const String & | Fragment | ||
) |
Component constructor.
Scheme | The Scheme component of the URI. |
UserInfo | The User Information component of the URI. |
Host | The Host component of the URI. |
Port | The Port on the Host to use for connections to access the resource. |
Path | The Path on the Host to the resource. |
Query | The Query component of the URI. |
Fragment | The Fragment component of the URI. |
Adds a single param/value pair to the Query of this URI.
Param | The name of the parameter to append. |
Value | The value of the parameter to append. |
URI & Mezzanine::Network::URI::Clear | ( | ) |
String Mezzanine::Network::URI::ConvertToString | ( | ) | const |
String Mezzanine::Network::URI::GetAuthority | ( | ) | const |
Gets the default port for a named protocol.
Scheme | The name of the Scheme/protocol to get the default port of, in lower case. |
const String & Mezzanine::Network::URI::GetFragment | ( | ) | const |
const String & Mezzanine::Network::URI::GetHost | ( | ) | const |
const String & Mezzanine::Network::URI::GetPath | ( | ) | const |
UInt16 Mezzanine::Network::URI::GetPort | ( | ) | const |
const String & Mezzanine::Network::URI::GetQuery | ( | ) | const |
const String & Mezzanine::Network::URI::GetScheme | ( | ) | const |
const String & Mezzanine::Network::URI::GetUserInfo | ( | ) | const |
Boole Mezzanine::Network::URI::HasAuthority | ( | ) | const |
Boole Mezzanine::Network::URI::HasFragment | ( | ) | const |
Boole Mezzanine::Network::URI::HasHost | ( | ) | const |
Boole Mezzanine::Network::URI::HasPath | ( | ) | const |
Boole Mezzanine::Network::URI::HasPort | ( | ) | const |
Boole Mezzanine::Network::URI::HasQuery | ( | ) | const |
Boole Mezzanine::Network::URI::HasScheme | ( | ) | const |
Boole Mezzanine::Network::URI::HasUserInfo | ( | ) | const |
Boole Mezzanine::Network::URI::IsAbsolute | ( | ) | const |
Boole Mezzanine::Network::URI::IsEmpty | ( | ) | const |
Boole Mezzanine::Network::URI::IsHierarchical | ( | ) | const |
Boole Mezzanine::Network::URI::IsOpaque | ( | ) | const |
Boole Mezzanine::Network::URI::IsRelative | ( | ) | const |
URI & Mezzanine::Network::URI::Normalize | ( | ) |
Makes minor adjustments to the content of this URI to make it easier to process/compare.
void Mezzanine::Network::URI::operator= | ( | const URI & | Other | ) |
|
protected |
Parses the Authority of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Authority of a URI String, without checking for the preceding slashes.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Fragment of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Host of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Path of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Path, Query, and Fragment components of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Port of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Query of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the Scheme of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
protected |
Parses the User Information of a URI String.
If | an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown. |
CurrIt | A modifiable iterator to the current character in the parsing operation. |
EndIt | Then end of the character sequence being parsed. |
|
static |
Creates a duplicate String with all percent encodings decoded and appends that to the destination String.
ToDecode | The String to be decoded. |
PlusToSpace | If true, will decode all Plus signs to spaces. |
|
static |
Creates a duplicate String with all percent encodings decoded and appends that to the destination String.
ToDecode | The String to be decoded. |
Destination | The String to append the result to. Contents of this String are NOT cleared by this method before appending. |
PlusToSpace | If true, will decode all Plus signs to spaces. |
|
static |
Converts a String that is percent encoded into it's appropriate character.
ToDecode | The String to be decoded into the original character. |
|
static |
Decodes a single percent encoding to it's actual character and appends that to the destination String.
ToDecode | The 3-Character Percent Encoded String to be decoded. |
Destination | The String to append the result to. Contents of this String are NOT cleared by this method before appending. |
|
static |
Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String.
ToEncode | The String to be encoded. |
AdditionalDelims | A String containing additional delimiters to encode. Characters in the GenDelims static String are always encoded. In most cases an empty string is appropriate to be passed in. |
|
static |
Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String.
ToEncode | The String to be encoded. |
Destination | The String to append the result to. Contents of this String are NOT cleared by this method before appending. |
AdditionalDelims | A String containing additional delimiters to encode. Characters in the GenDelims static String are always encoded. In most cases an empty string is appropriate to be passed in. |
Converts a character into a percent encoded string that is safe for use in URI's.
ToEncode | The character to be encoded into a percent encode. |
|
static |
Encodes a single character to it's percent encoding and appends that to the destination String.
ToEncode | The character to be percent encoded. |
Destination | The String to append the result to. Contents of this String are NOT cleared by this method before appending. |
Removes frivolous parts of the path that mean nothing.
ToRemove | The path component of a URI to remove the dot segments from. |
Relative | Whether or not the URI is relative, in which case it will preserve relative dot segments at the start of the path. |
Removes frivolous parts of the path that mean nothing.
Relative | Whether or not this URI is relative, in which case it will preserve relative dot segments at the start of the path. |
Sets the Authority Fragments of the URI.
If | the delimiters are improperly set or there is otherwise a parsing error an exception will be thrown. |
Authority | A String containing properly delimited and encoded User Information, Host, and Port values. |
void Mezzanine::Network::URI::SetComponents | ( | const String & | Scheme, |
const String & | UserInfo, | ||
const String & | Host, | ||
const String & | Port, | ||
const String & | Path, | ||
const String & | Query, | ||
const String & | Fragment | ||
) |
Sets each component of this URI explicitly.
Scheme | The Scheme component of the URI. |
UserInfo | The User Information component of the URI. |
Host | The Host component of the URI. |
Port | The Port on the Host to use for connections to access the resource. |
Path | The Path on the Host to the resource. |
Query | The Query component of the URI. |
Fragment | The Fragment component of the URI. |
void Mezzanine::Network::URI::SetComponents | ( | const String & | Scheme, |
const String & | UserInfo, | ||
const String & | Host, | ||
const UInt16 | Port, | ||
const String & | Path, | ||
const String & | Query, | ||
const String & | Fragment | ||
) |
Sets each component of this URI explicitly.
Scheme | The Scheme component of the URI. |
UserInfo | The User Information component of the URI. |
Host | The Host component of the URI. |
Port | The Port on the Host to use for connections to access the resource. |
Path | The Path on the Host to the resource. |
Query | The Query component of the URI. |
Fragment | The Fragment component of the URI. |
void Mezzanine::Network::URI::SetComponentsNoParse | ( | const String & | Scheme, |
const String & | UserInfo, | ||
const String & | Host, | ||
const String & | Port, | ||
const String & | Path, | ||
const String & | Query, | ||
const String & | Fragment | ||
) |
Sets each component of this URI explicitly without actually parsing the strings (direct copy).
Scheme | The Scheme component of the URI. |
UserInfo | The User Information component of the URI. |
Host | The Host component of the URI. |
Port | The Port on the Host to use for connections to access the resource. |
Path | The Path on the Host to the resource. |
Query | The Query component of the URI. |
Fragment | The Fragment component of the URI. |
void Mezzanine::Network::URI::SetComponentsNoParse | ( | const String & | Scheme, |
const String & | UserInfo, | ||
const String & | Host, | ||
const UInt16 | Port, | ||
const String & | Path, | ||
const String & | Query, | ||
const String & | Fragment | ||
) |
Sets each component of this URI explicitly without actually parsing the strings (direct copy).
Scheme | The Scheme component of the URI. |
UserInfo | The User Information component of the URI. |
Host | The Host component of the URI. |
Port | The Port on the Host to use for connections to access the resource. |
Path | The Path on the Host to the resource. |
Query | The Query component of the URI. |
Fragment | The Fragment component of the URI. |
|
static |
A String containing the generic delimiters for URIs.
|
static |
A String containing the sub-delimiters that some URI schemes may use to delimit scheme specific data.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |