dodo
0.0.1
A C++ library to create containerized Linux services
|
Uniform Resource Identifier. More...
#include <uri.hpp>
Public Member Functions | |
URI () | |
Construct an empty URI. More... | |
URI (const std::string &scheme, const std::string &userinfo, const std::string &host, const std::string &port, const std::string &path, const std::string &query, const std::string &fragment) | |
Construct an URI from iits components. More... | |
URI (const URI &uri) | |
Copy constructor. More... | |
~URI () | |
Desctructor. More... | |
std::string | asString () const |
Return the URI as a std::string. More... | |
std::string | getFragment () const |
Return the fragment std::string. More... | |
std::string | getHost () const |
Return the host std::string. More... | |
std::string | getPath () const |
Return the path std::string. More... | |
std::string | getPort () const |
Return the port std::string. More... | |
std::string | getQuery () const |
Return the query std::string. More... | |
std::string | getScheme () const |
Return the URI scheme std::string. More... | |
std::string | getUserInfo () const |
Return the user-info std::string. More... | |
bool | operator!= (const URI &uri) |
Inequality operator. More... | |
bool | operator< (const URI &uri) |
Ordering operator. More... | |
URI & | operator= (const URI &uri) |
Assignment operator. More... | |
bool | operator== (const URI &uri) |
Equality operator. More... | |
bool | parse (const std::string &s, size_t &idxfail) |
Parse the string as an URI. More... | |
void | setFragment (const std::string &fragment) |
Set the URI fragment. More... | |
void | setHost (const std::string &host) |
Set the URI host. More... | |
void | setPath (const std::string &path) |
Set the URI path. More... | |
void | setPort (const std::string &port) |
Set the URI port. More... | |
void | setQuery (const std::string &query) |
Set the URI query. More... | |
void | setScheme (const std::string &scheme) |
Set the URI scheme. More... | |
void | setUserInfo (const std::string &userinfo) |
Set the URI user-info. More... | |
Private Types | |
enum | ParseState { psSchemeStart, psSchemeEnd, psAuthorityStart, psUserInfoEnd, psHostStart, psHostEnd, psPortStart, psPortEnd, psPathStart, psPathEnd, psQueryStart, psQueryEnd, psFragmentStart, psTCP6Start, psPCTEncoded, psError, psDone } |
States for the parsingg automaton. More... | |
Private Member Functions | |
void | reset () |
Reste all data to empty strings. More... | |
bool | verifyOctetChar (char c) |
Check if c is a valid Octet. More... | |
bool | verifyPathChar (char c) |
Check if c is a valid Path char. More... | |
bool | verifyQueryFragmentChar (char c) |
Check if c is a valid Fragment char. More... | |
bool | verifySchemeChar (char c) |
Check if c is a valid Scheme char. More... | |
bool | verifyTCP6Char (char c) |
Check if c is a valid TCP6 address char. More... | |
bool | verifyUserInfoHostChar (char c) |
Check if c is a valid UserInfo or host char. More... | |
Private Attributes | |
std::string | fragment_ |
The fragment. More... | |
std::string | host_ |
The host. More... | |
std::string | path_ |
The path. More... | |
std::string | port_ |
The port. More... | |
std::string | query_ |
The query. More... | |
std::string | scheme_ |
The scheme. More... | |
std::string | userinfo_ |
The userinfo. More... | |
Uniform Resource Identifier.
|
private |
|
inline |
|
inline |
|
inline |
std::string dodo::network::URI::asString | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool dodo::network::URI::parse | ( | const std::string & | s, |
size_t & | idxfail | ||
) |
Parse the string as an URI.
Rteurn false and set idxfail to the failing char if the pasre fails, true if the pasre succeeds.
s | The string to parse |
idxfail | If parse fails, the index of the failing character |
Definition at line 109 of file uri.cpp.
References fragment_, host_, path_, port_, query_, reset(), scheme_, userinfo_, verifyPathChar(), verifyQueryFragmentChar(), verifySchemeChar(), verifyTCP6Char(), and verifyUserInfoHostChar().
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Check if c is a valid Octet.
c | The char to check. |
Definition at line 64 of file uri.cpp.
Referenced by verifyUserInfoHostChar().
|
private |
Check if c is a valid Path char.
c | The char to check. |
Definition at line 94 of file uri.cpp.
References verifyUserInfoHostChar().
Referenced by parse().
|
private |
Check if c is a valid Fragment char.
c | The char to check. |
Definition at line 101 of file uri.cpp.
References verifyUserInfoHostChar().
Referenced by parse().
|
private |
|
private |
|
private |
Check if c is a valid UserInfo or host char.
c | The char to check. |
Definition at line 79 of file uri.cpp.
References verifyOctetChar().
Referenced by parse(), verifyPathChar(), and verifyQueryFragmentChar().
|
private |
The fragment.
Definition at line 324 of file uri.hpp.
Referenced by asString(), getFragment(), operator!=(), operator<(), operator=(), operator==(), parse(), reset(), and setFragment().
|
private |
The host.
Definition at line 316 of file uri.hpp.
Referenced by asString(), getHost(), operator!=(), operator<(), operator=(), operator==(), parse(), reset(), and setHost().
|
private |
The path.
Definition at line 320 of file uri.hpp.
Referenced by asString(), getPath(), operator!=(), operator<(), operator=(), operator==(), parse(), reset(), and setPath().
|
private |
The port.
Definition at line 318 of file uri.hpp.
Referenced by asString(), getPort(), operator!=(), operator<(), operator=(), operator==(), parse(), reset(), and setPort().
|
private |
The query.
Definition at line 322 of file uri.hpp.
Referenced by asString(), getQuery(), operator!=(), operator<(), operator=(), operator==(), parse(), reset(), and setQuery().
|
private |
The scheme.
Definition at line 312 of file uri.hpp.
Referenced by asString(), getScheme(), operator!=(), operator<(), operator=(), operator==(), parse(), reset(), and setScheme().
|
private |
The userinfo.
Definition at line 314 of file uri.hpp.
Referenced by asString(), getUserInfo(), operator!=(), operator<(), operator=(), operator==(), parse(), reset(), and setUserInfo().