Serialisation: Add std::span wrappers for Recv_binary, Send_binary
This commit is contained in:
@@ -78,9 +78,9 @@ struct BufferSerialisationHelper {
|
|||||||
BufferSend_binary(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data, size);
|
BufferSend_binary(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Send_binary(const byte *data, const byte *end)
|
void Send_binary(std::span<const byte> data)
|
||||||
{
|
{
|
||||||
this->Send_binary(data, end - data);
|
this->Send_binary(data.data(), data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Send_buffer(const byte *data, const size_t size)
|
void Send_buffer(const byte *data, const size_t size)
|
||||||
@@ -263,6 +263,15 @@ public:
|
|||||||
pos += (decltype(pos)) size;
|
pos += (decltype(pos)) size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads binary data.
|
||||||
|
* @param buffer The buffer to put the data into.
|
||||||
|
*/
|
||||||
|
void Recv_binary(std::span<byte> buffer)
|
||||||
|
{
|
||||||
|
this->Recv_binary(buffer.data(), buffer.size());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns view of binary data.
|
* Returns view of binary data.
|
||||||
* @param size The size of the data.
|
* @param size The size of the data.
|
||||||
|
Reference in New Issue
Block a user