-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.hpp
More file actions
50 lines (36 loc) · 1.12 KB
/
application.hpp
File metadata and controls
50 lines (36 loc) · 1.12 KB
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
#pragma once
#include <unordered_map>
#include <functional>
#include <vector>
#include <string>
#include "krypto_file.hpp"
#include "manager.hpp"
namespace pass_manager {
class Application {
public:
typedef std::vector<std::string> arguments;
typedef std::function<void(Manager&, const arguments&)> raw_action;
typedef const std::string description;
typedef std::pair<description, raw_action> action;
typedef std::unordered_map<std::string, action> action_map;
Application(const std::string& pass, const std::string& file);
~Application();
inline bool initialized() { return initialized_; }
void loop();
void register_action(const std::string& name,
const std::string& description,
raw_action new_action);
private:
void initialize();
void quit(Manager&, const arguments&);
void list(Manager&, const arguments&);
void no_action(Manager&, const arguments&);
raw_action get_action(const std::string& name);
private:
KryptoFile file_;
Manager manager_;
bool quit_;
bool initialized_;
action_map actions_;
};
}