OpenTTD Source 20241224-master-gf74b0cf984
|
Type (helpers) for enums. More...
Go to the source code of this file.
Macros | |
#define | DECLARE_POSTFIX_INCREMENT(enum_type) |
Some enums need to have allowed incrementing (i.e. | |
#define | DECLARE_ENUM_AS_BIT_SET(enum_type) |
Operators to allow to work with enum as with type safe bit set in C++. | |
#define | DECLARE_ENUM_AS_ADDABLE(EnumType) |
Operator that allows this enumeration to be added to any other enumeration. | |
Functions | |
template<typename enum_type > | |
constexpr std::underlying_type_t< enum_type > | to_underlying (enum_type e) |
Implementation of std::to_underlying (from C++23) | |
template<typename T , class = typename std::enable_if_t<std::is_enum_v<T>>> | |
debug_inline constexpr bool | HasFlag (const T x, const T y) |
Checks if a value in a bitset enum is set. | |
Type (helpers) for enums.
Definition in file enum_type.hpp.
#define DECLARE_ENUM_AS_ADDABLE | ( | EnumType | ) |
Operator that allows this enumeration to be added to any other enumeration.
Definition at line 45 of file enum_type.hpp.
#define DECLARE_ENUM_AS_BIT_SET | ( | enum_type | ) |
Operators to allow to work with enum as with type safe bit set in C++.
Definition at line 35 of file enum_type.hpp.
#define DECLARE_POSTFIX_INCREMENT | ( | enum_type | ) |
Some enums need to have allowed incrementing (i.e.
StationClassID)
Definition at line 18 of file enum_type.hpp.
|
constexpr |
Checks if a value in a bitset enum is set.
x | The value to check. |
y | The flag to check. |
Definition at line 58 of file enum_type.hpp.
Referenced by AcceptEnginePreview(), CalcEngineReliability(), CalendarEnginesMonthlyLoop(), CmdSendVehicleToDepot(), DrawEngineList(), DrawLayoutLine(), GUIEngineListAddChildren(), NewVehicleAvailable(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), SanitizeSingleStringHelper(), Vehicle::SendToDepot(), SetRailStationTileFlags(), and StartupOneEngine().
|
constexpr |
Implementation of std::to_underlying (from C++23)
Definition at line 15 of file enum_type.hpp.
Referenced by SetAnimatedTileState(), SetWaterTileType(), and TestVehicleBuildProbability().