1
2
3
4
5
6 #ifndef CMAJOR_BUILD_MESSAGE_HANDLER_INCLUDED
7 #define CMAJOR_BUILD_MESSAGE_HANDLER_INCLUDED
8 #include <cmajor/build/BuildApi.hpp>
9 #include <string>
10
11 namespace cmajor { namespace build {
12
13 struct PushProjectRequest;
14 struct PushProjectResponse;
15 struct PushProjectFileRequest;
16 struct PushProjectFileResponse;
17 struct PushProjectFileContentRequest;
18 struct PushProjectFileContentResponse;
19 struct BuildProjectRequest;
20 struct BuildProjectResponse;
21 struct ShowBuildMessageRequest;
22 struct ShowBuildMessageResponse;
23 struct ErrorResponse;
24 struct CloseConnectionRequest;
25
26 class MessageHandler
27 {
28 public:
29 virtual ~MessageHandler();
30 virtual void Handle(PushProjectRequest& request) {}
31 virtual void Handle(PushProjectResponse& response) {}
32 virtual void Handle(PushProjectFileRequest& request) {}
33 virtual void Handle(PushProjectFileResponse& response) {}
34 virtual void Handle(PushProjectFileContentRequest& request) {}
35 virtual void Handle(PushProjectFileContentResponse& response) {}
36 virtual void Handle(BuildProjectRequest& request) {}
37 virtual void Handle(BuildProjectResponse& response) {}
38 virtual void Handle(ShowBuildMessageRequest& request) {}
39 virtual void Handle(ShowBuildMessageResponse& response) {}
40 virtual void Handle(ErrorResponse& response) {}
41 virtual void Handle(CloseConnectionRequest& request) {}
42 };
43
44 class Requester : public MessageHandler
45 {
46 public:
47 virtual std::string Name() const = 0;
48 virtual std::string GetStateStr() const = 0;
49 void Handle(PushProjectRequest& request) override;
50 void Handle(PushProjectResponse& response) override;
51 void Handle(PushProjectFileRequest& request) override;
52 void Handle(PushProjectFileResponse& response) override;
53 void Handle(PushProjectFileContentRequest& request) override;
54 void Handle(PushProjectFileContentResponse& response) override;
55 void Handle(BuildProjectRequest& request) override;
56 void Handle(BuildProjectResponse& response) override;
57 void Handle(ShowBuildMessageRequest& request) override;
58 void Handle(ShowBuildMessageResponse& response) override;
59 void Handle(ErrorResponse& response) override;
60 void Handle(CloseConnectionRequest& request) override;
61 };
62
63 class RequestHandler : public MessageHandler
64 {
65 public:
66 virtual std::string Name() const = 0;
67 void Handle(PushProjectRequest& request) override;
68 void Handle(PushProjectResponse& response) override;
69 void Handle(PushProjectFileRequest& request) override;
70 void Handle(PushProjectFileResponse& response) override;
71 void Handle(PushProjectFileContentRequest& request) override;
72 void Handle(PushProjectFileContentResponse& response) override;
73 void Handle(BuildProjectRequest& request) override;
74 void Handle(ShowBuildMessageResponse& response) override;
75 void Handle(ErrorResponse& response) override;
76 void Handle(CloseConnectionRequest& request) override;
77 };
78
79 } }
80
81 #endif // CMAJOR_BUILD_MESSAGE_HANDLER_INCLUDED