cpp-msgpack-light
0.3.0
A light library to serialize MessagePack.
Loading...
Searching...
No Matches
general_binary_container_traits.h
Go to the documentation of this file.
1
/*
2
* Copyright 2024 MusicScience37 (Kenta Kabashima)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
21
#pragma once
22
23
#include "
msgpack_light/serialization_buffer.h
"
24
25
namespace
msgpack_light::type_support::details
{
26
32
template
<
typename
T>
33
struct
general_binary_container_traits
{
34
public
:
35
static_assert
(std::is_same_v<typename T::value_type, unsigned char>);
36
43
static
void
serialize
(
serialization_buffer
& buffer,
const
T& value) {
44
buffer.
serialize_bin_size
(value.size());
45
buffer.
write
(value.data(), value.size());
46
}
47
};
48
49
}
// namespace msgpack_light::type_support::details
msgpack_light::serialization_buffer
Class of buffers to serialize data.
Definition
serialization_buffer.h:41
msgpack_light::serialization_buffer::serialize_bin_size
void serialize_bin_size(std::size_t size)
Serialize a size of a binary.
Definition
serialization_buffer.h:402
msgpack_light::serialization_buffer::write
void write(const unsigned char *data, std::size_t size)
Write data.
Definition
serialization_buffer.h:778
msgpack_light::type_support::details
Namespace of internal implementations.
Definition
general_array_container_traits.h:25
serialization_buffer.h
Definition of serialization_buffer class.
msgpack_light::type_support::details::general_binary_container_traits
Class to serialize binaries in STL containers.
Definition
general_binary_container_traits.h:33
msgpack_light::type_support::details::general_binary_container_traits::serialize
static void serialize(serialization_buffer &buffer, const T &value)
Serialize a value.
Definition
general_binary_container_traits.h:43
include
msgpack_light
type_support
details
general_binary_container_traits.h
Generated on
for cpp-msgpack-light by
1.14.0