-
Notifications
You must be signed in to change notification settings - Fork 0
/
Processor.h
62 lines (43 loc) · 958 Bytes
/
Processor.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
52
53
54
55
56
57
58
59
60
61
62
#ifndef __Processor__h__
#define __Processor__h__
#include <string>
#include <map>
#include "RSP.h"
using namespace std;
namespace gdb {
class Handler
{
public:
Handler();
virtual
~Handler();
virtual bool
onHandle(RSP* rsp, const string& cmd, const string& param) = 0;
};
class Processor
{
struct Response
{
Handler* handler;
string message;
Response();
~Response();
};
typedef map<string, Response> ResponseMap;
ResponseMap responseMap;
bool
getNextToken(const char* buf, const char* &sep, string& cmd, string& param) const;
public:
Processor();
~Processor();
void
defineResponseV(const string& cmd, const string& message, va_list args);
void
defineResponse(const string& cmd, const string& message, ...);
void
defineResponse(const string& cmd, Handler* handler);
void
serve(const string& name, const string& params = "");
};
}; //namespace gdb
#endif/*__Processor__h__*/