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

Delta Between Two Patch Sets: src/Utils.h

Issue 29451722: Issue 4907 - Update v8 to 5.7.278 in libadblockplus (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Left Patch Set: Created May 30, 2017, 3:02 p.m.
Right Patch Set: independence from file mode of make_gyp_wrapper.py Created July 4, 2017, 11:11 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/JsValue.cpp ('k') | src/Utils.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 14 matching lines...) Expand all
25 #include <string> 25 #include <string>
26 #include <v8.h> 26 #include <v8.h>
27 27
28 namespace AdblockPlus 28 namespace AdblockPlus
29 { 29 {
30 namespace Utils 30 namespace Utils
31 { 31 {
32 std::string Slurp(std::istream& stream); 32 std::string Slurp(std::istream& stream);
33 std::string FromV8String(const v8::Handle<v8::Value>& value); 33 std::string FromV8String(const v8::Handle<v8::Value>& value);
34 v8::Local<v8::String> ToV8String(v8::Isolate* isolate, const std::string& st r); 34 v8::Local<v8::String> ToV8String(v8::Isolate* isolate, const std::string& st r);
35 void ThrowException(v8::Isolate* isolate, const std::string& str); 35 void ThrowExceptionInJS(v8::Isolate* isolate, const std::string& str);
Eric 2017/05/30 17:31:41 Does this mean to throw a C++ exception or to thro
sergei 2017/05/31 12:47:12 It's still unclear, changed to `ThrowExceptionInJS
36 36
37 // Code for templated function has to be in a header file, can't be in .cpp 37 // Code for templated function has to be in a header file, can't be in .cpp
38 template<class T> 38 template<class T>
39 T TrimString(const T& text) 39 T TrimString(const T& text)
40 { 40 {
41 // Via http://stackoverflow.com/questions/216823/whats-the-best-way-to-tri m-stdstring 41 // Via http://stackoverflow.com/questions/216823/whats-the-best-way-to-tri m-stdstring
42 T trimmed(text); 42 T trimmed(text);
43 trimmed.erase(trimmed.begin(), std::find_if(trimmed.begin(), trimmed.end() , std::not1(std::ptr_fun<int, int>(std::isspace)))); 43 trimmed.erase(trimmed.begin(), std::find_if(trimmed.begin(), trimmed.end() , std::not1(std::ptr_fun<int, int>(std::isspace))));
44 trimmed.erase(std::find_if(trimmed.rbegin(), trimmed.rend(), std::not1(std ::ptr_fun<int, int>(std::isspace))).base(), trimmed.end()); 44 trimmed.erase(std::find_if(trimmed.rbegin(), trimmed.rend(), std::not1(std ::ptr_fun<int, int>(std::isspace))).base(), trimmed.end());
45 return trimmed; 45 return trimmed;
46 } 46 }
47 #ifdef _WIN32 47 #ifdef _WIN32
48 std::wstring ToUtf16String(const std::string& str); 48 std::wstring ToUtf16String(const std::string& str);
49 std::string ToUtf8String(const std::wstring& str); 49 std::string ToUtf8String(const std::wstring& str);
50 std::wstring CanonizeUrl(const std::wstring& url); 50 std::wstring CanonizeUrl(const std::wstring& url);
51 #endif 51 #endif
52 } 52 }
53 } 53 }
54 54
55 #endif 55 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld