summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-03 16:05:53 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-03 16:06:40 +0200
commitfae309199947980924e2145fa4bb1764e89e4bbf (patch)
tree90d48b4418971fb0825654553f8d6039941b4cea /DevTools
parent016335eddedc4a56698d1df5020616d73dbb0ec0 (diff)
downloadserenity-fae309199947980924e2145fa4bb1764e89e4bbf.zip
IPCCompiler: Typedef the response message types as "ResponseType"
Each message will now have a typedef called ResponseType as an alias for the expected response type. This will aid in implementing the sync messaging code.
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/IPCCompiler/main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp
index 1f66b9ba4a..2637dac5f8 100644
--- a/DevTools/IPCCompiler/main.cpp
+++ b/DevTools/IPCCompiler/main.cpp
@@ -182,9 +182,11 @@ int main(int argc, char** argv)
dbg() << "namespace " << endpoint.name << " {";
dbg();
- auto do_message = [&](const String& name, const Vector<Parameter>& parameters) {
+ auto do_message = [&](const String& name, const Vector<Parameter>& parameters, String response_type = {}) {
dbg() << "class " << name << " final : public IMessage {";
dbg() << "public:";
+ if (!response_type.is_null())
+ dbg() << " typedef " << response_type << " ResponseType;";
dbg() << " virtual ~" << name << "() override {}";
dbg() << " virtual ByteBuffer encode() override";
dbg() << " {";
@@ -209,13 +211,15 @@ int main(int argc, char** argv)
dbg();
};
for (auto& message : endpoint.messages) {
+ String response_name;
if (message.is_synchronous) {
StringBuilder builder;
builder.append(message.name);
builder.append("Response");
- do_message(builder.to_string(), message.outputs);
+ response_name = builder.to_string();
+ do_message(response_name, message.outputs);
}
- do_message(message.name, message.inputs);
+ do_message(message.name, message.inputs, response_name);
}
dbg() << "} // namespace " << endpoint.name;
dbg();