Index: src/shared/Utils.h |
diff --git a/src/shared/Utils.h b/src/shared/Utils.h |
index 3110b65057d2fbc75410e04c6e12f99558db57e7..4b255beb543d12920bc68fd85f1b4d6c91656c33 100644 |
--- a/src/shared/Utils.h |
+++ b/src/shared/Utils.h |
@@ -56,6 +56,30 @@ std::wstring GetDllDir(); |
std::wstring GetAppDataPath(); |
void ReplaceString(std::wstring& input, const std::wstring placeholder, const std::wstring replacement); |
+/** |
+ * Returns the begging of the URL which includes the scheme and hierarchical |
+ * part according to http://en.wikipedia.org/wiki/URI_scheme . |
+ */ |
+std::wstring GetSchemeAndHierarchicalPart(const std::wstring& url); |
+ |
+std::wstring GetQueryString(const std::wstring& url); |
+/** |
+ * Splits a string into tokens separated by a delimiter. |
+ * Applies a function to each token. |
+ * Terminates early if the function returns false. |
+ * Throws if `fn` is empty, see the reference of std::function::operator(). |
+ */ |
+void ForEachToken(const std::wstring& value, wchar_t delimiter, |
+ const std::function<bool(std::wstring::const_iterator begin, std::wstring::const_iterator end)>& fn); |
+ |
+/** |
+ * Applies a function to each name=value pair in a query string. |
+ * Terminates early if the function returns false. |
+ * Throws if `fn` is empty, see the reference of std::function::operator(). |
+ */ |
+void ForEachQueryStringParameter(const std::wstring& urlQueryString, |
+ const std::function<bool(const std::wstring& name, const std::wstring& value)>& fn); |
+ |
template<class T> |
T TrimString(T text) |
{ |