Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Network::URI Class Reference

A helper class for the reading and using of Uniform Resource Identifiers. More...

#include <uri.h>

+ Collaboration diagram for Mezzanine::Network::URI:

Public Types

typedef std::pair< Boole, Char8DecodeResult
 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.
 
URIAddQueryParameter (const String &Param, const String &Value)
 Adds a single param/value pair to the Query of this URI. More...
 
URIClear ()
 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 StringGetFragment () const
 Gets the Fragment component of the URI. More...
 
const StringGetHost () 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 StringGetPath () const
 Gets the Path component of the URI. More...
 
UInt16 GetPort () const
 Gets the Port component of the URI. More...
 
const StringGetQuery () const
 Gets the Query component of the URI. More...
 
const StringGetScheme () const
 Gets the Scheme component of the URI. More...
 
const StringGetUserInfo () 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...
 
URINormalize ()
 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...
 
URIParseFromString (const String &ToParse)
 Parses the contents of a String into this URI. More...
 
URIRemoveDotSegments (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...
 
URISetAuthority (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...
 
URISetFragment (const String &Fragment)
 Sets the Fragment component of the URI. More...
 
URISetHost (const String &Host)
 Sets the Host component of the URI. More...
 
URISetHost (const IPAddress &Host)
 Sets the Host component of the URI. More...
 
URISetPath (const String &Port)
 Sets the Path component of the URI. More...
 
URISetPort (const UInt16 Port)
 Sets the Port component of the URI. More...
 
URISetQuery (const String &Query)
 Sets the Query component of the URI. More...
 
URISetScheme (const String &Scheme)
 Sets the Scheme component of the URI. More...
 
URISetUserInfo (const String &UserInfo)
 Sets the User Information component of the URI. More...
 
URISwap (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.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParseAuthorityNoSlash (StringIterator &CurrIt, const StringIterator EndIt)
 Parses the Authority of a URI String, without checking for the preceding slashes.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParseFragment (StringIterator CurrIt, const StringIterator EndIt)
 Parses the Fragment of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParseHost (StringIterator CurrIt, const StringIterator EndIt)
 Parses the Host of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParsePath (StringIterator CurrIt, const StringIterator EndIt)
 Parses the Path of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParsePathQueryFrag (StringIterator &CurrIt, const StringIterator EndIt)
 Parses the Path, Query, and Fragment components of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParsePort (StringIterator CurrIt, const StringIterator EndIt)
 Parses the Port of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParseQuery (StringIterator CurrIt, const StringIterator EndIt)
 Parses the Query of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParseScheme (StringIterator CurrIt, const StringIterator EndIt)
 Parses the Scheme of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 
void ParseUserInfo (StringIterator CurrIt, const StringIterator EndIt)
 Parses the User Information of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
More...
 

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...
 

Detailed Description

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.

Definition at line 59 of file uri.h.

Constructor & Destructor Documentation

Mezzanine::Network::URI::URI ( const URI Other)

Copy constructor.

Parameters
OtherThe other URI to be copied.

Definition at line 115 of file uri.cpp.

Mezzanine::Network::URI::URI ( const String ToParse)

Parsing constructor.

Parameters
ToParseThe String to be parsed by this URI.

Definition at line 125 of file uri.cpp.

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.

Parameters
SchemeThe Scheme component of the URI.
UserInfoThe User Information component of the URI.
HostThe Host component of the URI.
PortThe Port on the Host to use for connections to access the resource.
PathThe Path on the Host to the resource.
QueryThe Query component of the URI.
FragmentThe Fragment component of the URI.

Definition at line 128 of file uri.cpp.

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.

Parameters
SchemeThe Scheme component of the URI.
UserInfoThe User Information component of the URI.
HostThe Host component of the URI.
PortThe Port on the Host to use for connections to access the resource.
PathThe Path on the Host to the resource.
QueryThe Query component of the URI.
FragmentThe Fragment component of the URI.

Definition at line 138 of file uri.cpp.

Member Function Documentation

URI & Mezzanine::Network::URI::AddQueryParameter ( const String Param,
const String Value 
)

Adds a single param/value pair to the Query of this URI.

Remarks
Delimiters will automatically be generated when using this method, so any reserved characters that are used in either part will be percent encoded. If anything is already percent encoded, the percent character will get percent encoded. So use with care.
Parameters
ParamThe name of the parameter to append.
ValueThe value of the parameter to append.
Returns
Returns a reference to this.

Definition at line 771 of file uri.cpp.

URI & Mezzanine::Network::URI::Clear ( )

Reverts this URI to a blank slate.

Returns
Returns a reference to this.

Definition at line 640 of file uri.cpp.

String Mezzanine::Network::URI::ConvertToString ( ) const

Combines the set components of this URI into a usable String for transmission.

Returns
Returns a valid String representation of this URI.

Definition at line 747 of file uri.cpp.

String Mezzanine::Network::URI::GetAuthority ( ) const

Gets the Authority Fragments of the URI.

Returns
Returns a String containing the full Authority of this URI.

Definition at line 913 of file uri.cpp.

UInt16 Mezzanine::Network::URI::GetDefaultPort ( const String Scheme)
static

Gets the default port for a named protocol.

Remarks
The String passed in is expected to be in lower case, this operation is not performed for you. This also only gets the default ports for protocols that the Mezzanine recognizes and that have URI schemes. This is not meant to be completely comprehensive.
Parameters
SchemeThe name of the Scheme/protocol to get the default port of, in lower case.
Returns
Returns the Port the specified Scheme defaults to, or 0 if the Scheme was not recognized.

Definition at line 460 of file uri.cpp.

const String & Mezzanine::Network::URI::GetFragment ( ) const

Gets the Fragment component of the URI.

Returns
Returns a const reference to a String containing the Fragment of this URI.

Definition at line 900 of file uri.cpp.

const String & Mezzanine::Network::URI::GetHost ( ) const

Gets the Host component of the URI.

Returns
Returns a const reference to a String containing the Host of this URI.

Definition at line 855 of file uri.cpp.

String Mezzanine::Network::URI::GetParameterValue ( const String Param) const

Gets the set value for a specific parameter in the Query of this URI.

Parameters
ParamThe name of the parameter to retrieve the value of.
Returns
Returns the currently set value of the named parameter, or an empty String if it does not exist/is not set.

Definition at line 779 of file uri.cpp.

const String & Mezzanine::Network::URI::GetPath ( ) const

Gets the Path component of the URI.

Returns
Returns a const reference to a String containing the Path of this URI.

Definition at line 876 of file uri.cpp.

UInt16 Mezzanine::Network::URI::GetPort ( ) const

Gets the Port component of the URI.

Returns
Returns a const reference to a String containing the Port of this URI.

Definition at line 864 of file uri.cpp.

const String & Mezzanine::Network::URI::GetQuery ( ) const

Gets the Query component of the URI.

Returns
Returns a const reference to a String containing the Query of this URI.

Definition at line 888 of file uri.cpp.

const String & Mezzanine::Network::URI::GetScheme ( ) const

Gets the Scheme component of the URI.

Returns
Returns a const reference to a String containing the Scheme of this URI.

Definition at line 817 of file uri.cpp.

const String & Mezzanine::Network::URI::GetUserInfo ( ) const

Gets the User Information component of the URI.

Returns
Returns a const reference to a String containing the User Information of this URI.

Definition at line 829 of file uri.cpp.

Boole Mezzanine::Network::URI::HasAuthority ( ) const

Gets whether or not any Authority component of the URI has been set.

Returns
Returns true if anything has been set for the Authority, false otherwise.

Definition at line 928 of file uri.cpp.

Boole Mezzanine::Network::URI::HasFragment ( ) const

Gets whether or not the Fragment component of the URI has been set.

Returns
Returns true if anything has been set as a Fragment, false otherwise.

Definition at line 903 of file uri.cpp.

Boole Mezzanine::Network::URI::HasHost ( ) const

Gets whether or not the Host component of the URI has been set.

Returns
Returns true if anything has been set for the Host, false otherwise.

Definition at line 858 of file uri.cpp.

Boole Mezzanine::Network::URI::HasPath ( ) const

Gets whether or not the Path component of the URI has been set.

Returns
Returns true if anything has been set for the Path, false otherwise.

Definition at line 879 of file uri.cpp.

Boole Mezzanine::Network::URI::HasPort ( ) const

Gets whether or not the Port component of the URI has been set.

Returns
Returns true if anything has been set for the Port, false otherwise.

Definition at line 867 of file uri.cpp.

Boole Mezzanine::Network::URI::HasQuery ( ) const

Gets whether or not the Query component of the URI has been set.

Returns
Returns true if anything has been set as a Query, false otherwise.

Definition at line 891 of file uri.cpp.

Boole Mezzanine::Network::URI::HasQueryParameter ( const String Param) const

Checks if the named parameter exists in this URI.

Parameters
ParamThe name of the parameter to check for.
Returns
Returns true of the named Parameter exists in this URI.

Definition at line 794 of file uri.cpp.

Boole Mezzanine::Network::URI::HasScheme ( ) const

Gets whether or not the Scheme component of the URI has been set.

Returns
Returns true if anything has been set as the Scheme, false otherwise.

Definition at line 820 of file uri.cpp.

Boole Mezzanine::Network::URI::HasUserInfo ( ) const

Gets whether or not the User Information component of the URI has been set.

Returns
Returns true if anything has been set for the User Information, false otherwise.

Definition at line 832 of file uri.cpp.

Boole Mezzanine::Network::URI::IsAbsolute ( ) const

Gets whether or not this URI points to an absolute resource location.

Returns
Returns true if this URI is absolute, false otherwise.

Definition at line 533 of file uri.cpp.

Boole Mezzanine::Network::URI::IsEmpty ( ) const

Checks to see if the URI is currently empty.

Returns
Returns true if all components of this URI are not set, false otherwise.

Definition at line 652 of file uri.cpp.

Boole Mezzanine::Network::URI::IsHierarchical ( ) const

Gets whether or not this URI has hierarchical components.

Returns
Returns true if this URI has hierarchical components, false otherwise.

Definition at line 542 of file uri.cpp.

Boole Mezzanine::Network::URI::IsOpaque ( ) const

Gets whether or not this URI lacks a hierarchy.

Returns
Returns true if this URI lacks a hierarchy, false otherwise.

Definition at line 539 of file uri.cpp.

Boole Mezzanine::Network::URI::IsRelative ( ) const

Gets whether or not this URI points to a relative resource location.

Returns
Returns true if this URI is intended to be relative to another URI, false otherwise.

Definition at line 536 of file uri.cpp.

URI & Mezzanine::Network::URI::Normalize ( )

Makes minor adjustments to the content of this URI to make it easier to process/compare.

Remarks
This method makes a small series of adjustments to the URI to make it easier to read by humans and computers alike, these adjustments include:
  1. Drop everything that is case in-sensitive to lower case.
  2. Remove frivolous components in the path. For example a path like "./[anything]/.." means nothing at all.
  3. Decode unreserved percent encoded characters. Only certain characters need to be percent encoded. Encoding more than those wastes space.
  4. If the port is a default port for the Scheme, it will be removed.
Returns
Returns a reference to this.

Definition at line 589 of file uri.cpp.

Boole Mezzanine::Network::URI::operator!= ( const URI Other) const

Inequality Comparison Operator.

Parameters
OtherThe other URI to compare to.
Returns
Returns true if the two URI's are not equal, false otherwise.

Definition at line 956 of file uri.cpp.

void Mezzanine::Network::URI::operator= ( const URI Other)

Assignment Operator.

Parameters
OtherThe other URI to be assigned to this.

Definition at line 934 of file uri.cpp.

Boole Mezzanine::Network::URI::operator== ( const URI Other) const

Equality Comparison Operator.

Parameters
OtherThe other URI to compare to.
Returns
Returns true if the two URI's are equal, false otherwise.

Definition at line 945 of file uri.cpp.

void Mezzanine::Network::URI::ParseAuthority ( StringIterator CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Authority of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 264 of file uri.cpp.

void Mezzanine::Network::URI::ParseAuthorityNoSlash ( StringIterator CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Authority of a URI String, without checking for the preceding slashes.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 275 of file uri.cpp.

void Mezzanine::Network::URI::ParseFragment ( StringIterator  CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Fragment of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 249 of file uri.cpp.

URI & Mezzanine::Network::URI::ParseFromString ( const String ToParse)

Parses the contents of a String into this URI.

Remarks
This will overwrite the contents of this URI. If there is a failure during parsing the contents of this URI will be cleared.
Parameters
ToParseThe String to be parsed.
Returns
Returns a reference to this.

Definition at line 707 of file uri.cpp.

void Mezzanine::Network::URI::ParseHost ( StringIterator  CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Host of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 184 of file uri.cpp.

void Mezzanine::Network::URI::ParsePath ( StringIterator  CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Path of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 219 of file uri.cpp.

void Mezzanine::Network::URI::ParsePathQueryFrag ( StringIterator CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Path, Query, and Fragment components of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 318 of file uri.cpp.

void Mezzanine::Network::URI::ParsePort ( StringIterator  CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Port of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 199 of file uri.cpp.

void Mezzanine::Network::URI::ParseQuery ( StringIterator  CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Query of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 234 of file uri.cpp.

void Mezzanine::Network::URI::ParseScheme ( StringIterator  CurrIt,
const StringIterator  EndIt 
)
protected

Parses the Scheme of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 151 of file uri.cpp.

void Mezzanine::Network::URI::ParseUserInfo ( StringIterator  CurrIt,
const StringIterator  EndIt 
)
protected

Parses the User Information of a URI String.

Exceptions
Ifan invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.

Parameters
CurrItA modifiable iterator to the current character in the parsing operation.
EndItThen end of the character sequence being parsed.

Definition at line 169 of file uri.cpp.

String Mezzanine::Network::URI::PercentDecode ( const String ToDecode,
const Boole  PlusToSpace = false 
)
static

Creates a duplicate String with all percent encodings decoded and appends that to the destination String.

Parameters
ToDecodeThe String to be decoded.
PlusToSpaceIf true, will decode all Plus signs to spaces.
Returns
A String containing the decoded contents of "ToDecode".

Definition at line 409 of file uri.cpp.

void Mezzanine::Network::URI::PercentDecode ( const String ToDecode,
String Destination,
const Boole  PlusToSpace = false 
)
static

Creates a duplicate String with all percent encodings decoded and appends that to the destination String.

Parameters
ToDecodeThe String to be decoded.
DestinationThe String to append the result to. Contents of this String are NOT cleared by this method before appending.
PlusToSpaceIf true, will decode all Plus signs to spaces.

Definition at line 430 of file uri.cpp.

URI::DecodeResult Mezzanine::Network::URI::PercentDecodeSingle ( const String ToDecode)
static

Converts a String that is percent encoded into it's appropriate character.

Remarks
This method expects the String parameter to be exactly 3 characters long.
Parameters
ToDecodeThe String to be decoded into the original character.
Returns
Returns the decoded Character, or a NULL character (0) in the event of a failure.

Definition at line 360 of file uri.cpp.

void Mezzanine::Network::URI::PercentDecodeSingle ( const String ToDecode,
String Destination 
)
static

Decodes a single percent encoding to it's actual character and appends that to the destination String.

Parameters
ToDecodeThe 3-Character Percent Encoded String to be decoded.
DestinationThe String to append the result to. Contents of this String are NOT cleared by this method before appending.

Definition at line 394 of file uri.cpp.

String Mezzanine::Network::URI::PercentEncode ( const String ToEncode,
const String AdditionalDelims 
)
static

Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String.

Parameters
ToEncodeThe String to be encoded.
AdditionalDelimsA 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.
Returns
A String containing the encoded contents of "ToEncode".

Definition at line 402 of file uri.cpp.

void Mezzanine::Network::URI::PercentEncode ( const String ToEncode,
String Destination,
const String AdditionalDelims 
)
static

Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String.

Parameters
ToEncodeThe String to be encoded.
DestinationThe String to append the result to. Contents of this String are NOT cleared by this method before appending.
AdditionalDelimsA 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.

Definition at line 416 of file uri.cpp.

String Mezzanine::Network::URI::PercentEncodeSingle ( const Char8  ToEncode)
static

Converts a character into a percent encoded string that is safe for use in URI's.

Note
Percent encoding permits special characters normally used as delimiters by the standard to be used in other contexts, so that parsing isn't made more difficult.
Parameters
ToEncodeThe character to be encoded into a percent encode.
Returns
Returns a String containing the percent encoded character that can be used in a URI.

Definition at line 353 of file uri.cpp.

void Mezzanine::Network::URI::PercentEncodeSingle ( const Char8  ToEncode,
String Destination 
)
static

Encodes a single character to it's percent encoding and appends that to the destination String.

Parameters
ToEncodeThe character to be percent encoded.
DestinationThe String to append the result to. Contents of this String are NOT cleared by this method before appending.

Definition at line 389 of file uri.cpp.

void Mezzanine::Network::URI::RemoveDotSegments ( String ToRemove,
const Boole  Relative 
)
static

Removes frivolous parts of the path that mean nothing.

Remarks
For example a path like "./[anything]/.." means nothing at all.
Parameters
ToRemoveThe path component of a URI to remove the dot segments from.
RelativeWhether or not the URI is relative, in which case it will preserve relative dot segments at the start of the path.
Todo:
This permits dot segments that move up the directory hierarchy to be at the start of the path. Research needs to be done to determine if this is explicitly a part of the specification and/or how often it is used. Until then some of this code will be commented out to protect from directory traversal attacks.

Definition at line 491 of file uri.cpp.

URI & Mezzanine::Network::URI::RemoveDotSegments ( const Boole  Relative)

Removes frivolous parts of the path that mean nothing.

Remarks
For example a path like "./[anything]/.." means nothing at all.
Parameters
RelativeWhether or not this URI is relative, in which case it will preserve relative dot segments at the start of the path.
Returns
Returns a reference to this.

Definition at line 622 of file uri.cpp.

URI Mezzanine::Network::URI::Resolve ( const URI Relative) const

Computes the absolute referenced URI from a relative URI and the absolute URI it is relative to.

Parameters
OtherThe other URI to resolve against. Must me relative.
Returns
Returns a new absolute URI to the referenced resource.

Definition at line 663 of file uri.cpp.

URI & Mezzanine::Network::URI::SetAuthority ( const String Authority)

Sets the Authority Fragments of the URI.

Note
The Authority of a URI is the User Information, Host, and Port combined.
Exceptions
Ifthe delimiters are improperly set or there is otherwise a parsing error an exception will be thrown.
Parameters
AuthorityA String containing properly delimited and encoded User Information, Host, and Port values.
Returns
Returns a reference to this.

Definition at line 906 of file uri.cpp.

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.

Parameters
SchemeThe Scheme component of the URI.
UserInfoThe User Information component of the URI.
HostThe Host component of the URI.
PortThe Port on the Host to use for connections to access the resource.
PathThe Path on the Host to the resource.
QueryThe Query component of the URI.
FragmentThe Fragment component of the URI.

Definition at line 545 of file uri.cpp.

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.

Parameters
SchemeThe Scheme component of the URI.
UserInfoThe User Information component of the URI.
HostThe Host component of the URI.
PortThe Port on the Host to use for connections to access the resource.
PathThe Path on the Host to the resource.
QueryThe Query component of the URI.
FragmentThe Fragment component of the URI.

Definition at line 556 of file uri.cpp.

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).

Remarks
Use this method with extreme care, forbidden characters will not be caught with this method.
Parameters
SchemeThe Scheme component of the URI.
UserInfoThe User Information component of the URI.
HostThe Host component of the URI.
PortThe Port on the Host to use for connections to access the resource.
PathThe Path on the Host to the resource.
QueryThe Query component of the URI.
FragmentThe Fragment component of the URI.

Definition at line 567 of file uri.cpp.

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).

Remarks
Use this method with extreme care, forbidden characters will not be caught with this method.
Parameters
SchemeThe Scheme component of the URI.
UserInfoThe User Information component of the URI.
HostThe Host component of the URI.
PortThe Port on the Host to use for connections to access the resource.
PathThe Path on the Host to the resource.
QueryThe Query component of the URI.
FragmentThe Fragment component of the URI.

Definition at line 578 of file uri.cpp.

URI & Mezzanine::Network::URI::SetFragment ( const String Fragment)

Sets the Fragment component of the URI.

Parameters
FragmentThe identifier for the specific subsection of the resource to retrieve.
Returns
Returns a reference to this.

Definition at line 894 of file uri.cpp.

URI & Mezzanine::Network::URI::SetHost ( const String Host)

Sets the Host component of the URI.

Parameters
HostThe Host on which the resource specified by the URI is located.
Returns
Returns a reference to this.

Definition at line 835 of file uri.cpp.

URI & Mezzanine::Network::URI::SetHost ( const IPAddress Host)

Sets the Host component of the URI.

Parameters
HostThe IP address of the Host on which the resource specified by the URI is located.
Returns
Returns a reference to this.

Definition at line 841 of file uri.cpp.

URI & Mezzanine::Network::URI::SetPath ( const String Port)

Sets the Path component of the URI.

Parameters
PortThe Path on the host where the resource is located.
Returns
Returns a reference to this.

Definition at line 870 of file uri.cpp.

URI & Mezzanine::Network::URI::SetPort ( const UInt16  Port)

Sets the Port component of the URI.

Parameters
PortThe Port to connect to on the specified Host.
Returns
Returns a reference to this.

Definition at line 861 of file uri.cpp.

URI & Mezzanine::Network::URI::SetQuery ( const String Query)

Sets the Query component of the URI.

Parameters
QueryAdditional non-hierarchical data that is optional.
Returns
Returns a reference to this.

Definition at line 882 of file uri.cpp.

URI & Mezzanine::Network::URI::SetScheme ( const String Scheme)

Sets the Scheme component of the URI.

Parameters
SchemeThe Scheme to be set, which is used to specify the type of resource referenced by this URI.
Returns
Returns a reference to this.

Definition at line 811 of file uri.cpp.

URI & Mezzanine::Network::URI::SetUserInfo ( const String UserInfo)

Sets the User Information component of the URI.

Warning
URI's are often unencrypted, use this feature with care.
Parameters
UserInfoThe User Authentication Information to store in the URI.
Returns
Returns a reference to this.

Definition at line 823 of file uri.cpp.

URI & Mezzanine::Network::URI::Swap ( URI Other)

Swaps the contents of this URI with another.

Parameters
OtherThe other URI to be swapped with.
Returns
Returns a reference to this.

Definition at line 628 of file uri.cpp.

Member Data Documentation

const String Mezzanine::Network::URI::GenDelims = ":/?#[]@"
static

A String containing the generic delimiters for URIs.

Remarks
The characters that appear in this String (which are ":/?#[]@") should be avoided when constructing URIs. If any such characters are found they'll be percent encoded where possible. In some cases exceptions may be thrown as a result of their misuse.

Definition at line 71 of file uri.h.

const String Mezzanine::Network::URI::SubDelims = "!$&'()*+,;="
static

A String containing the sub-delimiters that some URI schemes may use to delimit scheme specific data.

Remarks
The characters in this String (which are "!$&'()*+,;=") are not as specific or rigorous as those in the GenDelims String. They may or may not be used by some schemes and in general should be avoided where possible. Like characters in the GenDelims String, if these characters are found they'll be percent encoded.

Definition at line 76 of file uri.h.

String Mezzanine::Network::URI::URIFragment
protected

The optional Fragment providing additional direction to a subset of the resource.

Definition at line 95 of file uri.h.

String Mezzanine::Network::URI::URIHost
protected

The domain or address of the Host where the resource is located.

Definition at line 86 of file uri.h.

String Mezzanine::Network::URI::URIPath
protected

The path to the resource on the Host machine holding the resource.

Definition at line 89 of file uri.h.

UInt16 Mezzanine::Network::URI::URIPort
protected

The port number on the host to connect to in order to access the resource.

Definition at line 98 of file uri.h.

String Mezzanine::Network::URI::URIQuery
protected

The optional Query to provide additional non-hierarchical information about the resource.

Definition at line 92 of file uri.h.

String Mezzanine::Network::URI::URIScheme
protected

The Scheme of the URI, usually noting the type of data the resource is.

Definition at line 80 of file uri.h.

String Mezzanine::Network::URI::URIUserInfo
protected

The optional user authentication information to be used when accessing the resource.

Definition at line 83 of file uri.h.


The documentation for this class was generated from the following files: