QtDesignPatterns/mementopattern/caretaker.h

23 lines
346 B
C
Raw Normal View History

2024-02-06 17:21:37 +08:00
#include "memento.h"
#include <vector>
class Caretaker
{
public:
void add(Memento *memento)
{
vector.push_back(memento);
}
Memento *getMemento(size_t index)
{
return vector.at(index);
}
size_t getVectorLength()
{
return vector.size();
}
private:
std::vector<Memento *> vector;
};