mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
LibIPC+IPCCompiler: Add IPC::Decoder, let classes decode themselves
This shaves ~5 seconds off of a full build, not too bad. Also it just seems nicer to push this logic out to classes. It could be better but it's a start. :^)
This commit is contained in:
parent
dc417ada6d
commit
a4d857e3c5
12 changed files with 272 additions and 61 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/BufferStream.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibGfx/Point.h>
|
||||
|
||||
|
@ -40,3 +41,19 @@ const LogStream& operator<<(const LogStream& stream, const Point& value)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
bool decode(BufferStream& stream, Gfx::Point& point)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
stream >> x;
|
||||
stream >> y;
|
||||
if (stream.handle_read_failure())
|
||||
return false;
|
||||
point = { x, y };
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue