summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-01 23:50:50 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-02 01:29:55 +0200
commita726fda5461a8ff9ef49e378a6170c1eeddbe02a (patch)
treea60104ef098050d320c19975302352b78260884c /DevTools
parent828aee9932c41e28e27a191a170ec981dbd9131a (diff)
downloadserenity-a726fda5461a8ff9ef49e378a6170c1eeddbe02a.zip
IPCCompiler: Add support for Vector<i32>
It would be a lot nicer to support arbitrary Vector<T> but for now I'm only adding Vector<i32> since I need it for something..
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/IPCCompiler/main.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp
index 4766850840..6394bc816c 100644
--- a/DevTools/IPCCompiler/main.cpp
+++ b/DevTools/IPCCompiler/main.cpp
@@ -319,6 +319,16 @@ int main(int argc, char** argv)
out() << " return nullptr;";
out() << " " << parameter.name << ".append(move(rect));";
out() << " }";
+ } else if (parameter.type == "Vector<i32>") {
+ out() << " u64 " << parameter.name << "_size = 0;";
+ out() << " stream >> " << parameter.name << "_size;";
+ out() << " for (size_t i = 0; i < " << parameter.name << "_size; ++i) {";
+ out() << " i32 value;";
+ out() << " stream >> value;";
+ out() << " if (stream.handle_read_failure())";
+ out() << " return nullptr;";
+ out() << " " << parameter.name << ".append(value);";
+ out() << " }";
} else {
out() << " if (!decoder.decode(" << parameter.name << "))";
out() << " return nullptr;";
@@ -363,6 +373,11 @@ int main(int argc, char** argv)
out() << " stream << rect.width();";
out() << " stream << rect.height();";
out() << " }";
+ } else if (parameter.type == "Vector<i32>") {
+ out() << " stream << (u64)m_" << parameter.name << ".size();";
+ out() << " for (auto value : m_" << parameter.name << ") {";
+ out() << " stream << value;";
+ out() << " }";
} else if (parameter.type == "Gfx::ShareableBitmap") {
out() << " stream << m_" << parameter.name << ".shbuf_id();";
out() << " stream << m_" << parameter.name << ".width();";