Spinning Topp Logo BlackTopp Studios
inc
uri.h
1 // © Copyright 2010 - 2015 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 
41 #ifndef _networkuri_h
42 #define _networkuri_h
43 
44 #include "Network/ipaddress.h"
45 
46 namespace Mezzanine
47 {
48  namespace Network
49  {
50  ///////////////////////////////////////////////////////////////////////////////
51  /// @brief A helper class for the reading and using of Uniform Resource Identifiers.
52  /// @details This is a glorified String parser built according to the RFC 3986 specification.
53  /// There are a few quirks about it's use.
54  /// - With only one exception, delimiters are not stored in components. That exception is slashes in the Path component.
55  /// - This class makes no attempt to distinguish files and folders in the path. In general if you end the path with a folder you should have a trailing slash.
56  /// It's assumed to be a file otherwise and may get truncated as a result.
57  /// - Ampersands or semi-colons are allowed for separating entries in a Query. This class only uses ampersands when writing, but can read either notation.
58  ///////////////////////////////////////
59  class MEZZ_LIB URI
60  {
61  public:
62  /// @brief Convenience typedef for String iterators.
63  typedef String::const_iterator StringIterator;
64  /// @brief Convenience typedef for storing if a decode was successful and it's result.
65  typedef std::pair<Boole,Char8> DecodeResult;
66 
67  /// @brief A String containing the generic delimiters for URIs.
68  /// @remarks The characters that appear in this String (which are ":/?#[]@") should be avoided when constructing URIs.
69  /// If any such characters are found they'll be percent encoded where possible. In some cases exceptions may be thrown
70  /// as a result of their misuse.
71  static const String GenDelims;
72  /// @brief A String containing the sub-delimiters that some URI schemes may use to delimit scheme specific data.
73  /// @remarks The characters in this String (which are "!$&'()*+,;=") are not as specific or rigorous as those in the
74  /// GenDelims String. They may or may not be used by some schemes and in general should be avoided where possible. Like
75  /// characters in the GenDelims String, if these characters are found they'll be percent encoded.
76  static const String SubDelims;
77  protected:
78  /// @internal
79  /// @brief The Scheme of the URI, usually noting the type of data the resource is.
81  /// @internal
82  /// @brief The optional user authentication information to be used when accessing the resource.
84  /// @internal
85  /// @brief The domain or address of the Host where the resource is located.
87  /// @internal
88  /// @brief The path to the resource on the Host machine holding the resource.
90  /// @internal
91  /// @brief The optional Query to provide additional non-hierarchical information about the resource.
93  /// @internal
94  /// @brief The optional Fragment providing additional direction to a subset of the resource.
96  /// @internal
97  /// @brief The port number on the host to connect to in order to access the resource.
99 
100  /// @internal
101  /// @brief Parses the Scheme of a URI String.
102  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
103  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
104  /// @param EndIt Then end of the character sequence being parsed.
105  void ParseScheme(StringIterator CurrIt, const StringIterator EndIt);
106  /// @internal
107  /// @brief Parses the User Information of a URI String.
108  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
109  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
110  /// @param EndIt Then end of the character sequence being parsed.
111  void ParseUserInfo(StringIterator CurrIt, const StringIterator EndIt);
112  /// @internal
113  /// @brief Parses the Host of a URI String.
114  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
115  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
116  /// @param EndIt Then end of the character sequence being parsed.
117  void ParseHost(StringIterator CurrIt, const StringIterator EndIt);
118  /// @internal
119  /// @brief Parses the Port of a URI String.
120  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
121  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
122  /// @param EndIt Then end of the character sequence being parsed.
123  void ParsePort(StringIterator CurrIt, const StringIterator EndIt);
124  /// @internal
125  /// @brief Parses the Path of a URI String.
126  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
127  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
128  /// @param EndIt Then end of the character sequence being parsed.
129  void ParsePath(StringIterator CurrIt, const StringIterator EndIt);
130  /// @internal
131  /// @brief Parses the Query of a URI String.
132  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
133  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
134  /// @param EndIt Then end of the character sequence being parsed.
135  void ParseQuery(StringIterator CurrIt, const StringIterator EndIt);
136  /// @internal
137  /// @brief Parses the Fragment of a URI String.
138  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
139  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
140  /// @param EndIt Then end of the character sequence being parsed.
141  void ParseFragment(StringIterator CurrIt, const StringIterator EndIt);
142  /// @internal
143  /// @brief Parses the Authority of a URI String.
144  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
145  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
146  /// @param EndIt Then end of the character sequence being parsed.
147  void ParseAuthority(StringIterator& CurrIt, const StringIterator EndIt);
148  /// @internal
149  /// @brief Parses the Authority of a URI String, without checking for the preceding slashes.
150  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
151  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
152  /// @param EndIt Then end of the character sequence being parsed.
153  void ParseAuthorityNoSlash(StringIterator& CurrIt, const StringIterator EndIt);
154  /// @internal
155  /// @brief Parses the Path, Query, and Fragment components of a URI String.
156  /// @exception If an invalid character or an error is encountered a SYNTAX_ERROR_EXCEPTION will be thrown.
157  /// @param CurrIt A modifiable iterator to the current character in the parsing operation.
158  /// @param EndIt Then end of the character sequence being parsed.
159  void ParsePathQueryFrag(StringIterator& CurrIt, const StringIterator EndIt);
160  public:
161  /// @brief Blank constructor.
162  URI();
163  /// @brief Copy constructor.
164  /// @param Other The other URI to be copied.
165  URI(const URI& Other);
166  /// @brief Parsing constructor.
167  /// @param ToParse The String to be parsed by this URI.
168  URI(const String& ToParse);
169  /// @brief Component constructor.
170  /// @param Scheme The Scheme component of the URI.
171  /// @param UserInfo The User Information component of the URI.
172  /// @param Host The Host component of the URI.
173  /// @param Port The Port on the Host to use for connections to access the resource.
174  /// @param Path The Path on the Host to the resource.
175  /// @param Query The Query component of the URI.
176  /// @param Fragment The Fragment component of the URI.
177  URI(const String& Scheme, const String& UserInfo, const String& Host, const String& Port, const String& Path, const String& Query, const String& Fragment);
178  /// @brief Component constructor.
179  /// @param Scheme The Scheme component of the URI.
180  /// @param UserInfo The User Information component of the URI.
181  /// @param Host The Host component of the URI.
182  /// @param Port The Port on the Host to use for connections to access the resource.
183  /// @param Path The Path on the Host to the resource.
184  /// @param Query The Query component of the URI.
185  /// @param Fragment The Fragment component of the URI.
186  URI(const String& Scheme, const String& UserInfo, const String& Host, const UInt16 Port, const String& Path, const String& Query, const String& Fragment);
187  /// @brief Class destructor.
188  ~URI();
189 
190  ///////////////////////////////////////////////////////////////////////////////
191  // Percent Encoding
192 
193  /// @brief Converts a character into a percent encoded string that is safe for use in URI's.
194  /// @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.
195  /// @param ToEncode The character to be encoded into a percent encode.
196  /// @return Returns a String containing the percent encoded character that can be used in a URI.
197  static String PercentEncodeSingle(const Char8 ToEncode);
198  /// @brief Converts a String that is percent encoded into it's appropriate character.
199  /// @remarks This method expects the String parameter to be exactly 3 characters long.
200  /// @param ToDecode The String to be decoded into the original character.
201  /// @return Returns the decoded Character, or a NULL character (0) in the event of a failure.
202  static DecodeResult PercentDecodeSingle(const String& ToDecode);
203  /// @brief Encodes a single character to it's percent encoding and appends that to the destination String.
204  /// @param ToEncode The character to be percent encoded.
205  /// @param Destination The String to append the result to. Contents of this String are NOT cleared by this method before appending.
206  static void PercentEncodeSingle(const Char8 ToEncode, String& Destination);
207  /// @brief Decodes a single percent encoding to it's actual character and appends that to the destination String.
208  /// @param ToDecode The 3-Character Percent Encoded String to be decoded.
209  /// @param Destination The String to append the result to. Contents of this String are NOT cleared by this method before appending.
210  static void PercentDecodeSingle(const String& ToDecode, String& Destination);
211 
212  /// @brief Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String.
213  /// @param ToEncode The String to be encoded.
214  /// @param 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.
215  /// @return A String containing the encoded contents of "ToEncode".
216  static String PercentEncode(const String& ToEncode, const String& AdditionalDelims);
217  /// @brief Creates a duplicate String with all percent encodings decoded and appends that to the destination String.
218  /// @param ToDecode The String to be decoded.
219  /// @param PlusToSpace If true, will decode all Plus signs to spaces.
220  /// @return A String containing the decoded contents of "ToDecode".
221  static String PercentDecode(const String& ToDecode, const Boole PlusToSpace = false);
222  /// @brief Creates a duplicate String with all the reserved characters percent encoded and appends that to the destination String.
223  /// @param ToEncode The String to be encoded.
224  /// @param Destination The String to append the result to. Contents of this String are NOT cleared by this method before appending.
225  /// @param 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.
226  static void PercentEncode(const String& ToEncode, String& Destination, const String& AdditionalDelims);
227  /// @brief Creates a duplicate String with all percent encodings decoded and appends that to the destination String.
228  /// @param ToDecode The String to be decoded.
229  /// @param Destination The String to append the result to. Contents of this String are NOT cleared by this method before appending.
230  /// @param PlusToSpace If true, will decode all Plus signs to spaces.
231  static void PercentDecode(const String& ToDecode, String& Destination, const Boole PlusToSpace = false);
232 
233  ///////////////////////////////////////////////////////////////////////////////
234  // Utility
235 
236  /// @brief Gets the default port for a named protocol.
237  /// @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
238  /// protocols that the Mezzanine recognizes and that have URI schemes. This is not meant to be completely comprehensive.
239  /// @param Scheme The name of the Scheme/protocol to get the default port of, in lower case.
240  /// @return Returns the Port the specified Scheme defaults to, or 0 if the Scheme was not recognized.
241  static UInt16 GetDefaultPort(const String& Scheme);
242  /// @brief Removes frivolous parts of the path that mean nothing.
243  /// @remarks For example a path like "./[anything]/.." means nothing at all.
244  /// @param ToRemove The path component of a URI to remove the dot segments from.
245  /// @param Relative Whether or not the URI is relative, in which case it will preserve relative dot segments at the start of the path.
246  static void RemoveDotSegments(String& ToRemove, const Boole Relative);
247 
248  /// @brief Gets whether or not this URI points to an absolute resource location.
249  /// @return Returns true if this URI is absolute, false otherwise.
250  Boole IsAbsolute() const;
251  /// @brief Gets whether or not this URI points to a relative resource location.
252  /// @return Returns true if this URI is intended to be relative to another URI, false otherwise.
253  Boole IsRelative() const;
254  /// @brief Gets whether or not this URI lacks a hierarchy.
255  /// @return Returns true if this URI lacks a hierarchy, false otherwise.
256  Boole IsOpaque() const;
257  /// @brief Gets whether or not this URI has hierarchical components.
258  /// @return Returns true if this URI has hierarchical components, false otherwise.
259  Boole IsHierarchical() const;
260 
261  /// @brief Sets each component of this URI explicitly.
262  /// @param Scheme The Scheme component of the URI.
263  /// @param UserInfo The User Information component of the URI.
264  /// @param Host The Host component of the URI.
265  /// @param Port The Port on the Host to use for connections to access the resource.
266  /// @param Path The Path on the Host to the resource.
267  /// @param Query The Query component of the URI.
268  /// @param Fragment The Fragment component of the URI.
269  void SetComponents(const String& Scheme, const String& UserInfo, const String& Host, const String& Port, const String& Path, const String& Query, const String& Fragment);
270  /// @brief Sets each component of this URI explicitly.
271  /// @param Scheme The Scheme component of the URI.
272  /// @param UserInfo The User Information component of the URI.
273  /// @param Host The Host component of the URI.
274  /// @param Port The Port on the Host to use for connections to access the resource.
275  /// @param Path The Path on the Host to the resource.
276  /// @param Query The Query component of the URI.
277  /// @param Fragment The Fragment component of the URI.
278  void SetComponents(const String& Scheme, const String& UserInfo, const String& Host, const UInt16 Port, const String& Path, const String& Query, const String& Fragment);
279  /// @brief Sets each component of this URI explicitly without actually parsing the strings (direct copy).
280  /// @remarks Use this method with extreme care, forbidden characters will not be caught with this method.
281  /// @param Scheme The Scheme component of the URI.
282  /// @param UserInfo The User Information component of the URI.
283  /// @param Host The Host component of the URI.
284  /// @param Port The Port on the Host to use for connections to access the resource.
285  /// @param Path The Path on the Host to the resource.
286  /// @param Query The Query component of the URI.
287  /// @param Fragment The Fragment component of the URI.
288  void SetComponentsNoParse(const String& Scheme, const String& UserInfo, const String& Host, const String& Port, const String& Path, const String& Query, const String& Fragment);
289  /// @brief Sets each component of this URI explicitly without actually parsing the strings (direct copy).
290  /// @remarks Use this method with extreme care, forbidden characters will not be caught with this method.
291  /// @param Scheme The Scheme component of the URI.
292  /// @param UserInfo The User Information component of the URI.
293  /// @param Host The Host component of the URI.
294  /// @param Port The Port on the Host to use for connections to access the resource.
295  /// @param Path The Path on the Host to the resource.
296  /// @param Query The Query component of the URI.
297  /// @param Fragment The Fragment component of the URI.
298  void SetComponentsNoParse(const String& Scheme, const String& UserInfo, const String& Host, const UInt16 Port, const String& Path, const String& Query, const String& Fragment);
299 
300  /// @brief Makes minor adjustments to the content of this URI to make it easier to process/compare.
301  /// @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:
302  /// 1. Drop everything that is case in-sensitive to lower case.
303  /// 2. Remove frivolous components in the path. For example a path like "./[anything]/.." means nothing at all.
304  /// 3. Decode unreserved percent encoded characters. Only certain characters need to be percent encoded. Encoding more than those wastes space.
305  /// 4. If the port is a default port for the Scheme, it will be removed.
306  /// @return Returns a reference to this.
307  URI& Normalize();
308  /// @brief Removes frivolous parts of the path that mean nothing.
309  /// @remarks For example a path like "./[anything]/.." means nothing at all.
310  /// @param Relative Whether or not this URI is relative, in which case it will preserve relative dot segments at the start of the path.
311  /// @return Returns a reference to this.
312  URI& RemoveDotSegments(const Boole Relative);
313  /// @brief Swaps the contents of this URI with another.
314  /// @param Other The other URI to be swapped with.
315  /// @return Returns a reference to this.
316  URI& Swap(URI& Other);
317  /// @brief Reverts this URI to a blank slate.
318  /// @return Returns a reference to this.
319  URI& Clear();
320  /// @brief Checks to see if the URI is currently empty.
321  /// @return Returns true if all components of this URI are not set, false otherwise.
322  Boole IsEmpty() const;
323 
324  /// @brief Computes the absolute referenced URI from a relative URI and the absolute URI it is relative to.
325  /// @param Other The other URI to resolve against. Must me relative.
326  /// @return Returns a new absolute URI to the referenced resource.
327  URI Resolve(const URI& Relative) const;
328 
329  /// @brief Parses the contents of a String into this URI.
330  /// @remarks This will overwrite the contents of this URI. If there is a failure during parsing the contents of this URI will be cleared.
331  /// @param ToParse The String to be parsed.
332  /// @return Returns a reference to this.
333  URI& ParseFromString(const String& ToParse);
334  /// @brief Combines the set components of this URI into a usable String for transmission.
335  /// @return Returns a valid String representation of this URI.
336  String ConvertToString() const;
337 
338  /// @brief Adds a single param/value pair to the Query of this URI.
339  /// @remarks Delimiters will automatically be generated when using this method, so any reserved characters that are used in either part will be percent encoded.
340  /// If anything is already percent encoded, the percent character will get percent encoded. So use with care.
341  /// @param Param The name of the parameter to append.
342  /// @param Value The value of the parameter to append.
343  /// @return Returns a reference to this.
344  URI& AddQueryParameter(const String& Param, const String& Value);
345  /// @brief Gets the set value for a specific parameter in the Query of this URI.
346  /// @param Param The name of the parameter to retrieve the value of.
347  /// @return Returns the currently set value of the named parameter, or an empty String if it does not exist/is not set.
348  String GetParameterValue(const String& Param) const;
349  /// @brief Checks if the named parameter exists in this URI.
350  /// @param Param The name of the parameter to check for.
351  /// @return Returns true of the named Parameter exists in this URI.
352  Boole HasQueryParameter(const String& Param) const;
353 
354  ///////////////////////////////////////////////////////////////////////////////
355  // Raw Component Management
356 
357  /// @brief Sets the Scheme component of the URI.
358  /// @param Scheme The Scheme to be set, which is used to specify the type of resource referenced by this URI.
359  /// @return Returns a reference to this.
360  URI& SetScheme(const String& Scheme);
361  /// @brief Gets the Scheme component of the URI.
362  /// @return Returns a const reference to a String containing the Scheme of this URI.
363  const String& GetScheme() const;
364  /// @brief Gets whether or not the Scheme component of the URI has been set.
365  /// @return Returns true if anything has been set as the Scheme, false otherwise.
366  Boole HasScheme() const;
367 
368  /// @brief Sets the User Information component of the URI.
369  /// @warning URI's are often unencrypted, use this feature with care.
370  /// @param UserInfo The User Authentication Information to store in the URI.
371  /// @return Returns a reference to this.
372  URI& SetUserInfo(const String& UserInfo);
373  /// @brief Gets the User Information component of the URI.
374  /// @return Returns a const reference to a String containing the User Information of this URI.
375  const String& GetUserInfo() const;
376  /// @brief Gets whether or not the User Information component of the URI has been set.
377  /// @return Returns true if anything has been set for the User Information, false otherwise.
378  Boole HasUserInfo() const;
379 
380  /// @brief Sets the Host component of the URI.
381  /// @param Host The Host on which the resource specified by the URI is located.
382  /// @return Returns a reference to this.
383  URI& SetHost(const String& Host);
384  /// @brief Sets the Host component of the URI.
385  /// @param Host The IP address of the Host on which the resource specified by the URI is located.
386  /// @return Returns a reference to this.
387  URI& SetHost(const IPAddress& Host);
388  /// @brief Gets the Host component of the URI.
389  /// @return Returns a const reference to a String containing the Host of this URI.
390  const String& GetHost() const;
391  /// @brief Gets whether or not the Host component of the URI has been set.
392  /// @return Returns true if anything has been set for the Host, false otherwise.
393  Boole HasHost() const;
394 
395  /// @brief Sets the Port component of the URI.
396  /// @param Port The Port to connect to on the specified Host.
397  /// @return Returns a reference to this.
398  URI& SetPort(const UInt16 Port);
399  /// @brief Gets the Port component of the URI.
400  /// @return Returns a const reference to a String containing the Port of this URI.
401  UInt16 GetPort() const;
402  /// @brief Gets whether or not the Port component of the URI has been set.
403  /// @return Returns true if anything has been set for the Port, false otherwise.
404  Boole HasPort() const;
405 
406  /// @brief Sets the Path component of the URI.
407  /// @param Port The Path on the host where the resource is located.
408  /// @return Returns a reference to this.
409  URI& SetPath(const String& Port);
410  /// @brief Gets the Path component of the URI.
411  /// @return Returns a const reference to a String containing the Path of this URI.
412  const String& GetPath() const;
413  /// @brief Gets whether or not the Path component of the URI has been set.
414  /// @return Returns true if anything has been set for the Path, false otherwise.
415  Boole HasPath() const;
416 
417  /// @brief Sets the Query component of the URI.
418  /// @param Query Additional non-hierarchical data that is optional.
419  /// @return Returns a reference to this.
420  URI& SetQuery(const String& Query);
421  /// @brief Gets the Query component of the URI.
422  /// @return Returns a const reference to a String containing the Query of this URI.
423  const String& GetQuery() const;
424  /// @brief Gets whether or not the Query component of the URI has been set.
425  /// @return Returns true if anything has been set as a Query, false otherwise.
426  Boole HasQuery() const;
427 
428  /// @brief Sets the Fragment component of the URI.
429  /// @param Fragment The identifier for the specific subsection of the resource to retrieve.
430  /// @return Returns a reference to this.
431  URI& SetFragment(const String& Fragment);
432  /// @brief Gets the Fragment component of the URI.
433  /// @return Returns a const reference to a String containing the Fragment of this URI.
434  const String& GetFragment() const;
435  /// @brief Gets whether or not the Fragment component of the URI has been set.
436  /// @return Returns true if anything has been set as a Fragment, false otherwise.
437  Boole HasFragment() const;
438 
439  /// @brief Sets the Authority Fragments of the URI.
440  /// @note The Authority of a URI is the User Information, Host, and Port combined.
441  /// @exception If the delimiters are improperly set or there is otherwise a parsing error an exception will be thrown.
442  /// @param Authority A String containing properly delimited and encoded User Information, Host, and Port values.
443  /// @return Returns a reference to this.
444  URI& SetAuthority(const String& Authority);
445  /// @brief Gets the Authority Fragments of the URI.
446  /// @return Returns a String containing the full Authority of this URI.
447  String GetAuthority() const;
448  /// @brief Gets whether or not any Authority component of the URI has been set.
449  /// @return Returns true if anything has been set for the Authority, false otherwise.
450  Boole HasAuthority() const;
451 
452  ///////////////////////////////////////////////////////////////////////////////
453  // Operators
454 
455  /// @brief Assignment Operator.
456  /// @param Other The other URI to be assigned to this.
457  void operator=(const URI& Other);
458 
459  /// @brief Equality Comparison Operator.
460  /// @param Other The other URI to compare to.
461  /// @return Returns true if the two URI's are equal, false otherwise.
462  Boole operator==(const URI& Other) const;
463  /// @brief Inequality Comparison Operator.
464  /// @param Other The other URI to compare to.
465  /// @return Returns true if the two URI's are not equal, false otherwise.
466  Boole operator!=(const URI& Other) const;
467  };//URI
468  }//Network
469 }//Mezzanine
470 
471 #endif
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
String URIHost
The domain or address of the Host where the resource is located.
Definition: uri.h:86
String URIQuery
The optional Query to provide additional non-hierarchical information about the resource.
Definition: uri.h:92
String::const_iterator StringIterator
Convenience typedef for String iterators.
Definition: uri.h:63
static const String SubDelims
A String containing the sub-delimiters that some URI schemes may use to delimit scheme specific data...
Definition: uri.h:76
UInt16 URIPort
The port number on the host to connect to in order to access the resource.
Definition: uri.h:98
std::pair< Boole, Char8 > DecodeResult
Convenience typedef for storing if a decode was successful and it's result.
Definition: uri.h:65
char Char8
A datatype to represent one character.
Definition: datatypes.h:169
uint16_t UInt16
An 16-bit unsigned integer.
Definition: datatypes.h:122
This is a simple class for representing IP addresses used throughout the Network subsystem.
Definition: ipaddress.h:57
String URIPath
The path to the resource on the Host machine holding the resource.
Definition: uri.h:89
String URIScheme
The Scheme of the URI, usually noting the type of data the resource is.
Definition: uri.h:80
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
A helper class for the reading and using of Uniform Resource Identifiers.
Definition: uri.h:59
String URIFragment
The optional Fragment providing additional direction to a subset of the resource. ...
Definition: uri.h:95
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
static const String GenDelims
A String containing the generic delimiters for URIs.
Definition: uri.h:71
String URIUserInfo
The optional user authentication information to be used when accessing the resource.
Definition: uri.h:83
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159