Flutter Engine
The Flutter Engine
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
14namespace impeller {
15
16struct Version {
17 public:
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_
size_t patch_version
Definition: version.h:20
size_t minor_version
Definition: version.h:19
static std::optional< Version > FromVector(const std::vector< size_t > &version)
constexpr bool IsAtLeast(const Version &other) const
Definition: version.h:31
std::string ToString() const
constexpr Version(size_t p_major=0, size_t p_minor=0, size_t p_patch=0)
Definition: version.h:22
size_t major_version
Definition: version.h:18