mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-01 08:24:21 +01:00
Squashed 'src/ipc/libmultiprocess/' content from commit 35944ffd23fa
git-subtree-dir: src/ipc/libmultiprocess git-subtree-split: 35944ffd23fa26652b82210351d50e896ce16c8f
This commit is contained in:
34
include/mp/type-string.h
Normal file
34
include/mp/type-string.h
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2025 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef MP_PROXY_TYPE_STRING_H
|
||||
#define MP_PROXY_TYPE_STRING_H
|
||||
|
||||
#include <mp/util.h>
|
||||
|
||||
namespace mp {
|
||||
template <typename Value, typename Output>
|
||||
void CustomBuildField(TypeList<std::string>,
|
||||
Priority<1>,
|
||||
InvokeContext& invoke_context,
|
||||
Value&& value,
|
||||
Output&& output)
|
||||
{
|
||||
auto result = output.init(value.size());
|
||||
memcpy(result.begin(), value.data(), value.size());
|
||||
}
|
||||
|
||||
template <typename Input, typename ReadDest>
|
||||
decltype(auto) CustomReadField(TypeList<std::string>,
|
||||
Priority<1>,
|
||||
InvokeContext& invoke_context,
|
||||
Input&& input,
|
||||
ReadDest&& read_dest)
|
||||
{
|
||||
auto data = input.get();
|
||||
return read_dest.construct(CharCast(data.begin()), data.size());
|
||||
}
|
||||
} // namespace mp
|
||||
|
||||
#endif // MP_PROXY_TYPE_STRING_H
|
||||
Reference in New Issue
Block a user