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

Side by Side Diff: base/version.cc

Issue 2163033002: base::Version constructor from std::vector<uint32_t> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes based on nit comments Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « base/version.h ('k') | base/version_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/version.h" 5 #include "base/version.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 Version::Version(const std::string& version_str) { 88 Version::Version(const std::string& version_str) {
89 std::vector<uint32_t> parsed; 89 std::vector<uint32_t> parsed;
90 if (!ParseVersionNumbers(version_str, &parsed)) 90 if (!ParseVersionNumbers(version_str, &parsed))
91 return; 91 return;
92 92
93 components_.swap(parsed); 93 components_.swap(parsed);
94 } 94 }
95 95
96 Version::Version(std::vector<uint32_t> components) : components_(components) {}
97
96 bool Version::IsValid() const { 98 bool Version::IsValid() const {
97 return (!components_.empty()); 99 return (!components_.empty());
98 } 100 }
99 101
100 // static 102 // static
101 bool Version::IsValidWildcardString(const std::string& wildcard_string) { 103 bool Version::IsValidWildcardString(const std::string& wildcard_string) {
102 std::string version_string = wildcard_string; 104 std::string version_string = wildcard_string;
103 if (EndsWith(version_string, ".*", CompareCase::SENSITIVE)) 105 if (EndsWith(version_string, ".*", CompareCase::SENSITIVE))
104 version_string.resize(version_string.size() - 2); 106 version_string.resize(version_string.size() - 2);
105 107
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 186
185 bool operator>=(const Version& v1, const Version& v2) { 187 bool operator>=(const Version& v1, const Version& v2) {
186 return v1.CompareTo(v2) >= 0; 188 return v1.CompareTo(v2) >= 0;
187 } 189 }
188 190
189 std::ostream& operator<<(std::ostream& stream, const Version& v) { 191 std::ostream& operator<<(std::ostream& stream, const Version& v) {
190 return stream << v.GetString(); 192 return stream << v.GetString();
191 } 193 }
192 194
193 } // namespace base 195 } // namespace base
OLDNEW
« no previous file with comments | « base/version.h ('k') | base/version_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698