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