131 [[nodiscard]] std::optional<NavEntry>
current()
const;
134 template <
typename Val
id>
135 [[nodiscard]] std::optional<NavEntry>
peekBack(
const Valid& valid)
const
142 template <
typename Val
id>
143 [[nodiscard]] std::optional<NavEntry>
peekForward(
const Valid& valid)
const
150 template <
typename Val
id>
151 std::optional<NavEntry>
back(
const Valid& valid)
154 if (!
index.has_value())
return std::nullopt;
160 template <
typename Val
id>
161 std::optional<NavEntry>
forward(
const Valid& valid)
164 if (!
index.has_value())
return std::nullopt;
175 template <
typename Val
id>
176 [[nodiscard]] std::optional<std::size_t>
findBack(
const Valid& valid)
const
184 template <
typename Val
id>
185 [[nodiscard]] std::optional<std::size_t>
findForward(
const Valid& valid)
const
Browser-style history of the screens visited in a career.
Definition nav_history.h:109
std::optional< std::size_t > findBack(const Valid &valid) const
Definition nav_history.h:176
void stepBackTo(const NavEntry &entry)
Steps back onto entry, a screen shown beneath the current one that the history cannot step back to (n...
Definition nav_history.cpp:91
std::optional< NavEntry > peekForward(const Valid &valid) const
Next screen valid accepts, without moving.
Definition nav_history.h:143
void visit(const NavEntry &entry)
Records a newly shown screen (repeating the current: ignored).
Definition nav_history.cpp:78
static constexpr std::size_t DEFAULT_CAPACITY
Definition nav_history.h:111
std::size_t capacity() const
Definition nav_history.h:170
std::size_t limit
Definition nav_history.h:195
std::size_t cursor
Definition nav_history.h:194
std::vector< NavEntry > entries
Definition nav_history.h:193
std::optional< NavEntry > back(const Valid &valid)
Steps back to the previous screen valid accepts.
Definition nav_history.h:151
std::size_t size() const
Definition nav_history.h:169
std::optional< NavEntry > peekBack(const Valid &valid) const
Previous screen valid accepts, without moving.
Definition nav_history.h:135
std::optional< std::size_t > findForward(const Valid &valid) const
Definition nav_history.h:185
std::size_t position() const
Index of the current entry (0 when empty).
Definition nav_history.h:172
std::optional< NavEntry > current() const
Screen shown now, if any was recorded.
Definition nav_history.cpp:127
std::optional< NavEntry > forward(const Valid &valid)
Steps forward to the next screen valid accepts.
Definition nav_history.h:161
void clear()
Forgets every entry (a career was started or loaded).
Definition nav_history.cpp:121
NavSection
Screens of the management shell. The sidebar groups them into a few hubs (Home, Inbox,...
Definition nav_history.h:26
int index
Definition runtime_editor.cpp:94
Represents a specific date in the game world.
Definition gamedate.h:20
A screen of the career as the recipe to open it again (which section, player, club or fixture),...
Definition nav_history.h:65
static NavEntry ofClub(TeamID team)
Definition nav_history.cpp:28
static NavEntry ofMatchReport(GameDateValue date, TeamID home, TeamID away)
Definition nav_history.cpp:36
GameDateValue date
Definition nav_history.h:81
TeamID away_team
Definition nav_history.h:80
bool operator==(const NavEntry &other) const =default
PlayerID player
Definition nav_history.h:77
bool isDetail() const
True for screens opened on top of another one (a profile, a report, a comparison of chosen players) r...
Definition nav_history.cpp:55
Kind kind
Definition nav_history.h:75
TeamID team
Definition nav_history.h:79
static NavEntry ofPlayer(PlayerID player)
Definition nav_history.cpp:20
PlayerID second_player
Definition nav_history.h:78
Kind
Definition nav_history.h:67
static NavEntry ofCompare(PlayerID first, PlayerID second)
Definition nav_history.cpp:46
static NavEntry ofSection(NavSection section)
Definition nav_history.cpp:13
NavSection section
Definition nav_history.h:76
uint16_t TeamID
Type alias for Team identifiers.
Definition types.h:18
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21