OLD | NEW |
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 #ifndef BASE_VERSION_H_ | 5 #ifndef BASE_VERSION_H_ |
6 #define BASE_VERSION_H_ | 6 #define BASE_VERSION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // Returns true if the object contains a valid version number. | 30 // Returns true if the object contains a valid version number. |
31 bool IsValid() const; | 31 bool IsValid() const; |
32 | 32 |
33 // Commonly used pattern. Given a valid version object, compare if a | 33 // Commonly used pattern. Given a valid version object, compare if a |
34 // |version_str| results in a newer version. Returns true if the | 34 // |version_str| results in a newer version. Returns true if the |
35 // string represents valid version and if the version is greater than | 35 // string represents valid version and if the version is greater than |
36 // than the version of this object. | 36 // than the version of this object. |
37 bool IsOlderThan(const std::string& version_str) const; | 37 bool IsOlderThan(const std::string& version_str) const; |
38 | 38 |
39 // Returns NULL if the string is not in the proper format. | |
40 // Caller is responsible for freeing the Version object once done. | |
41 // DO NOT USE FOR NEWER CODE. | |
42 static Version* GetVersionFromString(const std::string& version_str); | |
43 | |
44 // Creates a copy of this version object. Caller takes ownership. | |
45 // DO NOT USE FOR NEWER CODE. | |
46 Version* Clone() const; | |
47 | |
48 bool Equals(const Version& other) const; | 39 bool Equals(const Version& other) const; |
49 | 40 |
50 // Returns -1, 0, 1 for <, ==, >. | 41 // Returns -1, 0, 1 for <, ==, >. |
51 int CompareTo(const Version& other) const; | 42 int CompareTo(const Version& other) const; |
52 | 43 |
53 // Return the string representation of this version. | 44 // Return the string representation of this version. |
54 const std::string GetString() const; | 45 const std::string GetString() const; |
55 | 46 |
56 const std::vector<uint16>& components() const { return components_; } | 47 const std::vector<uint16>& components() const { return components_; } |
57 | 48 |
58 private: | 49 private: |
59 std::vector<uint16> components_; | 50 std::vector<uint16> components_; |
60 }; | 51 }; |
61 | 52 |
62 #endif // BASE_VERSION_H_ | 53 #endif // BASE_VERSION_H_ |
OLD | NEW |