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

Side by Side Diff: base/version.h

Issue 2163033002: base::Version constructor from std::vector<uint32_t> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: operator= and changes based on 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 | « no previous file | base/version.cc » ('j') | base/version.cc » ('J')
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 #ifndef BASE_VERSION_H_ 5 #ifndef BASE_VERSION_H_
6 #define BASE_VERSION_H_ 6 #define BASE_VERSION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
(...skipping 14 matching lines...) Expand all
25 25
26 Version(const Version& other); 26 Version(const Version& other);
27 27
28 ~Version(); 28 ~Version();
29 29
30 // Initializes from a decimal dotted version number, like "0.1.1". 30 // Initializes from a decimal dotted version number, like "0.1.1".
31 // Each component is limited to a uint16_t. Call IsValid() to learn 31 // Each component is limited to a uint16_t. Call IsValid() to learn
32 // the outcome. 32 // the outcome.
33 explicit Version(const std::string& version_str); 33 explicit Version(const std::string& version_str);
34 34
35 explicit Version(std::vector<uint32_t>&& components);
danakj 2016/07/19 20:50:07 This is not a valid constructor in the style guide
Fady Samuel 2016/07/19 21:05:59 Sorry, I misguided Alex. I told him we want a move
danakj 2016/07/19 21:18:32 Right, use move if you don't want to copy. So I'm
Alex Z. 2016/07/22 13:28:03 I changed the constructor to take the vector by va
36
37 Version& operator=(Version&& other);
38
danakj 2016/07/19 20:50:07 nit: you can use less whitespace and group the cop
Alex Z. 2016/07/22 13:28:03 I removed the new operator='s since they are no lo
39 Version& operator=(const Version& other);
40
35 // Returns true if the object contains a valid version number. 41 // Returns true if the object contains a valid version number.
36 bool IsValid() const; 42 bool IsValid() const;
37 43
38 // Returns true if the version wildcard string is valid. The version wildcard 44 // Returns true if the version wildcard string is valid. The version wildcard
39 // string may end with ".*" (e.g. 1.2.*, 1.*). Any other arrangement with "*" 45 // string may end with ".*" (e.g. 1.2.*, 1.*). Any other arrangement with "*"
40 // is invalid (e.g. 1.*.3 or 1.2.3*). This functions defaults to standard 46 // is invalid (e.g. 1.*.3 or 1.2.3*). This functions defaults to standard
41 // Version behavior (IsValid) if no wildcard is present. 47 // Version behavior (IsValid) if no wildcard is present.
42 static bool IsValidWildcardString(const std::string& wildcard_string); 48 static bool IsValidWildcardString(const std::string& wildcard_string);
43 49
44 // Returns -1, 0, 1 for <, ==, >. 50 // Returns -1, 0, 1 for <, ==, >.
(...skipping 22 matching lines...) Expand all
67 BASE_EXPORT bool operator>=(const Version& v1, const Version& v2); 73 BASE_EXPORT bool operator>=(const Version& v1, const Version& v2);
68 BASE_EXPORT std::ostream& operator<<(std::ostream& stream, const Version& v); 74 BASE_EXPORT std::ostream& operator<<(std::ostream& stream, const Version& v);
69 75
70 } // namespace base 76 } // namespace base
71 77
72 // TODO(xhwang) remove this when all users are updated to explicitly use the 78 // TODO(xhwang) remove this when all users are updated to explicitly use the
73 // namespace 79 // namespace
74 using base::Version; 80 using base::Version;
75 81
76 #endif // BASE_VERSION_H_ 82 #endif // BASE_VERSION_H_
OLDNEW
« no previous file with comments | « no previous file | base/version.cc » ('j') | base/version.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698