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

Unified Diff: src/plugin/PluginUtil.h

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Patch Set: Created June 20, 2014, 9:22 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
Index: src/plugin/PluginUtil.h
===================================================================
--- a/src/plugin/PluginUtil.h
+++ b/src/plugin/PluginUtil.h
@@ -1,20 +1,59 @@
#pragma once
#include <string>
-
-class BString
-{
-public:
- BString(const std::wstring& value);
- ~BString();
- operator BSTR();
-private:
- BSTR value;
- BString(const BString&);
- BString& operator=(const BString&);
-};
+#include <WTypes.h>
std::wstring HtmlFolderPath();
std::wstring UserSettingsFileUrl();
std::wstring FirstRunPageFileUrl();
std::wstring FileUrl(const std::wstring& url);
void ReplaceString(std::wstring& input, const std::wstring placeholder, const std::wstring replacement);
+
+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
+ namespace util {
+ bool wstring_equal_ci( std::wstring & a, std::wstring & b );
+
+ template< size_t N >
+ inline bool begins_with( const std::wstring s, const wchar_t ( & beginning )[N] )
+ {
+ return 0 == s.compare( 0, N-1, beginning );
+ }
+
+ inline bool begins_with( const std::wstring s, std::wstring beginning )
+ {
+ return 0 == s.compare( 0, beginning.length(), beginning );
+ }
+
+ /**
+ * Remove both leading and trailing whitespace characters from the argument.
+ *
+ * Whitespace characters are SP, CR, LF, and TAB.
+ */
+ void trim( std::wstring & s );
+
+ /**
+ * Remove leading whitespace characters from the argument.
+ *
+ * Whitespace characters are SP, CR, LF, and TAB.
+ */
+ void trim_leading( std::wstring & s );
+
+ /**
+ * Remove trailing whitespace characters from the argument.
+ *
+ * Whitespace characters are SP, CR, LF, and TAB.
+ */
+ void trim_trailing( std::wstring & s );
+
+ /**
+ */
+ void to_lower( std::wstring & s );
+
+ /**
+ * Parses out the first token in a string, starting at position 'start'.
+ * Alters 'start' to be the position of the character following the final delimiter, or 'npos' if the source is exhausted.
+ *
+ * Replaces CString::Tokenize.
+ */
+ std::wstring extract_token( const std::wstring source, size_t & start, const std::wstring tokens = L" \t\n\r" );
+ }
+}

Powered by Google App Engine
This is Rietveld