-
Notifications
You must be signed in to change notification settings - Fork 0
/
shimple.h
46 lines (36 loc) · 1.03 KB
/
shimple.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
#ifndef SHIMPLE_H
#define SHIMPLE_H
#define SHI_EXIT_BAD_EXECUTION -1
#define SHI_EXIT_BAD_INPUT -2
#include <string.h>
#include <vector>
#include <string>
class Shimple {
public:
Shimple();
void shi_start();
// Declarations for builtin functions
int shi_cd(std::vector<std::string>);
int shi_help(std::vector<std::string>);
int shi_exit(std::vector<std::string>);
int shi_num_builtins();
private:
std::vector<std::string> builtin_str = {
"cd",
"help",
"exit"
};
// Function pointers for builtin commands
// It's an array of function pointers
// Which each take an array of strings and return an int
int (Shimple::*builtin_func[3]) (std::vector<std::string>) = {
&Shimple::shi_cd,
&Shimple::shi_help,
&Shimple::shi_exit
};
std::string shi_get_line();
std::vector<std::string> shi_split_line(std::string line);
int shi_execute(std::vector<std::string>);
int shi_launch(std::vector<std::string>);
};
#endif // SHIMPLE_H