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 #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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/base_export.h" | 12 #include "base/base_export.h" |
13 #include "base/basictypes.h" | |
14 | 13 |
15 namespace base { | 14 namespace base { |
16 | 15 |
17 // Version represents a dotted version number, like "1.2.3.4", supporting | 16 // Version represents a dotted version number, like "1.2.3.4", supporting |
18 // parsing and comparison. | 17 // parsing and comparison. |
19 class BASE_EXPORT Version { | 18 class BASE_EXPORT Version { |
20 public: | 19 public: |
21 // The only thing you can legally do to a default constructed | 20 // The only thing you can legally do to a default constructed |
22 // Version object is assign to it. | 21 // Version object is assign to it. |
23 Version(); | 22 Version(); |
24 | 23 |
25 ~Version(); | 24 ~Version(); |
26 | 25 |
27 // Initializes from a decimal dotted version number, like "0.1.1". | 26 // Initializes from a decimal dotted version number, like "0.1.1". |
28 // Each component is limited to a uint16. Call IsValid() to learn | 27 // Each component is limited to a uint16_t. Call IsValid() to learn |
29 // the outcome. | 28 // the outcome. |
30 explicit Version(const std::string& version_str); | 29 explicit Version(const std::string& version_str); |
31 | 30 |
32 // Returns true if the object contains a valid version number. | 31 // Returns true if the object contains a valid version number. |
33 bool IsValid() const; | 32 bool IsValid() const; |
34 | 33 |
35 // Returns true if the version wildcard string is valid. The version wildcard | 34 // Returns true if the version wildcard string is valid. The version wildcard |
36 // string may end with ".*" (e.g. 1.2.*, 1.*). Any other arrangement with "*" | 35 // string may end with ".*" (e.g. 1.2.*, 1.*). Any other arrangement with "*" |
37 // is invalid (e.g. 1.*.3 or 1.2.3*). This functions defaults to standard | 36 // is invalid (e.g. 1.*.3 or 1.2.3*). This functions defaults to standard |
38 // Version behavior (IsValid) if no wildcard is present. | 37 // Version behavior (IsValid) if no wildcard is present. |
(...skipping 25 matching lines...) Expand all Loading... |
64 std::vector<uint32_t> components_; | 63 std::vector<uint32_t> components_; |
65 }; | 64 }; |
66 | 65 |
67 } // namespace base | 66 } // namespace base |
68 | 67 |
69 // TODO(xhwang) remove this when all users are updated to explicitly use the | 68 // TODO(xhwang) remove this when all users are updated to explicitly use the |
70 // namespace | 69 // namespace |
71 using base::Version; | 70 using base::Version; |
72 | 71 |
73 #endif // BASE_VERSION_H_ | 72 #endif // BASE_VERSION_H_ |
OLD | NEW |