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

Side by Side Diff: base/version.cc

Issue 12092078: Move string_number_conversions to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, sort headers Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « base/value_conversions.cc ('k') | base/vlog.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 <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
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 }
OLDNEW
« no previous file with comments | « base/value_conversions.cc ('k') | base/vlog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698