/
Showcase.h
51 lines (40 loc) · 1.25 KB
/
Showcase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <vector>
#include <map>
#include <set>
void HistoryShowcase_Basics();
void HistoryShowcase_InlineParams();
void HistoryShowcase_UserParams();
void HistoryShowcase_Advanced();
struct ManagerBase
{
ManagerBase();
HistoryContext context;
};
struct TrivialManager : ManagerBase
{
std::vector<int> objects;
bool AddNewObject();
bool AddNewObject_Undo();
};
struct MapManager : ManagerBase
{
std::map<std::string, int> objects;
bool AddObject(const std::string& key, int value = 0);
bool AddObject_Undo(const std::string& key, int value = 0);
};
struct MapWithRemoveManager : MapManager
{
bool RemoveObject(const std::string& key);
bool RemoveObject_Undo(const std::string& key);
};
struct MergingManager : ManagerBase
{
std::map<std::string, std::set<int>> objects;
bool SetObject(const std::string& key, const std::set<int>& values = {});
bool SetObject_Undo(const std::string& key, const std::set<int>& values = {});
bool RemoveObject(const std::string& key);
bool RemoveObject_Undo(const std::string& key);
bool MergeObjects(const std::set<std::string>& keys, const std::string& newKey);
bool MergeObjects_Undo(const std::set<std::string>& keys, const std::string& newKey);
};