From a726fda5461a8ff9ef49e378a6170c1eeddbe02a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 1 May 2020 23:50:50 +0200 Subject: IPCCompiler: Add support for Vector It would be a lot nicer to support arbitrary Vector but for now I'm only adding Vector since I need it for something.. --- DevTools/IPCCompiler/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'DevTools') 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") { + 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") { + 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();"; -- cgit v1.2.3