1
2
3
4
5
6 #ifndef CMAJOR_BUILD_BUILD_SERVER_MESSAGE_INCLUDED
7 #define CMAJOR_BUILD_BUILD_SERVER_MESSAGE_INCLUDED
8 #include <cmajor/build/MessageBody.hpp>
9 #include <cmajor/build/Message.hpp>
10
11 namespace cmajor { namespace build {
12
13 extern const char* pushProjectRequestId;
14 extern const char* pushProjectResponseId;
15 extern const char* pushProjectFileRequestId;
16 extern const char* pushProjectFileResponseId;
17 extern const char* pushProjectFileContentRequestId;
18 extern const char* pushProjectFileContentResponseId;
19 extern const char* buildProjectRequestId;
20 extern const char* buildProjectResponseId;
21 extern const char* showBuildMessageRequestId;
22 extern const char* showBuildMessageResponseId;
23 extern const char* errorResponseId;
24 extern const char* closeConnectionRequestId;
25
26 struct PushProjectRequest : public Message<ProjectInfo>
27 {
28 PushProjectRequest();
29 PushProjectRequest(JsonObject* messageObject);
30 const char* Id() const override { return pushProjectRequestId; }
31 void DispatchTo(MessageHandler& handler) override;
32 };
33
34 struct PushProjectResponse : public Message<ProjectUpToDate>
35 {
36 PushProjectResponse();
37 PushProjectResponse(JsonObject* messageObject);
38 const char* Id() const override { return pushProjectResponseId; }
39 void DispatchTo(MessageHandler& handler) override;
40 };
41
42 struct PushProjectFileRequest : public Message<ProjectInfo>
43 {
44 PushProjectFileRequest();
45 PushProjectFileRequest(JsonObject* messageObject);
46 const char* Id() const override { return pushProjectFileRequestId; }
47 void DispatchTo(MessageHandler& handler) override;
48 };
49
50 struct PushProjectFileResponse : public Message<ProjectInfo>
51 {
52 PushProjectFileResponse();
53 PushProjectFileResponse(JsonObject* messageObject);
54 const char* Id() const override { return pushProjectFileResponseId; }
55 void DispatchTo(MessageHandler& handler) override;
56 };
57
58 struct PushProjectFileContentRequest : public Message<ProjectInfo>
59 {
60 PushProjectFileContentRequest();
61 PushProjectFileContentRequest(JsonObject* messageObject);
62 const char* Id() const override { return pushProjectFileContentRequestId; }
63 void DispatchTo(MessageHandler& handler) override;
64 };
65
66 struct PushProjectFileContentResponse : public Message<ProjectUpdated>
67 {
68 PushProjectFileContentResponse();
69 PushProjectFileContentResponse(JsonObject* messageObject);
70 const char* Id() const override { return pushProjectFileContentResponseId; }
71 void DispatchTo(MessageHandler& handler) override;
72 };
73
74 struct BuildProjectRequest : public Message<ProjectToBuild>
75 {
76 BuildProjectRequest();
77 BuildProjectRequest(JsonObject* messageObject);
78 const char* Id() const override { return buildProjectRequestId; }
79 void DispatchTo(MessageHandler& handler) override;
80 };
81
82 struct BuildProjectResponse : public Message<ProjectBuilt>
83 {
84 BuildProjectResponse();
85 BuildProjectResponse(JsonObject* messageObject);
86 const char* Id() const override { return buildProjectResponseId; }
87 void DispatchTo(MessageHandler& handler) override;
88 };
89
90 struct ShowBuildMessageRequest : public Message<MessageLine>
91 {
92 ShowBuildMessageRequest();
93 ShowBuildMessageRequest(JsonObject* messageObject);
94 const char* Id() const override { return showBuildMessageRequestId; }
95 void DispatchTo(MessageHandler& handler) override;
96 };
97
98 struct ShowBuildMessageResponse : public Message<MessageShown>
99 {
100 ShowBuildMessageResponse();
101 ShowBuildMessageResponse(JsonObject* messageObject);
102 const char* Id() const override { return showBuildMessageResponseId; }
103 void DispatchTo(MessageHandler& handler) override;
104 };
105
106 struct ErrorResponse : public Message<Error>
107 {
108 ErrorResponse();
109 ErrorResponse(JsonObject* messageObject);
110 const char* Id() const override { return errorResponseId; }
111 void DispatchTo(MessageHandler& handler) override;
112 };
113
114 struct CloseConnectionRequest : Message<CloseConnection>
115 {
116 CloseConnectionRequest();
117 CloseConnectionRequest(JsonObject* messageObject);
118 const char* Id() const override { return closeConnectionRequestId; }
119 void DispatchTo(MessageHandler& handler) override;
120 };
121
122 void BuildServerMessageInit();
123 void BuildServerMessageDone();
124
125 } }
126
127 #endif // CMAJOR_BUILD_BUILD_SERVER_MESSAGE_INCLUDED