| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_number_conversions.h" | |
| 11 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| 12 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/strings/string_number_conversions.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // Parses the |numbers| vector representing the different numbers | 16 // Parses the |numbers| vector representing the different numbers |
| 17 // inside the version string and constructs a vector of valid integers. It stops | 17 // inside the version string and constructs a vector of valid integers. It stops |
| 18 // when it reaches an invalid item (including the wildcard character). |parsed| | 18 // when it reaches an invalid item (including the wildcard character). |parsed| |
| 19 // is the resulting integer vector. Function returns true if all numbers were | 19 // is the resulting integer vector. Function returns true if all numbers were |
| 20 // parsed successfully, false otherwise. | 20 // parsed successfully, false otherwise. |
| 21 bool ParseVersionNumbers(const std::string& version_str, | 21 bool ParseVersionNumbers(const std::string& version_str, |
| 22 std::vector<uint16>* parsed) { | 22 std::vector<uint16>* parsed) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 DCHECK(IsValid()); | 163 DCHECK(IsValid()); |
| 164 std::string version_str; | 164 std::string version_str; |
| 165 size_t count = components_.size(); | 165 size_t count = components_.size(); |
| 166 for (size_t i = 0; i < count - 1; ++i) { | 166 for (size_t i = 0; i < count - 1; ++i) { |
| 167 version_str.append(base::IntToString(components_[i])); | 167 version_str.append(base::IntToString(components_[i])); |
| 168 version_str.append("."); | 168 version_str.append("."); |
| 169 } | 169 } |
| 170 version_str.append(base::IntToString(components_[count - 1])); | 170 version_str.append(base::IntToString(components_[count - 1])); |
| 171 return version_str; | 171 return version_str; |
| 172 } | 172 } |
| OLD | NEW |