A history of routes in memory: the entries, the current one, and back, forward and an edited address.
More...
#include <memory_history.hpp>
|
| | MemoryHistory (std::string initial={}) |
| | A history of one entry.
|
| std::string | current () const override |
| | The route the current entry holds.
|
| void | push (std::string const &route) override |
| | Adds an entry after the current one, dropping any entries forward of it, and makes it current.
|
| void | replace (std::string const &route) override |
| | Replaces the route the current entry holds.
|
| void | onPop (std::function< void(std::string const &route)> popped) override |
| | Sets what is called when the current entry changes from outside: back, forward, or an address the user edited. Replaces the previous callback; an empty one stops the calls.
|
| bool | back () |
| | Moves to the previous entry, as the browser's back does.
|
| bool | forward () |
| | Moves to the next entry, as the browser's forward does.
|
| void | follow (std::string const &route) |
| | Follows an address the user typed: adds an entry for route and reports the change, unless it is the current entry's.
|
| std::vector< std::string > const & | entries () const noexcept |
| | Every entry, oldest first.
|
| std::size_t | index () const noexcept |
| | The current entry's index.
|
|
| IHistory (IHistory const &)=delete |
|
IHistory & | operator= (IHistory const &)=delete |
|
| IHistory (IHistory &&)=delete |
|
IHistory & | operator= (IHistory &&)=delete |
A history of routes in memory: the entries, the current one, and back, forward and an edited address.
Definition at line 19 of file memory_history.hpp.
◆ MemoryHistory()
| morph::ui::testing::MemoryHistory::MemoryHistory |
( |
std::string | initial = {} | ) |
|
|
inlineexplicit |
A history of one entry.
- Parameters
-
| initial | The route the first entry holds, as a reloaded page or a shared link has it; empty for none. |
Definition at line 23 of file memory_history.hpp.
◆ current()
| std::string morph::ui::testing::MemoryHistory::current |
( |
| ) |
const |
|
inlinenodiscardoverridevirtual |
◆ push()
| void morph::ui::testing::MemoryHistory::push |
( |
std::string const & | route | ) |
|
|
inlineoverridevirtual |
◆ replace()
| void morph::ui::testing::MemoryHistory::replace |
( |
std::string const & | route | ) |
|
|
inlineoverridevirtual |
◆ onPop()
| void morph::ui::testing::MemoryHistory::onPop |
( |
std::function< void(std::string const &route)> | popped | ) |
|
|
inlineoverridevirtual |
Sets what is called when the current entry changes from outside: back, forward, or an address the user edited. Replaces the previous callback; an empty one stops the calls.
- Parameters
-
| popped | Called with the new current entry's route, empty when it holds none. |
Implements morph::ui::IHistory.
Definition at line 35 of file memory_history.hpp.
◆ back()
| bool morph::ui::testing::MemoryHistory::back |
( |
| ) |
|
|
inline |
Moves to the previous entry, as the browser's back does.
- Returns
- Whether there was one.
Definition at line 39 of file memory_history.hpp.
◆ forward()
| bool morph::ui::testing::MemoryHistory::forward |
( |
| ) |
|
|
inline |
Moves to the next entry, as the browser's forward does.
- Returns
- Whether there was one.
Definition at line 50 of file memory_history.hpp.
◆ follow()
| void morph::ui::testing::MemoryHistory::follow |
( |
std::string const & | route | ) |
|
|
inline |
Follows an address the user typed: adds an entry for route and reports the change, unless it is the current entry's.
- Parameters
-
Definition at line 62 of file memory_history.hpp.
◆ entries()
| std::vector< std::string > const & morph::ui::testing::MemoryHistory::entries |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ index()
| std::size_t morph::ui::testing::MemoryHistory::index |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
The documentation for this class was generated from the following file: