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

Unified Diff: base/version.h

Issue 1575523002: Comparison and streaming operators for base::Version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes mistake in previous patch set. Created 4 years, 11 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
« no previous file with comments | « no previous file | base/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/version.h
diff --git a/base/version.h b/base/version.h
index 85c99a355bdae61aa89144037430b44d34b2da3c..30cb735b16cf572e971c0b185ee486c649eea866 100644
--- a/base/version.h
+++ b/base/version.h
@@ -6,6 +6,8 @@
#define BASE_VERSION_H_
#include <stdint.h>
+
+#include <iosfwd>
#include <string>
#include <vector>
@@ -37,14 +39,6 @@ class BASE_EXPORT Version {
// Version behavior (IsValid) if no wildcard is present.
static bool IsValidWildcardString(const std::string& wildcard_string);
- // Commonly used pattern. Given a valid version object, compare if a
- // |version_str| results in a newer version. Returns true if the
- // string represents valid version and if the version is greater than
- // than the version of this object.
- bool IsOlderThan(const std::string& version_str) const;
-
- bool Equals(const Version& other) const;
-
// Returns -1, 0, 1 for <, ==, >.
int CompareTo(const Version& other) const;
@@ -63,6 +57,14 @@ class BASE_EXPORT Version {
std::vector<uint32_t> components_;
};
+BASE_EXPORT bool operator==(const Version& v1, const Version& v2);
+BASE_EXPORT bool operator!=(const Version& v1, const Version& v2);
+BASE_EXPORT bool operator<(const Version& v1, const Version& v2);
+BASE_EXPORT bool operator<=(const Version& v1, const Version& v2);
+BASE_EXPORT bool operator>(const Version& v1, const Version& v2);
+BASE_EXPORT bool operator>=(const Version& v1, const Version& v2);
+BASE_EXPORT std::ostream& operator<<(std::ostream& stream, const Version& v);
+
} // namespace base
// TODO(xhwang) remove this when all users are updated to explicitly use the
« no previous file with comments | « no previous file | base/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698