memento_pattern
-
namespace memento_pattern
Namespace for the Memento pattern.
-
class Memento
- #include <memento.hpp>
The Memento class stores the state of the Originator.
Public Functions
-
inline explicit Memento(const std::string &state)
Constructor to initialize the Memento with a state.
- Parameters:
state – The state to save.
-
inline std::string getState() const
Retrieves the saved state.
- Returns:
The saved state as a string.
-
inline explicit Memento(const std::string &state)
-
class Originator
- #include <memento.hpp>
The Originator class creates and restores Memento objects.
Public Functions
-
inline void setState(const std::string &newState)
Sets the state of the Originator.
- Parameters:
newState – The new state.
-
inline std::string getState() const
Retrieves the current state of the Originator.
- Returns:
The current state as a string.
-
inline void setState(const std::string &newState)
-
class Memento