Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5583)

Unified Diff: chrome/install_static/install_util.h

Issue 2017853002: Add functionality to the install_static library to tokenize strings and compare versions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows gn builder redness Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/install_static/install_util.h
diff --git a/chrome/install_static/install_util.h b/chrome/install_static/install_util.h
index b7a4ffb0fbc05d7996d356a1575778693a13a120..c62a6c1e99a1af1332f963becefa4fa6ab4b8fb3 100644
--- a/chrome/install_static/install_util.h
+++ b/chrome/install_static/install_util.h
@@ -9,6 +9,8 @@
#ifndef CHROME_INSTALL_STATIC_INSTALL_UTIL_H_
#define CHROME_INSTALL_STATIC_INSTALL_UTIL_H_
+#include <vector>
grt (UTC plus 2) 2016/05/27 14:13:20 #include <string>
grt (UTC plus 2) 2016/05/27 20:18:03 ping
ananta 2016/05/27 20:42:13 We get that through string16.h
grt (UTC plus 2) 2016/05/27 20:47:35 i think the rules of iwyu say that you shouldn't c
ananta 2016/05/27 21:38:54 ok. Added include
+
#include "base/strings/string16.h"
namespace install_static {
@@ -156,6 +158,28 @@ base::string16 GetBrowserCrashDumpAttemptsRegistryPath();
// as '*xyz*'.
bool MatchPattern(const base::string16& source, const base::string16& pattern);
+// UTF8 to UTF16 and vice versa conversion helpers.
+base::string16 utf8_to_utf16(const std::string &source);
grt (UTC plus 2) 2016/05/27 14:13:20 UTF8ToUTF16 (https://google.github.io/styleguide/c
ananta 2016/05/27 20:05:26 Done.
+
+std::string utf16_to_utf8(const base::string16 &source);
+
+// Tokenizes a string |str| based on single character delimiter.
+// The tokens are returned in a vector. The |trim_spaces| parameter indicates
+// whether the function should optionally trim spaces throughout the string.
+std::vector<std::string> TokenizeString(const std::string& str,
+ const char delimiter,
grt (UTC plus 2) 2016/05/27 14:13:20 nit: omit "const" for fundamental types
ananta 2016/05/27 20:05:26 Done.
+ bool trim_spaces);
+
+// Compares version strings of the form "X.X.X.X" and returns the result of the
+// comparison in the |result| parameter. The result is as below:
+// 0 if the versions are equal.
+// -1 if version1 < version 2.
scottmg 2016/05/27 17:27:22 version 2 -> version2
ananta 2016/05/27 20:05:26 Done.
+// 1 if version1 > version2.
+// Returns true on success, false on invalid strings being passed, etc.
+bool CompareVersionStrings(const std::string& version1,
+ const std::string& version2,
+ int* result);
+
// Caches the |ProcessType| of the current process.
extern ProcessType g_process_type;

Powered by Google App Engine
This is Rietveld 408576698