diff options
Diffstat (limited to 'libcmix-network/uriparser.hpp')
| -rw-r--r-- | libcmix-network/uriparser.hpp | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/libcmix-network/uriparser.hpp b/libcmix-network/uriparser.hpp index c46b70a..dd439fb 100644 --- a/libcmix-network/uriparser.hpp +++ b/libcmix-network/uriparser.hpp @@ -4,16 +4,31 @@ #include <regex> #include <iostream> +/*! + * \file + */ + +/*! + * \brief The Uri struct + */ + struct Uri { - std::string scheme; - std::string username; - std::string password; - std::string host; - std::string port; - std::string query; - std::string hash; + std::string scheme; ///< The URI scheme + std::string username; ///< The URI username + std::string password; ///< The URI password + std::string host; ///< The URI host + std::string port; ///< The URI port + std::string query; ///< The URI query + std::string hash; ///< The URI hash }; +/*! + * \brief parse_uri + * \param str The string that contains a URI. + * It must be a valid URI, this function will to do no validation. + * There may be no leading or trailing whitespace + * \return The corresponding URI struct. + */ Uri parse_uri(std::string str) { std::string scheme = "(?:(.+?)://)?"; std::string uname_pass = "(?:(.*?)?(?::(.*?))@)?"; @@ -37,6 +52,11 @@ Uri parse_uri(std::string str) { }; } +/*! + * \brief debug_uri Debug function to see the contents of the URI struct. + * \param uri + * \return A Debug string representation of an URI + */ std::string debug_uri(Uri uri) { std::stringstream ss; ss << "scheme: " << uri.scheme << std::endl @@ -49,6 +69,11 @@ std::string debug_uri(Uri uri) { return ss.str(); } +/*! + * \brief uri_to_string + * \param uri + * \return returns the string representation of the URI stored in uri. + */ std::string uri_to_string(Uri uri) { return (!uri.scheme.empty() ? uri.scheme + "://" : "") + |
