Disable webaudio support on Android ARM by turning off use_openmax_dl_fft.
[chromium-blink-merge.git] / base / version.h
blobab7145e16d0b53de0c54d8433b6b50ceed4f6fa7
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
3 // found in the LICENSE file.
5 #ifndef BASE_VERSION_H_
6 #define BASE_VERSION_H_
8 #include <string>
9 #include <vector>
11 #include "base/base_export.h"
12 #include "base/basictypes.h"
14 // Version represents a dotted version number, like "1.2.3.4", supporting
15 // parsing and comparison.
16 class BASE_EXPORT Version {
17 public:
18 // The only thing you can legally do to a default constructed
19 // Version object is assign to it.
20 Version();
22 ~Version();
24 // Initializes from a decimal dotted version number, like "0.1.1".
25 // Each component is limited to a uint16. Call IsValid() to learn
26 // the outcome.
27 explicit Version(const std::string& version_str);
29 // Returns true if the object contains a valid version number.
30 bool IsValid() const;
32 // Returns true if the version wildcard string is valid. The version wildcard
33 // string may end with ".*" (e.g. 1.2.*, 1.*). Any other arrangement with "*"
34 // is invalid (e.g. 1.*.3 or 1.2.3*). This functions defaults to standard
35 // Version behavior (IsValid) if no wildcard is present.
36 static bool IsValidWildcardString(const std::string& wildcard_string);
38 // Commonly used pattern. Given a valid version object, compare if a
39 // |version_str| results in a newer version. Returns true if the
40 // string represents valid version and if the version is greater than
41 // than the version of this object.
42 bool IsOlderThan(const std::string& version_str) const;
44 bool Equals(const Version& other) const;
46 // Returns -1, 0, 1 for <, ==, >.
47 int CompareTo(const Version& other) const;
49 // Given a valid version object, compare if a |wildcard_string| results in a
50 // newer version. This function will default to CompareTo if the string does
51 // not end in wildcard sequence ".*". IsValidWildcard(wildcard_string) must be
52 // true before using this function.
53 int CompareToWildcardString(const std::string& wildcard_string) const;
55 // Return the string representation of this version.
56 const std::string GetString() const;
58 const std::vector<uint16>& components() const { return components_; }
60 private:
61 std::vector<uint16> components_;
64 #endif // BASE_VERSION_H_