OpenTTD Source 20250205-master-gfd85ab1e2c
|
Enum-as-bit-set wrapper. More...
#include <enum_type.hpp>
Public Types | |
using | EnumType = Tenum |
Enum type of this EnumBitSet. | |
using | BaseType = Tstorage |
Storage type of this EnumBitSet, be ConvertibleThroughBase. | |
Public Member Functions | |
constexpr | EnumBitSet (Tenum value) |
constexpr | EnumBitSet (Tstorage data) |
constexpr | EnumBitSet (std::initializer_list< const Tenum > values) |
Construct an EnumBitSet from a list of enum values. | |
constexpr auto | operator<=> (const EnumBitSet &) const noexcept=default |
constexpr EnumBitSet & | Set (Tenum value) |
Set the enum value. | |
constexpr EnumBitSet & | Reset (Tenum value) |
Reset the enum value to not set. | |
constexpr EnumBitSet & | Flip (Tenum value) |
Flip the enum value. | |
constexpr bool | Test (Tenum value) const |
Test if the enum value is set. | |
constexpr bool | All (const EnumBitSet &other) const |
Test if all of the enum values are set. | |
constexpr bool | Any (const EnumBitSet &other) const |
Test if any of the enum values are set. | |
constexpr EnumBitSet | operator| (const EnumBitSet &other) const |
constexpr EnumBitSet | operator& (const EnumBitSet &other) const |
constexpr Tstorage | base () const noexcept |
Retrieve the raw value behind this EnumBitSet. | |
Private Attributes | |
Tstorage | data |
Bitmask of enum values. | |
Enum-as-bit-set wrapper.
Allows wrapping enum values as a bit set. Methods are loosely modelled on std::bitset.
Tenum | Enum values to wrap. |
Tsorage | Storage type required to hold eenum values. |
Definition at line 118 of file enum_type.hpp.
using EnumBitSet< Tenum, Tstorage >::BaseType = Tstorage |
Storage type of this EnumBitSet, be ConvertibleThroughBase.
Definition at line 121 of file enum_type.hpp.
using EnumBitSet< Tenum, Tstorage >::EnumType = Tenum |
Enum type of this EnumBitSet.
Definition at line 120 of file enum_type.hpp.
|
inlineconstexpr |
Definition at line 123 of file enum_type.hpp.
|
inlineconstexpr |
Definition at line 124 of file enum_type.hpp.
|
inlineexplicitconstexpr |
Definition at line 125 of file enum_type.hpp.
|
inlineconstexpr |
Construct an EnumBitSet from a list of enum values.
values | List of enum values. |
Definition at line 131 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::Set().
|
inlineconstexpr |
Test if all of the enum values are set.
other | BitSet of enum values to test. |
Definition at line 191 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::data.
|
inlineconstexpr |
Test if any of the enum values are set.
other | BitSet of enum values to test. |
Definition at line 201 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::data.
Referenced by AdvanceHouseConstruction(), ClearTownHouse(), CmdBuildObject(), IndustriesScopeResolver::GetVariable(), IsHouseSpecValid(), MakeTownHouse(), RemoveNearbyStations(), TileLoop_Town(), IndustrySpec::UsesOriginalEconomy(), and WatchedCargoCallback().
|
inlineconstexprnoexcept |
Retrieve the raw value behind this EnumBitSet.
Definition at line 220 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::data.
Referenced by AircraftVehicleChangeInfo(), RailVehicleChangeInfo(), RoadVehicleChangeInfo(), and ShipVehicleChangeInfo().
|
inlineconstexpr |
Flip the enum value.
value | Enum value to flip. |
Definition at line 167 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::Reset(), EnumBitSet< Tenum, Tstorage >::Set(), and EnumBitSet< Tenum, Tstorage >::Test().
Referenced by DispatchLeftClickEvent(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), and GenerateLandscapeWindow::OnClick().
|
inlineconstexpr |
Definition at line 211 of file enum_type.hpp.
|
inlineconstexpr |
Definition at line 206 of file enum_type.hpp.
|
inlineconstexpr |
Reset the enum value to not set.
value | Enum value to reset. |
Definition at line 156 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::data, and to_underlying().
Referenced by Window::DisableAllWidgetHighlight(), DropdownWindow::DropdownWindow(), EnumBitSet< Tenum, Tstorage >::Flip(), GRFConfig::GRFConfig(), GUIEngineListAddChildren(), HandleWindowDragging(), ENGNChunkHandler::Load(), LoadNewGRF(), NewVehicleAvailable(), SetGroupFlag(), Window::SetWidgetHighlight(), StartWindowDrag(), and StartWindowSizing().
|
inlineconstexpr |
Set the enum value.
value | Enum value to set. |
Definition at line 145 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::data, and to_underlying().
Referenced by Window::ApplyDefaults(), CmdCreateGroup(), EnumBitSet< Tenum, Tstorage >::EnumBitSet(), ErrorUnknownCallbackResult(), FixTTOEngines(), EnumBitSet< Tenum, Tstorage >::Flip(), GRFUnsafe(), Window::InitializeData(), InitializeNetworkPools(), LoadNewGRF(), NewVehicleAvailable(), SetGroupFlag(), Window::SetTimeout(), Window::SetWhiteBorder(), Window::SetWidgetHighlight(), ShowNewGrfVehicleError(), StartupOneEngine(), StartWindowDrag(), StartWindowSizing(), ViewportAddSignStrings(), ViewportAddStationStrings(), ViewportAddTownStrings(), and WaypointWindow::WaypointWindow().
|
inlineconstexpr |
Test if the enum value is set.
value | Enum value to check. |
Definition at line 181 of file enum_type.hpp.
References EnumBitSet< Tenum, Tstorage >::data, and to_underlying().
Referenced by AddAcceptedCargoOfHouse(), AddArticulatedParts(), NewGRFWindow::AddGRFToActive(), AfterLoadGame(), AfterLoadGRFs(), AircraftVehicleChangeInfo(), AnimateNewObjectTile(), BuildObject(), RefitWindow::BuildRefitList(), BuildTownHouse(), CalcEngineReliability(), CalculateRefitMasks(), CcRoadStop(), ChangeIndustryProduction(), IntSettingDesc::ChangeValue(), CheckAutoreplaceValidity(), CheckFlatLandRailStation(), CheckIfIndustryTileSlopes(), CheckSoftLimit(), PoolBase::Clean(), ClearTownHouse(), CloseAllNonVitalWindows(), CloseConstructionWindows(), CloseNonVitalWindows(), CloseWindowById(), CmdAutoreplaceVehicle(), CmdBuildAircraft(), CmdBuildBridge(), CmdBuildObject(), CmdBuildRailStation(), CmdBuildRailVehicle(), CmdBuildRoadStop(), CmdBuildRoadVehicle(), CmdBuildShip(), CmdReverseTrainDirection(), CmdSendVehicleToDepot(), CmdWantEnginePreview(), Train::ConsistChanged(), Engine::DetermineCapacity(), DispatchLeftClickEvent(), DispatchRightClickEvent(), DoCreateNewIndustry(), NWidgetLeaf::Draw(), DrawFrameRect(), DrawHouseInGUI(), DrawNewHouseTileInGUI(), DrawNewObjectTileInGUI(), DrawRoadDepotSprite(), DrawRoadStopTile(), SettingEntry::DrawSetting(), DrawStationTile(), DrawTile_Road(), DrawTileLayout(), VehicleGroupWindow::DrawWidget(), BuildObjectWindow::DrawWidget(), Window::DrawWidgets(), ErrorUnknownCallbackResult(), FillGRFDetails(), FinaliseEngineArray(), FixTTOEngines(), EnumBitSet< Tenum, Tstorage >::Flip(), GetArticulatedRefitMasks(), GetBestFittingSubType(), GetCapacityOfArticulatedParts(), GetCargoSubtypeText(), GetCargoSuffix(), GetCargoTypesOfArticulatedParts(), GetCompanyRailTypes(), GetCompanyRoadTypes(), GetEngineLiveryScheme(), GetFoundation_Town(), BuildHouseWindow::GetHouseInformation(), GetIfStopIsForType(), GetIndustryProbabilityCallback(), GetLoadAmount(), NewGRFWindow::GetPalette(), GetRailTypes(), GetRoadTypes(), GetSettingsDesc(), GetTownRoadType(), GetTownRoadTypeFirstIntroductionDate(), SettingDesc::GetType(), HandleAutoscroll(), HandleWindowDragging(), HasRailCatenary(), HasRoadCatenary(), HasRoadTypeAvail(), HeightMapCoastLines(), HeightMapSmoothCoasts(), IConsoleGetSetting(), IndustryTemporarilyRefusesCargo(), IniSaveSettings(), InitRailTypes(), InitRoadTypes(), IsArticulatedEngine(), IsArticulatedVehicleRefittable(), SettingDesc::IsEditable(), Engine::IsEnabled(), IsEngineBuildable(), IsEngineRefittable(), ObjectSpec::IsEverAvailable(), IsGoodGRFConfigList(), IsLoggableGrfConfig(), IsRoadStopAvailable(), IsStationAvailable(), PATSChunkHandler::Load(), LoadNewGRF(), LoadNewGRFFile(), LoadSettings(), IntSettingDesc::MakeValueValid(), MaybeBringWindowToFront(), NewVehicleAvailable(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), GenerateLandscapeWindow::OnClick(), CreateScenarioWindow::OnClick(), VehicleGroupWindow::OnClick(), NetworkStartServerWindow::OnClick(), NewGRFWindow::OnClick(), BuildRoadStationWindow::OnClick(), GameSettingsWindow::OnClick(), GenerateLandscapeWindow::OnInvalidateData(), NewGRFWindow::OnInvalidateData(), SelectGameWindow::OnResize(), GameOptionsWindow::OnResize(), ParamSet(), PlayVehicleSound(), Window::ProcessHighlightedInvalidations(), Rail90DegTurnDisallowed(), RailNoLevelCrossings(), RailVehicleChangeInfo(), RefitVehicle(), RelocateAllWindows(), StationResolverObject::ResolveReal(), RoadNoLevelCrossing(), RoadVehicleChangeInfo(), Vehicle::SendToDepot(), SetSettingValue(), SetSettingValue(), ReplaceVehicleWindow::SetStringParameters(), GenerateLandscapeWindow::SetStringParameters(), IntSettingDesc::SetValueDParams(), SetYearEngineAgingStops(), ShipVehicleChangeInfo(), ShowMissingContentWindow(), ShowNewGrfVehicleError(), StartupOneEngine(), TileLoop_Town(), TownCanGrowRoad(), TriggerIndustryProduction(), TryBuildTownHouse(), Train::UpdateDeltaXY(), UpdateHousesAndTowns(), UpdateObjectColours(), Vehicle::UpdateVisualEffect(), VehicleLengthChanged(), StringData::Version(), and ViewportAddString().
|
private |
Bitmask of enum values.
Definition at line 226 of file enum_type.hpp.
Referenced by EnumBitSet< Tenum, Tstorage >::All(), EnumBitSet< Tenum, Tstorage >::Any(), EnumBitSet< Tenum, Tstorage >::base(), EnumBitSet< Tenum, Tstorage >::Reset(), EnumBitSet< Tenum, Tstorage >::Set(), and EnumBitSet< Tenum, Tstorage >::Test().