| 330 | } |
| 331 | |
| 332 | IpcPacketVectorGraphics IpcPacket::interpretAsVectorGraphics() const { |
| 333 | IpcPacketVectorGraphics result; |
| 334 | IStream payload{mPayload}; |
| 335 | |
| 336 | EType type; |
| 337 | payload >> type; |
| 338 | if (type != EType::VectorGraphics) { |
| 339 | throw runtime_error{"Cannot interpret IPC packet as VectorGraphics."}; |
| 340 | } |
| 341 | |
| 342 | payload >> result.grabFocus; |
| 343 | payload >> result.imageName; |
| 344 | payload >> result.append; |
| 345 | payload >> result.nCommands; |
| 346 | |
| 347 | result.commands.resize(result.nCommands); |
| 348 | for (int32_t i = 0; i < result.nCommands; ++i) { |
| 349 | auto& command = result.commands[i]; |
| 350 | payload >> command.type; |
| 351 | command.data.resize(command.size()); |
| 352 | payload >> command.data; |
| 353 | } |
| 354 | |
| 355 | return result; |
| 356 | } |
| 357 | |
| 358 | static void makeSocketNonBlocking(Ipc::socket_t socketFd) { |
| 359 | #ifdef _WIN32 |
no test coverage detected