Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/Utils.h

Issue 5921969115496448: Issue 1115 - Some yahoo page not correctly shown on IE8 when ABP enabled (Closed)
Patch Set: rebase Created Feb. 19, 2015, 2:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginWbPassThrough.cpp ('k') | src/shared/Utils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/plugin/PluginWbPassThrough.cpp ('k') | src/shared/Utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld