Bash++
Bash++ compiler internal documentation
BashVersion.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <cstdint>
9#include <string>
10
21 uint16_t major = 5;
22 uint16_t minor = 2;
23
24 operator uint32_t() const {
25 return (static_cast<uint32_t>(major) << 16) | static_cast<uint32_t>(minor);
26 }
27
28 bool operator>=(const BashVersion& other) const {
29 return static_cast<uint32_t>(*this) >= static_cast<uint32_t>(other);
30 }
31
32 bool operator<=(const BashVersion& other) const {
33 return static_cast<uint32_t>(*this) <= static_cast<uint32_t>(other);
34 }
35
36 bool operator>(const BashVersion& other) const {
37 return static_cast<uint32_t>(*this) > static_cast<uint32_t>(other);
38 }
39
40 bool operator<(const BashVersion& other) const {
41 return static_cast<uint32_t>(*this) < static_cast<uint32_t>(other);
42 }
43
44 bool operator==(const BashVersion& other) const {
45 return static_cast<uint32_t>(*this) == static_cast<uint32_t>(other);
46 }
47
48 bool operator!=(const BashVersion& other) const {
49 return static_cast<uint32_t>(*this) != static_cast<uint32_t>(other);
50 }
51
52 std::string to_string() const {
53 return std::to_string(major) + "." + std::to_string(minor);
54 }
55
56 operator std::string() const {
57 return to_string();
58 }
59};
Represents a Bash version to target for code generation.
Definition BashVersion.h:20
uint16_t minor
Definition BashVersion.h:22
uint16_t major
Definition BashVersion.h:21
bool operator<=(const BashVersion &other) const
Definition BashVersion.h:32
bool operator>=(const BashVersion &other) const
Definition BashVersion.h:28
bool operator>(const BashVersion &other) const
Definition BashVersion.h:36
bool operator!=(const BashVersion &other) const
Definition BashVersion.h:48
std::string to_string() const
Definition BashVersion.h:52
bool operator<(const BashVersion &other) const
Definition BashVersion.h:40
bool operator==(const BashVersion &other) const
Definition BashVersion.h:44