1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibIPC: Add support for passing around ByteBuffers and HashMap<K, V>

It should be noted that using a shared buffer should still be preferred
over passing a raw ByteBuffer over the wire.
This commit is contained in:
AnotherTest 2020-11-07 23:09:45 +03:30 committed by Andreas Kling
parent 705ad670f3
commit c930e02624
4 changed files with 59 additions and 0 deletions

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/ByteBuffer.h>
#include <AK/String.h>
#include <AK/URL.h>
#include <LibIPC/Dictionary.h>
@ -141,6 +142,13 @@ Encoder& Encoder::operator<<(const String& value)
return *this << value.view();
}
Encoder& Encoder::operator<<(const ByteBuffer& value)
{
*this << static_cast<i32>(value.size());
m_buffer.append(value.data(), value.size());
return *this;
}
Encoder& Encoder::operator<<(const URL& value)
{
return *this << value.to_string();