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

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: Vector passed by value 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') | 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 #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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/base_export.h" 14 #include "base/base_export.h"
15 15
16 namespace base { 16 namespace base {
17 17
18 // Version represents a dotted version number, like "1.2.3.4", supporting 18 // Version represents a dotted version number, like "1.2.3.4", supporting
19 // parsing and comparison. 19 // parsing and comparison.
20 class BASE_EXPORT Version { 20 class BASE_EXPORT Version {
21 public: 21 public:
22 // The only thing you can legally do to a default constructed 22 // The only thing you can legally do to a default constructed
23 // Version object is assign to it. 23 // Version object is assign to it.
24 Version(); 24 Version();
25 25
26 Version(const Version& other); 26 Version(const Version& other);
27 27
28 ~Version();
29
30 // Initializes from a decimal dotted version number, like "0.1.1". 28 // Initializes from a decimal dotted version number, like "0.1.1".
31 // Each component is limited to a uint16_t. Call IsValid() to learn 29 // Each component is limited to a uint16_t. Call IsValid() to learn
32 // the outcome. 30 // the outcome.
33 explicit Version(const std::string& version_str); 31 explicit Version(const std::string& version_str);
34 32
33 // Initializes from a vector of components, like {1, 2, 3, 4}
danakj 2016/07/22 21:29:48 Comments are sentences, including punctuation at t
34 // This construct is used by Version's struct traits and should be called
danakj 2016/07/22 21:29:48 Can you remove this comment about rvalue vectors.
35 // with rvalue vectors
36 explicit Version(std::vector<uint32_t> components);
37
38 ~Version();
39
35 // Returns true if the object contains a valid version number. 40 // Returns true if the object contains a valid version number.
36 bool IsValid() const; 41 bool IsValid() const;
37 42
38 // Returns true if the version wildcard string is valid. The version wildcard 43 // 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 "*" 44 // 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 45 // is invalid (e.g. 1.*.3 or 1.2.3*). This functions defaults to standard
41 // Version behavior (IsValid) if no wildcard is present. 46 // Version behavior (IsValid) if no wildcard is present.
42 static bool IsValidWildcardString(const std::string& wildcard_string); 47 static bool IsValidWildcardString(const std::string& wildcard_string);
43 48
44 // Returns -1, 0, 1 for <, ==, >. 49 // Returns -1, 0, 1 for <, ==, >.
(...skipping 22 matching lines...) Expand all
67 BASE_EXPORT bool operator>=(const Version& v1, const Version& v2); 72 BASE_EXPORT bool operator>=(const Version& v1, const Version& v2);
68 BASE_EXPORT std::ostream& operator<<(std::ostream& stream, const Version& v); 73 BASE_EXPORT std::ostream& operator<<(std::ostream& stream, const Version& v);
69 74
70 } // namespace base 75 } // namespace base
71 76
72 // TODO(xhwang) remove this when all users are updated to explicitly use the 77 // TODO(xhwang) remove this when all users are updated to explicitly use the
73 // namespace 78 // namespace
74 using base::Version; 79 using base::Version;
75 80
76 #endif // BASE_VERSION_H_ 81 #endif // BASE_VERSION_H_
OLDNEW
« no previous file with comments | « no previous file | base/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698