19 "NE",
"SE",
"UE",
"LE",
"LS",
"RS",
"rne",
"rse",
20 "SW",
"NW",
"UW",
"LW",
"LN",
"RN",
"rsw",
"rnw",
46 "NE",
"SE",
"SW",
"NW",
62 "NORMAL",
"ENTRY",
"EXIT",
"COMBO",
"PBS",
"NOENTRY",
83 return fmt::format(
"0x{:04X} ({}, {})", tile.base(),
TileX(tile),
TileY(tile));
92 static size_t last_type_id = 0;
93 return ++last_type_id;
117 if (it == this->
known_names.end())
return std::nullopt;
119 return fmt::format(
"known_as.{}", it->second);
125 int num_spaces = 2 * this->
indent;
126 if (num_spaces > 0) {
152 if (!cur_name.empty()) {
static const std::string_view signal_type_names[]
SignalType short names.
std::string ValueStr(Trackdir td)
Return name of given Trackdir.
std::string TileStr(TileIndex tile)
Translate TileIndex into string.
static const std::string_view diagdir_names[]
DiagDirection short names.
static const std::string_view trackdir_names[]
Trackdir & TrackdirBits short names.
Functions to be used for debug printings.
std::string ComposeName(E value, std::span< const std::string_view > names, std::string_view unknown_name, E invalid_index, std::string_view invalid_name)
Helper template function that returns compound bitfield name that is concatenation of names of each s...
std::string_view ItemAt(E idx, std::span< const std::string_view > names, std::string_view unknown_name)
Helper template function that returns item of array at given index or unknown_name when index is out ...
DiagDirection
Enumeration for diagonal directions.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
Type (helpers) for enums.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
static uint TileY(TileIndex tile)
Get the Y component of a tile.
static uint TileX(TileIndex tile)
Get the X component of a tile.
Hides the direct accesses to the map array with map accessors.
A number of safeguards to prevent using unsafe methods.
SignalType
Type of signal, i.e.
Definition of base types and functions in a cross-platform compatible way.
Used as a key into map of known object instances.
KnownNamesMap known_names
Map of known object instances and their structured names.
std::stack< std::string > cur_struct
Tracker of the current structure name.
void WriteTile(std::string_view name, TileIndex t)
Write name & TileIndex to the output.
void BeginStruct(size_t type_id, std::string_view name, const void *ptr)
Open new structure (one level deeper than the current one) 'name = {<LF>'.
int indent
Current indent/nesting level.
std::string GetCurrentStructName()
Return structured name of the current class/structure.
std::string output_buffer
The output string.
std::optional< std::string > FindKnownAsName(size_t type_id, const void *ptr)
Find the given instance in our anti-recursion repository.
void WriteIndent()
Write some leading spaces into the output.
void EndStruct()
Close structure '}<LF>'.
static size_t NewTypeId()
Create a new type_id.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Trackdir
Enumeration for tracks and directions.
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
TrackdirBits
Allow incrementing of Trackdir variables.
@ INVALID_TRACKDIR_BIT
Flag for an invalid trackdirbit value.