| Flutter Impeller |

version.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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.
4
5 #ifndef FLUTTER_IMPELLER_BASE_VERSION_H_
6 #define FLUTTER_IMPELLER_BASE_VERSION_H_
7
8 #include <cstddef>
9 #include <optional>
10 #include <string>
11 #include <tuple>
12 #include <vector>
13
14 namespace impeller {
15
16 struct Version {
17 public:
18 size_t major_version;
19 size_t minor_version;
20 size_t patch_version;
21
22 constexpr explicit Version(size_t p_major = 0,
23 size_t p_minor = 0,
24 size_t p_patch = 0)
25 : major_version(p_major),
26 minor_version(p_minor),
27 patch_version(p_patch) {}
28
29 static std::optional<Version> FromVector(const std::vector<size_t>& version);
30
31 constexpr bool IsAtLeast(const Version& other) const {
32 return std::tie(major_version, minor_version, patch_version) >=
33 std::tie(other.major_version, other.minor_version,
34 other.patch_version);
35 }
36
37 std::string ToString() const;
38 };
39
40 } // namespace impeller
41
42 #endif // FLUTTER_IMPELLER_BASE_VERSION_H_
impeller::Version
Definition: version.h:16
impeller::Version::patch_version
size_t patch_version
Definition: version.h:20
impeller::Version::ToString
std::string ToString() const
Definition: version.cc:27
impeller::Version::FromVector
static std::optional< Version > FromVector(const std::vector< size_t > &version)
Definition: version.cc:11
impeller::Version::minor_version
size_t minor_version
Definition: version.h:19
impeller::Version::major_version
size_t major_version
Definition: version.h:18
impeller::Version::IsAtLeast
constexpr bool IsAtLeast(const Version &other) const
Definition: version.h:31
impeller
Definition: allocation.cc:12
impeller::Version::Version
constexpr Version(size_t p_major=0, size_t p_minor=0, size_t p_patch=0)
Definition: version.h:22