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

Side by Side Diff: base/version.cc

Issue 10683005: Remove two deprecated methods from base::Version (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 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 | Annotate | Revision Log
« 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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" 10 #include "base/string_number_conversions.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return (!components_.empty()); 45 return (!components_.empty());
46 } 46 }
47 47
48 bool Version::IsOlderThan(const std::string& version_str) const { 48 bool Version::IsOlderThan(const std::string& version_str) const {
49 Version proposed_ver(version_str); 49 Version proposed_ver(version_str);
50 if (!proposed_ver.IsValid()) 50 if (!proposed_ver.IsValid())
51 return false; 51 return false;
52 return (CompareTo(proposed_ver) < 0); 52 return (CompareTo(proposed_ver) < 0);
53 } 53 }
54 54
55 // TODO(cpu): remove this method.
56 Version* Version::GetVersionFromString(const std::string& version_str) {
57 Version* vers = new Version(version_str);
58 if (vers->IsValid()) {
59 return vers;
60 }
61 delete vers;
62 return NULL;
63 }
64
65 // TODO(cpu): remove this method.
66 Version* Version::Clone() const {
67 DCHECK(IsValid());
68 return new Version(*this);
69 }
70
71 bool Version::Equals(const Version& that) const { 55 bool Version::Equals(const Version& that) const {
72 DCHECK(IsValid()); 56 DCHECK(IsValid());
73 DCHECK(that.IsValid()); 57 DCHECK(that.IsValid());
74 return (CompareTo(that) == 0); 58 return (CompareTo(that) == 0);
75 } 59 }
76 60
77 int Version::CompareTo(const Version& other) const { 61 int Version::CompareTo(const Version& other) const {
78 DCHECK(IsValid()); 62 DCHECK(IsValid());
79 DCHECK(other.IsValid()); 63 DCHECK(other.IsValid());
80 size_t count = std::min(components_.size(), other.components_.size()); 64 size_t count = std::min(components_.size(), other.components_.size());
(...skipping 19 matching lines...) Expand all
100 DCHECK(IsValid()); 84 DCHECK(IsValid());
101 std::string version_str; 85 std::string version_str;
102 size_t count = components_.size(); 86 size_t count = components_.size();
103 for (size_t i = 0; i < count - 1; ++i) { 87 for (size_t i = 0; i < count - 1; ++i) {
104 version_str.append(base::IntToString(components_[i])); 88 version_str.append(base::IntToString(components_[i]));
105 version_str.append("."); 89 version_str.append(".");
106 } 90 }
107 version_str.append(base::IntToString(components_[count - 1])); 91 version_str.append(base::IntToString(components_[count - 1]));
108 return version_str; 92 return version_str;
109 } 93 }
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