-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.hpp
More file actions
42 lines (36 loc) · 752 Bytes
/
node.hpp
File metadata and controls
42 lines (36 loc) · 752 Bytes
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
#ifndef NODE_H
#define NODE_H
#include "request.hpp"
#include "response.hpp"
#include <functional>
#include <string>
namespace http {
class Node {
public:
bool m_is_value;
bool m_is_dummy;
std::string m_sub_path;
std::map<std::string, Node *> m_next;
std::function<void(Request, Response *)> m_function;
public:
Node(std::string sub, bool isValue,
std::function<void(Request, Response *)> func) {
m_sub_path = sub;
m_is_value = isValue;
m_function = func;
m_is_dummy = false;
};
Node(std::string sub) {
m_sub_path = sub;
m_is_dummy = true;
m_is_value = false;
m_function = nullptr;
};
~Node() {
for (auto n : m_next) {
delete n.second;
}
};
};
} // namespace http
#endif