A complete URI which has the following components: More...
#include <URI.hh>
Public Member Functions | |
| URI () | |
| Default constructor. | |
| URI (const std::string &_str, bool _hasAuthority=false) | |
| Construct a URI object from a string. | |
| std::optional< URIAuthority > | Authority () const |
| Get a copy of the URI's authority. If the authority has no value (as opposed to being empty), it means that it isn't present, and the authority value may be contained in the path instead. | |
| void | Clear () |
| Remove all components of the URI. | |
| URIFragment & | Fragment () |
| Get a mutable version of the fragment component. | |
| const URIFragment & | Fragment () const |
| Get a const reference of the fragment component. | |
| bool | operator== (const URI &_uri) const |
| Return true if the two URIs match. | |
| bool | Parse (const std::string &_str) |
Parse a string as URI. If there's no authority (i.e. Authority().has_value() == false), authority information will be contained within the path. In order to populate the Authority, either set hasAuthority to true on the constructor or set an empty authority before parsing. | |
| URIPath & | Path () |
| Get a mutable version of the path component. | |
| const URIPath & | Path () const |
| Get a const reference of the path component. | |
| URIQuery & | Query () |
| Get a mutable version of the query component. | |
| const URIQuery & | Query () const |
| Get a const reference of the query component. | |
| std::string | Scheme () const |
| Get the URI's scheme. | |
| void | SetAuthority (const URIAuthority &_authority) |
| Set the URI's authority. | |
| void | SetScheme (const std::string &_scheme) |
| Set the URI's scheme. | |
| std::string | Str () const |
| Get the URI as a string, which has the form: | |
| bool | Valid () const |
| Validate this URI. | |
Static Public Member Functions | |
| static bool | Valid (const std::string &_str) |
| Validate a string as URI. | |
Detailed Description
A complete URI which has the following components:
scheme:[//authority]path[?query][#fragment]
Constructor & Destructor Documentation
◆ URI() [1/2]
| URI | ( | ) |
Default constructor.
◆ URI() [2/2]
|
explicit |
Member Function Documentation
◆ Authority()
| std::optional< URIAuthority > Authority | ( | ) | const |
Get a copy of the URI's authority. If the authority has no value (as opposed to being empty), it means that it isn't present, and the authority value may be contained in the path instead.
- Returns
- The authority
◆ Clear()
| void Clear | ( | ) |
Remove all components of the URI.
◆ Fragment() [1/2]
| URIFragment & Fragment | ( | ) |
Get a mutable version of the fragment component.
- Returns
- A reference to the fragment.
◆ Fragment() [2/2]
| const URIFragment & Fragment | ( | ) | const |
Get a const reference of the fragment component.
- Returns
- A const reference of the fragment.
◆ operator==()
| bool operator== | ( | const URI & | _uri | ) | const |
Return true if the two URIs match.
- Parameters
-
[in] _uri Another URI to compare.
- Returns
- True if the two URIs match.
◆ Parse()
| bool Parse | ( | const std::string & | _str | ) |
Parse a string as URI. If there's no authority (i.e. Authority().has_value() == false), authority information will be contained within the path. In order to populate the Authority, either set hasAuthority to true on the constructor or set an empty authority before parsing.
- Parameters
-
[in] _str A string.
- Returns
- True if the string can be parsed as a URI.
◆ Path() [1/2]
| URIPath & Path | ( | ) |
Get a mutable version of the path component.
- Returns
- A reference to the path
◆ Path() [2/2]
| const URIPath & Path | ( | ) | const |
Get a const reference of the path component.
- Returns
- A const reference of the path.
◆ Query() [1/2]
| URIQuery & Query | ( | ) |
Get a mutable version of the query component.
- Returns
- A reference to the query
◆ Query() [2/2]
| const URIQuery & Query | ( | ) | const |
Get a const reference of the query component.
- Returns
- A const reference of the query.
◆ Scheme()
| std::string Scheme | ( | ) | const |
Get the URI's scheme.
- Returns
- The scheme
◆ SetAuthority()
| void SetAuthority | ( | const URIAuthority & | _authority | ) |
Set the URI's authority.
- Parameters
-
[in] _authority The authority to set.
◆ SetScheme()
| void SetScheme | ( | const std::string & | _scheme | ) |
Set the URI's scheme.
- Parameters
-
[in] _scheme New scheme.
◆ Str()
| std::string Str | ( | ) | const |
◆ Valid() [1/2]
◆ Valid() [2/2]
|
static |
The documentation for this class was generated from the following file: