Index: src/shared/Utils.h |
diff --git a/src/shared/Utils.h b/src/shared/Utils.h |
index befdf237aafeef59f39becbb1daa86fdbb64af9a..52c3d49626f930a9d884032d59e180c692c63d9a 100644 |
--- a/src/shared/Utils.h |
+++ b/src/shared/Utils.h |
@@ -15,19 +15,19 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-#ifndef UTILS_H |
-#define UTILS_H |
- |
-#include <algorithm> |
-#include <locale> |
-#include <functional> |
+#ifndef UTILS_H |
+#define UTILS_H |
+ |
+#include <algorithm> |
+#include <locale> |
+#include <functional> |
#include <string> |
-#include <vector> |
- |
-#define WM_ALREADY_UP_TO_DATE WM_APP+1 |
-#define WM_UPDATE_CHECK_ERROR WM_APP+2 |
-#define WM_DOWNLOADING_UPDATE WM_APP+3 |
- |
+#include <vector> |
+ |
+#define WM_ALREADY_UP_TO_DATE WM_APP+1 |
+#define WM_UPDATE_CHECK_ERROR WM_APP+2 |
+#define WM_DOWNLOADING_UPDATE WM_APP+3 |
+ |
// |
// Application Package Authority. |
// |
@@ -46,27 +46,35 @@ |
// |
#define SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE (0x00000001L) |
- |
- |
-bool IsWindowsVistaOrLater(); |
-bool IsWindows8OrLater(); |
- |
-std::string ToUtf8String(const std::wstring& str); |
+ |
+ |
+bool IsWindowsVistaOrLater(); |
+bool IsWindows8OrLater(); |
+ |
+std::string ToUtf8String(const std::wstring& str); |
std::wstring ToUtf16String(const std::string& str); |
-std::vector<std::wstring> ToUtf16Strings(const std::vector<std::string>& value); |
-std::wstring GetDllDir(); |
-std::wstring GetAppDataPath(); |
-void ReplaceString(std::wstring& input, const std::wstring placeholder, const std::wstring replacement); |
- |
-template<class T> |
-T TrimString(T text) |
-{ |
- // Via http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring |
- T trimmed(text); |
- std::function<bool(T::value_type)> isspace = std::bind(&std::isspace<T::value_type>, std::placeholders::_1, std::locale::classic()); |
- trimmed.erase(trimmed.begin(), std::find_if(trimmed.begin(), trimmed.end(), std::not1(isspace))); |
- trimmed.erase(std::find_if(trimmed.rbegin(), trimmed.rend(), std::not1(isspace)).base(), trimmed.end()); |
- return trimmed; |
-} |
- |
-#endif // UTILS_H |
+std::vector<std::wstring> ToUtf16Strings(const std::vector<std::string>& value); |
+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 |
Oleksandr
2015/03/03 18:43:17
beginning
sergei
2015/03/04 13:24:36
fixed.
|
+ * part according to http://en.wikipedia.org/wiki/URI_scheme . |
Oleksandr
2015/03/03 18:43:17
No space before '.'
sergei
2015/03/04 13:24:36
fixed.
|
+ */ |
+std::wstring GetSchemeAndHierarchicalPart(const std::wstring& url); |
+ |
+std::wstring GetQueryString(const std::wstring& url); |
+ |
+template<class T> |
+T TrimString(T text) |
+{ |
+ // Via http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring |
+ T trimmed(text); |
+ std::function<bool(T::value_type)> isspace = std::bind(&std::isspace<T::value_type>, std::placeholders::_1, std::locale::classic()); |
+ trimmed.erase(trimmed.begin(), std::find_if(trimmed.begin(), trimmed.end(), std::not1(isspace))); |
+ trimmed.erase(std::find_if(trimmed.rbegin(), trimmed.rend(), std::not1(isspace)).base(), trimmed.end()); |
+ return trimmed; |
+} |
+ |
+#endif // UTILS_H |