From a84a28c61ff44f714edf31e77500d796e3bd4ce4 Mon Sep 17 00:00:00 2001 From: Richard Walters <rwalters@digitalstirling.com> Date: Sat, 30 Jun 2018 15:26:33 -0700 Subject: Kick off Uri component * Can now parse URIs from strings. * This supports scheme, host, and path. * Path separator defaults to "/" but may be customized. --- include/Uri/Uri.hpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'include/Uri') diff --git a/include/Uri/Uri.hpp b/include/Uri/Uri.hpp index b5f85c2..6103bff 100644 --- a/include/Uri/Uri.hpp +++ b/include/Uri/Uri.hpp @@ -10,6 +10,8 @@ */ #include <memory> +#include <string> +#include <vector> namespace Uri { @@ -33,6 +35,65 @@ namespace Uri { */ Uri(); + /** + * This method sets the character or character sequence + * that should be interpreted as a path delimiter. + * + * @param[in] newPathDelimiter + * This is the character or character sequence + * that should be interpreted as a path delimiter. + */ + void SetPathDelimiter(const std::string& newPathDelimiter); + + /** + * This method builds the URI from the elements parsed + * from the given string rendering of a URI. + * + * @param[in] uriString + * This is the string rendering of the URI to parse. + * + * @return + * An indication of whether or not the URI was + * parsed successfully is returned. + */ + bool ParseFromString(const std::string& uriString); + + /** + * This method returns the "scheme" element of the URI. + * + * @return + * The "scheme" element of the URI is returned. + * + * @retval "" + * This is returned if there is no "scheme" element in the URI. + */ + std::string GetScheme() const; + + /** + * This method returns the "host" element of the URI. + * + * @return + * The "host" element of the URI is returned. + * + * @retval "" + * This is returned if there is no "host" element in the URI. + */ + std::string GetHost() const; + + /** + * This method returns the "path" element of the URI, + * as a sequence of steps. + * + * @note + * If the first step of the path is an empty string, + * then the URI has an absolute path. + * + * @return + * The "path" element of the URI is returned + * as a sequence of steps. + */ + std::vector< std::string > GetPath() const; + // Private properties private: /** -- cgit v1.2.3