• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright 2015 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// Version.inc: Encapsulation of a GL version.
8
9#include <tuple>
10
11namespace gl
12{
13
14constexpr Version::Version()
15    : Version(0, 0)
16{
17}
18
19// Avoid conflicts with linux system defines
20#undef major
21#undef minor
22
23constexpr Version::Version(unsigned int major_, unsigned int minor_)
24    : major(major_),
25      minor(minor_)
26{
27}
28
29inline bool operator==(const Version &a, const Version &b)
30{
31    return std::tie(a.major, a.minor) == std::tie(b.major, b.minor);
32}
33
34inline bool operator!=(const Version &a, const Version &b)
35{
36    return std::tie(a.major, a.minor) != std::tie(b.major, b.minor);
37}
38
39inline bool operator>=(const Version &a, const Version &b)
40{
41    return std::tie(a.major, a.minor) >= std::tie(b.major, b.minor);
42}
43
44inline bool operator<=(const Version &a, const Version &b)
45{
46    return std::tie(a.major, a.minor) <= std::tie(b.major, b.minor);
47}
48
49inline bool operator<(const Version &a, const Version &b)
50{
51    return std::tie(a.major, a.minor) < std::tie(b.major, b.minor);
52}
53
54inline bool operator>(const Version &a, const Version &b)
55{
56    return std::tie(a.major, a.minor) > std::tie(b.major, b.minor);
57}
58
59}  // namespace gl
60