mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
LibIPC: Support transferring String over IPC
Note that unlike the StringView encoder, we do not handle any "null" state, as the new String cannot be null.
This commit is contained in:
parent
a1baa5cb00
commit
a7bb72a3d6
4 changed files with 29 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -23,6 +24,13 @@ ErrorOr<size_t> Decoder::decode_size()
|
|||
return static_cast<size_t>(TRY(decode<u32>()));
|
||||
}
|
||||
|
||||
template<>
|
||||
ErrorOr<String> decode(Decoder& decoder)
|
||||
{
|
||||
auto length = TRY(decoder.decode_size());
|
||||
return String::from_stream(decoder.stream(), length);
|
||||
}
|
||||
|
||||
template<>
|
||||
ErrorOr<DeprecatedString> decode(Decoder& decoder)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue