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

Side by Side Diff: src/plugin/PluginUtil.h

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Patch Set: Created June 20, 2014, 9:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #pragma once 1 #pragma once
2 #include <string> 2 #include <string>
3 3 #include <WTypes.h>
4 class BString
5 {
6 public:
7 BString(const std::wstring& value);
8 ~BString();
9 operator BSTR();
10 private:
11 BSTR value;
12 BString(const BString&);
13 BString& operator=(const BString&);
14 };
15 4
16 std::wstring HtmlFolderPath(); 5 std::wstring HtmlFolderPath();
17 std::wstring UserSettingsFileUrl(); 6 std::wstring UserSettingsFileUrl();
18 std::wstring FirstRunPageFileUrl(); 7 std::wstring FirstRunPageFileUrl();
19 std::wstring FileUrl(const std::wstring& url); 8 std::wstring FileUrl(const std::wstring& url);
20 void ReplaceString(std::wstring& input, const std::wstring placeholder, const st d::wstring replacement); 9 void ReplaceString(std::wstring& input, const std::wstring placeholder, const st d::wstring replacement);
10
11 namespace ABP {
Oleksandr 2014/06/26 00:48:43 I'd rather have the namespace called AdblockPlus.I
Eric 2014/06/26 15:13:56 I don't have a firm opinion on these namespace nam
12 namespace util {
13 bool wstring_equal_ci( std::wstring & a, std::wstring & b );
14
15 template< size_t N >
16 inline bool begins_with( const std::wstring s, const wchar_t ( & beginning ) [N] )
17 {
18 return 0 == s.compare( 0, N-1, beginning );
19 }
20
21 inline bool begins_with( const std::wstring s, std::wstring beginning )
22 {
23 return 0 == s.compare( 0, beginning.length(), beginning );
24 }
25
26 /**
27 * Remove both leading and trailing whitespace characters from the argument.
28 *
29 * Whitespace characters are SP, CR, LF, and TAB.
30 */
31 void trim( std::wstring & s );
32
33 /**
34 * Remove leading whitespace characters from the argument.
35 *
36 * Whitespace characters are SP, CR, LF, and TAB.
37 */
38 void trim_leading( std::wstring & s );
39
40 /**
41 * Remove trailing whitespace characters from the argument.
42 *
43 * Whitespace characters are SP, CR, LF, and TAB.
44 */
45 void trim_trailing( std::wstring & s );
46
47 /**
48 */
49 void to_lower( std::wstring & s );
50
51 /**
52 * Parses out the first token in a string, starting at position 'start'.
53 * Alters 'start' to be the position of the character following the final de limiter, or 'npos' if the source is exhausted.
54 *
55 * Replaces CString::Tokenize.
56 */
57 std::wstring extract_token( const std::wstring source, size_t & start, const std::wstring tokens = L" \t\n\r" );
58 }
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld