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

Side by Side Diff: base/version.h

Issue 10576003: VariationsService now supports wildcard in min/max version (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 6 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 | « 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) 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 12 matching lines...) Expand all
23 ~Version(); 23 ~Version();
24 24
25 // Initializes from a decimal dotted version number, like "0.1.1". 25 // Initializes from a decimal dotted version number, like "0.1.1".
26 // Each component is limited to a uint16. Call IsValid() to learn 26 // Each component is limited to a uint16. Call IsValid() to learn
27 // the outcome. 27 // the outcome.
28 explicit Version(const std::string& version_str); 28 explicit Version(const std::string& version_str);
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 // Returns true if the version string is valid. In this version, the string
34 // can end with a wildcard character.
35 static bool IsValidWildcard(const std::string& version_str);
36
33 // Commonly used pattern. Given a valid version object, compare if a 37 // Commonly used pattern. Given a valid version object, compare if a
34 // |version_str| results in a newer version. Returns true if the 38 // |version_str| results in a newer version. Returns true if the
35 // string represents valid version and if the version is greater than 39 // string represents valid version and if the version is greater than
36 // than the version of this object. 40 // than the version of this object.
37 bool IsOlderThan(const std::string& version_str) const; 41 bool IsOlderThan(const std::string& version_str) const;
38 42
39 // Returns NULL if the string is not in the proper format. 43 // Returns NULL if the string is not in the proper format.
40 // Caller is responsible for freeing the Version object once done. 44 // Caller is responsible for freeing the Version object once done.
41 // DO NOT USE FOR NEWER CODE. 45 // DO NOT USE FOR NEWER CODE.
42 static Version* GetVersionFromString(const std::string& version_str); 46 static Version* GetVersionFromString(const std::string& version_str);
43 47
44 // Creates a copy of this version object. Caller takes ownership. 48 // Creates a copy of this version object. Caller takes ownership.
45 // DO NOT USE FOR NEWER CODE. 49 // DO NOT USE FOR NEWER CODE.
46 Version* Clone() const; 50 Version* Clone() const;
47 51
48 bool Equals(const Version& other) const; 52 bool Equals(const Version& other) const;
49 53
50 // Returns -1, 0, 1 for <, ==, >. 54 // Returns -1, 0, 1 for <, ==, >.
51 int CompareTo(const Version& other) const; 55 int CompareTo(const Version& other) const;
52 56
57 // Given a valid version object, compare if a |version_str| results in a
58 // newer version. This function will default to CompareTo if the string does
59 // not end in a wildcard character "*".
60 int CompareToWildcard(const std::string& version_str) const;
61
53 // Return the string representation of this version. 62 // Return the string representation of this version.
54 const std::string GetString() const; 63 const std::string GetString() const;
55 64
56 const std::vector<uint16>& components() const { return components_; } 65 const std::vector<uint16>& components() const { return components_; }
57 66
58 private: 67 private:
59 std::vector<uint16> components_; 68 std::vector<uint16> components_;
60 }; 69 };
61 70
62 #endif // BASE_VERSION_H_ 71 #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